/* =========================================================
   FRAISMI — style néobanque
   Thème : clair par défaut, sombre via [data-theme="dark"]
   ou via le réglage de l'appareil quand le thème est « auto ».
   ========================================================= */
:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --ink: #0b0b0f;
  --ink-2: #3a3a44;
  --muted: #6b7080;
  --line: #e7e8ee;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #ecebff;
  --todo: #e5484d;
  --asked: #f2994a;
  --done: #1fa971;
  --danger: #e5484d;
  --hero-1: #14131f;
  --hero-2: #2b2675;
  --shadow: 0 1px 2px rgba(16, 18, 30, .04), 0 8px 24px rgba(16, 18, 30, .05);
  --radius: 22px;
  --nav-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0b0f;
  --surface: #16161d;
  --surface-2: #20202a;
  --ink: #f4f4f7;
  --ink-2: #c9c9d3;
  --muted: #8a8a99;
  --line: #262631;
  --accent: #7c74ff;
  --accent-ink: #ffffff;
  --accent-soft: #23214a;
  --todo: #ff6b6f;
  --asked: #ffb067;
  --done: #3ccf8e;
  --danger: #ff6b6f;
  --hero-1: #1b1a2e;
  --hero-2: #3a33a8;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0f;
    --surface: #16161d;
    --surface-2: #20202a;
    --ink: #f4f4f7;
    --ink-2: #c9c9d3;
    --muted: #8a8a99;
    --line: #262631;
    --accent: #7c74ff;
    --accent-ink: #ffffff;
    --accent-soft: #23214a;
    --todo: #ff6b6f;
    --asked: #ffb067;
    --done: #3ccf8e;
    --danger: #ff6b6f;
    --hero-1: #1b1a2e;
    --hero-2: #3a33a8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
  transition: background .2s, color .2s;
}
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 30px; font-weight: 750; }
h3 { font-size: 16px; font-weight: 650; }
b { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 32px 0; }
.mt { margin-top: 18px; }
.danger-text { color: var(--danger); }

/* ---------- Structure ---------- */
.app { min-height: 100dvh; }
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 100px);
}
.page { display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 4px; }
.section-title { font-size: 19px; font-weight: 700; margin: 12px 2px -2px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head .section-title { margin-bottom: -2px; }

.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-top: 1px solid var(--line);
}
.nav-brand, .nav-add { display: none; }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
}
.nav-item.active { color: var(--ink); }

.fab {
  position: fixed; z-index: 30;
  right: 18px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .15s;
}
.fab:active { transform: scale(.92); }

@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; width: 248px; height: auto; flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 26px 16px; border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 0 10px 26px; letter-spacing: .04em; }
  .nav-brand img { border-radius: 8px; }
  .nav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 12px; }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item.active { background: var(--surface-2); }
  .nav-add {
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px;
    border: 0; border-radius: 99px; padding: 14px; font-weight: 700;
    background: var(--accent); color: var(--accent-ink);
  }
  .main { margin-left: 248px; margin-right: 0; padding: 30px 44px 60px; max-width: 1000px; }
  .fab { display: none; }
  .actions { max-width: 460px; }
}

/* ---------- Composants ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.card p { margin: 0; }

.btn {
  border: 0; border-radius: 99px; padding: 12px 18px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); color: var(--ink); transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.grow { flex: 1; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 650; font-size: 14px; }
.link.small { font-size: 13px; align-self: flex-start; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border: 0; background: var(--surface-2); border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.icon-btn:active { opacity: .7; }

.input, .field input, select.input {
  width: 100%; border: 1.5px solid transparent; background: var(--surface-2); border-radius: 14px;
  padding: 13px 14px; font-size: 16px; outline: none; min-height: 50px; appearance: none; -webkit-appearance: none;
}
.input:focus, .field input:focus { border-color: var(--accent); background: var(--surface); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .group-label, .input-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input-label { display: flex; flex-direction: column; gap: 6px; }
.note { margin: 0; padding: 11px 13px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.note.err { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.note.ok { background: var(--accent-soft); }
.banner { padding: 11px 14px; border-radius: 14px; margin-bottom: 12px; font-size: 14px; }
.banner.err { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }

.avatar {
  flex: none; border-radius: 50%; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface));
}

.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 2px; }
.seg button {
  flex: 1; border: 0; background: none; border-radius: 11px; padding: 10px 4px; font-size: 14px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }

.loader { width: 28px; height: 28px; margin: 80px auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Accueil ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 2px; }
.topbar-sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.topbar-title { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.initials {
  width: 42px; height: 42px; border-radius: 50%; border: 0; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}

.hero {
  position: relative; overflow: hidden;
  border-radius: 26px; padding: 22px 22px 24px; color: #fff;
  background: linear-gradient(135deg, var(--hero-1) 0%, var(--hero-1) 35%, var(--hero-2) 100%);
  display: flex; flex-direction: column; gap: 6px;
}
.hero::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -90px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 116, 255, .55), transparent 70%);
}
.hero > * { position: relative; z-index: 1; }
.hero-label { font-size: 14px; opacity: .8; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.hero-amount { font-size: 46px; font-weight: 750; letter-spacing: -.035em; line-height: 1.05; margin-top: 6px; }
.hero-amount small { font-size: 26px; opacity: .7; letter-spacing: -.02em; }
.hero-calc { font-size: 14px; opacity: .72; }
.hero-calc span { margin: 0 3px; }
.hero-note { font-size: 13px; background: rgba(255, 255, 255, .12); padding: 7px 11px; border-radius: 10px; align-self: flex-start; margin-top: 4px; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 2px 0; }
.action { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; }
.action-ic {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.action.primary .action-ic { background: var(--accent); color: var(--accent-ink); }
.action-label { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.action:disabled { opacity: .4; }
.action:active .action-ic { transform: scale(.94); }

.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pending { cursor: pointer; gap: 8px; padding: 16px; }
.pending-head { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 650; color: var(--ink-2); }
.pending-amount { font-size: 24px; font-weight: 750; letter-spacing: -.03em; margin-top: 2px; }
.pending-lines { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
.pending-lines > span { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.pending-lines b { color: var(--ink-2); font-weight: 600; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.todo { background: var(--todo); }
.dot.asked { background: var(--asked); }

.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-title { border: 0; background: none; font-size: 16px; font-weight: 650; display: flex; flex-direction: column; align-items: center; color: var(--ink-2); }
.month-title small { font-size: 11px; color: var(--accent); font-weight: 600; }
.big-total { font-size: 34px; font-weight: 750; letter-spacing: -.035em; text-align: center; }
.stack-bar { display: flex; gap: 3px; height: 10px; border-radius: 99px; overflow: hidden; }
.stack-bar span { display: block; min-width: 4px; }
.legend { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.legend li { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.legend-label { flex: 1; display: flex; flex-direction: column; font-weight: 600; font-size: 15px; }
.legend-label small { font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* ---------- Opérations (relevé) ---------- */
.day { display: flex; flex-direction: column; gap: 6px; }
.day-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 4px 0; }
.day-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dep { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; position: relative; }
.dep + .dep::before { content: ""; position: absolute; top: 0; left: 70px; right: 16px; border-top: 1px solid var(--line); }
.dep:active { background: var(--surface-2); }
@media (hover: hover) { .dep:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); } }
.dep-main { flex: 1; min-width: 0; }
.dep-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep-sub { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 6px; }
.dep-sub span + span::before { content: "·"; margin-right: 6px; }
.dep-sub .dep-clip::before { content: none; }
.dep-clip { display: inline-flex; align-items: center; }
.dep-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.dep-amount { font-weight: 650; letter-spacing: -.01em; }
.status {
  border: 0; background: none; padding: 2px 0; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.s-a_faire { color: var(--todo); }
.status.s-en_attente { color: var(--asked); }
.status.s-termine { color: var(--done); }
.status.s-perso { color: var(--muted); cursor: default; }
.status.s-perso i { display: none; }

.month-block { display: flex; flex-direction: column; gap: 8px; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 2px 0; }
.month-head h2 { font-size: 19px; font-weight: 700; }
.month-head span { font-weight: 650; color: var(--ink-2); }

/* ---------- Liste : filtres ---------- */
.filters { display: flex; flex-direction: column; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--surface-2); border-radius: 14px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; outline: none; padding: 13px 0; font-size: 16px; color: var(--ink); }
.filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row select {
  flex: none; border: 0; background-color: var(--surface); box-shadow: var(--shadow); border-radius: 99px; padding: 8px 30px 8px 14px; font-size: 14px; font-weight: 600;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.filter-row select.on { background-color: var(--ink); color: var(--bg); }
.filter-sum { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 0 2px; }
.filter-sum b { color: var(--ink); }

/* ---------- Saisie (panneau) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(5, 5, 10, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100dvh - env(safe-area-inset-top) - 10px);
  background: var(--bg); border-radius: 28px 28px 0 0; display: flex; flex-direction: column;
  animation: up .24s cubic-bezier(.2, .9, .3, 1);
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 28px; max-height: 92dvh; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 0; }
.sheet-head h2 { font-size: 16px; font-weight: 650; }
.sheet-head span.icon-btn { background: none; }
.sheet-body { overflow-y: auto; padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.sheet-foot {
  display: flex; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
}
.sheet-foot .btn { min-height: 54px; font-size: 17px; }

.amount { display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 14px 0 4px; }
.amount input {
  width: 100%; max-width: 250px; text-align: right; border: 0; background: none; outline: none;
  font-size: 56px; font-weight: 750; letter-spacing: -.04em; padding: 0; caret-color: var(--accent);
}
.amount input::placeholder { color: var(--line); }
.amount span { font-size: 34px; font-weight: 650; color: var(--muted); flex: 1; }

.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-tile {
  border: 1.5px solid transparent; background: var(--surface); border-radius: 18px; padding: 12px 4px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px; box-shadow: var(--shadow);
}
.type-ic {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--surface));
}
.type-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.type-tile.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.type-tile.on .type-ic { background: var(--c); color: #fff; }

.group { display: flex; flex-direction: column; gap: 7px; }
.hint { font-size: 12.5px; color: var(--muted); padding-left: 4px; }
.row { display: flex; gap: 8px; align-items: center; }
.pill { border: 0; background: var(--surface-2); border-radius: 99px; padding: 11px 15px; font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--ink-2); }
.pill.on { background: var(--ink); color: var(--bg); }
.input.date { flex: 1; min-width: 0; }
.receipt { display: flex; align-items: center; gap: 12px; }
.receipt img { width: 72px; height: 72px; object-fit: cover; border-radius: 14px; display: block; }
.meta { font-size: 12.5px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 90px);
  background: var(--ink); color: var(--bg); border-radius: 99px; padding: 12px 18px; font-size: 14px; font-weight: 600;
  display: flex; gap: 16px; align-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: up .2s; transition: opacity .3s; white-space: nowrap; max-width: calc(100vw - 32px);
}
.toast .link { color: var(--accent-soft); }
.toast.hide { opacity: 0; pointer-events: none; }
@media (min-width: 900px) { .toast { bottom: 28px; margin-left: 124px; } }

/* ---------- Réglages / import ---------- */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 120px; }
.stack-form { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 15px; flex-wrap: wrap; }
.simple-list li > span:first-child { flex: 1; }
.simple-list li.off { opacity: .5; }
.rec-name { display: flex; align-items: center; gap: 10px; }
.rec-name > span:last-child { display: flex; flex-direction: column; font-weight: 600; }
.rec-name small { font-weight: 500; font-size: 12.5px; }
.row-actions { display: flex; gap: 14px; }
.file-btn { align-self: flex-start; }
.map-table { display: flex; flex-direction: column; gap: 8px; }
.map-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center; }
.map-row.two { grid-template-columns: 1fr 2fr; }
@media (max-width: 560px) { .map-row { grid-template-columns: 1fr 1fr; } .map-row > b { grid-column: 1 / -1; } .map-row.two { grid-template-columns: 1fr 1.6fr; } .map-row.two > b { grid-column: auto; } }
.preview { font-size: 13px; background: var(--surface-2); border-radius: 14px; overflow: hidden; }
.preview-row { display: grid; grid-template-columns: 82px 1fr 1.5fr 90px 80px; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.preview-row:first-child { border-top: 0; }
.preview-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-row b { text-align: right; }
@media (max-width: 560px) { .preview-row { grid-template-columns: 86px 1fr 74px; } .preview-row span:nth-child(2), .preview-row span:nth-child(4) { display: none; } }

/* ---------- Connexion ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { text-align: center; letter-spacing: .04em; }
.login-card > .muted { text-align: center; margin: -8px 0 8px; }
.login-logo { align-self: center; border-radius: 20px; }
.login-links { display: flex; justify-content: space-between; }

/* ---------- Catégories ---------- */
.sheet-backdrop.top { z-index: 55; background: rgba(5, 5, 10, .3); }
.sheet-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.type-tile.manage { border: 1.5px dashed var(--line); box-shadow: none; background: transparent; }
.type-tile.manage .type-ic { background: var(--surface-2); color: var(--muted); }
.cat-row {
  width: 100%; border: 0; background: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  text-align: left; color: var(--muted); position: relative;
}
.cat-row + .cat-row::before { content: ""; position: absolute; top: 0; left: 66px; right: 16px; border-top: 1px solid var(--line); }
.cat-row:active { background: var(--surface-2); }
.cat-row.off { opacity: .5; }
.cat-row-main { flex: 1; display: flex; flex-direction: column; }
.cat-row-main b { color: var(--ink); font-weight: 600; }
.cat-row-main small { font-size: 12.5px; }
.cat-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 2px; }
.cat-preview b { font-size: 18px; }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
@media (max-width: 420px) { .icon-grid { grid-template-columns: repeat(6, 1fr); } }
.icon-pick {
  aspect-ratio: 1; border: 1.5px solid transparent; border-radius: 12px; background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2);
}
.icon-pick.on { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.swatch.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.card-title-row { display: flex; justify-content: space-between; align-items: baseline; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--surface-2); font-size: 14px; font-weight: 600; }

/* ---------- Accueil : confirmation et répartition ---------- */
.confirm { border: 1.5px solid var(--accent); }
.confirm p { font-size: 15px; }
.people { display: flex; flex-direction: column; gap: 3px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.people > span { display: flex; justify-content: space-between; gap: 6px; }
.people > span > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people b { color: var(--ink-2); font-weight: 600; }

/* ---------- Guide ---------- */
.initials { display: grid; place-items: center; }
.guide { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.guide li { display: flex; gap: 14px; align-items: flex-start; }
.guide b { display: block; margin: 8px 0 3px; }
.guide p { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.topbar-title { font-size: 22px; }
.brand-word { color: var(--accent); letter-spacing: .02em; }

/* ---------- Verrouillage ---------- */
.lock {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 48px) 24px calc(env(safe-area-inset-bottom) + 24px);
}
.lock-top { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.lock-top img { border-radius: 16px; }
.lock-top h1 { font-size: 22px; letter-spacing: .04em; }
.lock-top p { margin: 0; min-height: 20px; }
.pin-dots { display: flex; gap: 18px; margin-top: 18px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-2); }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pin-dots.shake { animation: shake .4s; }
.pin-dots.shake i { border-color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 26px; }
.keypad button {
  width: 78px; height: 78px; border-radius: 50%; border: 0; font-size: 30px; font-weight: 500;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.keypad button:active { background: var(--surface-2); }
.keypad button:disabled { opacity: .4; }
.keypad .key-alt { background: none; box-shadow: none; display: grid; place-items: center; color: var(--ink-2); }
.lock-link { margin-top: 8px; }
.lock-forgot { max-width: 340px; display: flex; flex-direction: column; gap: 10px; text-align: center; font-size: 14px; color: var(--ink-2); }
.lock-forgot p { margin: 0; }
@media (max-height: 640px) { .keypad { gap: 10px 22px; } .keypad button { width: 64px; height: 64px; font-size: 26px; } .keypad { grid-template-columns: repeat(3, 64px); } .lock { padding-top: 24px; } }

.tag-on { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; color: var(--done); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-weight: 600; }
.switch-row > span { display: flex; align-items: center; gap: 10px; }
.switch {
  appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--surface-2);
  position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--done); }
.switch:checked::after { transform: translateX(20px); }
.pin-input { letter-spacing: .5em; font-size: 20px; text-align: center; }

/* ---------- Face ID ---------- */
.lock-center { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.lock-center p { margin: 0; font-size: 14px; max-width: 260px; }
.faceid-btn {
  width: 112px; height: 112px; border-radius: 32px; border: 0; display: grid; place-items: center;
  background: var(--surface); color: var(--accent); box-shadow: var(--shadow);
}
.faceid-btn.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .7; } }
.sheet.offer { max-width: 420px; }
.offer-body { align-items: center; text-align: center; padding-top: 28px; gap: 12px; }
.offer-body h2 { font-size: 21px; }
.offer-body p { margin: 0; }
.offer-ic { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.sheet-foot.col { flex-direction: column; }
@media (prefers-reduced-motion: reduce) { .faceid-btn.busy { animation: none; } }

/* ---------- Historique des versements ---------- */
.hero-link {
  align-self: flex-start; margin-top: 8px; border: 0; background: rgba(255, 255, 255, .12); color: #fff;
  border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px;
}
.page-title-sm { font-size: 22px; }
.ghost-space { background: none; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary > div { display: flex; flex-direction: column; gap: 2px; }
.summary small { font-size: 12px; color: var(--muted); font-weight: 600; }
.summary b { font-size: 18px; letter-spacing: -.02em; }
.versement { padding: 0; gap: 0; overflow: hidden; }
.versement-head {
  border: 0; background: none; text-align: left; padding: 16px 44px 16px 18px; display: flex; flex-direction: column; gap: 3px; position: relative; width: 100%;
}
.versement-date { font-size: 13px; color: var(--muted); font-weight: 600; }
.versement-amount { font-size: 26px; font-weight: 750; letter-spacing: -.03em; }
.versement-calc { font-size: 13px; color: var(--muted); }
.versement-calc em { font-style: normal; font-weight: 650; }
.versement-calc em.plus { color: var(--asked); }
.versement-calc em.moins { color: var(--todo); }
.versement-note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 4px 8px; align-self: flex-start; margin-top: 4px; }
.chev { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); transition: transform .2s; }
.chev.open { transform: translateY(-50%) rotate(90deg); }
.versement-body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 16px; border-top: 1px solid var(--line); background: var(--bg); padding-top: 12px; }
.versement-body .day-card { box-shadow: none; }
.calc { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; color: var(--muted); }
.calc b { color: var(--ink); text-align: right; }
.calc span:nth-last-child(2), .calc b:last-child { padding-top: 6px; border-top: 1px solid var(--line); color: var(--ink); font-weight: 650; }
