/* ==========================================================================
   Halve — feuille de style
   Jetons repris du système « Nocturne » du dossier de design.
   L'accent ne remplit jamais une surface, sauf le bouton « + » : exception
   assumée, documentée dans le dossier de design.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #161826;
  --surface: #232532;
  --surface-2: #1c1e2b;
  --text: #e9e9ed;

  --n-100: #f3f5fe;
  --n-300: #cfd3e5;
  --n-500: #9397ab;
  --n-600: #75798c;
  --n-700: #595d6c;
  --n-800: #3f424d;
  --n-900: #292b31;

  --a-100: #f5f4ff;
  --a-300: #d2cefd;
  --a-400: #b5abfc;
  --a-500: #9184d9;
  --a-600: #796cbf;
  --a-700: #5d5294;
  --a-800: #423a6a;
  --a-900: #2b2741;

  --hairline: 0 0 0 1px var(--n-800);
  --rule: rgba(233, 233, 237, 0.07);
  --border: rgba(233, 233, 237, 0.16);

  --radius: 8px;
  --radius-lg: 14px;

  --shell: 520px;
  --tabbar: 96px;

  --danger: #e0796c;
  --ok: #7fc9a4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { display: block; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }
a { color: var(--a-500); }

:focus-visible { outline: 2px solid var(--a-500); outline-offset: 2px; border-radius: 4px; }

.icon { width: 1em; height: 1em; display: block; flex: none; stroke: currentColor; fill: none;
        stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------- ossature */

#app {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

@media (min-width: 560px) {
  body { background: #101120; padding: 0; }
  #app { box-shadow: 0 0 0 1px var(--n-900); }
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  flex: none;
}
.wordmark { font-weight: 500; font-size: 19px; letter-spacing: -0.02em; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--a-500); flex: none; }
.topbar .month { font-size: 12px; color: var(--n-600); flex: 1; text-transform: capitalize; }

.avatars { display: flex; align-items: center; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 500; letter-spacing: 0;
  background: var(--n-800); color: var(--n-300);
}
.avatar.me { background: var(--a-700); color: var(--a-100); }
.avatar.stacked { margin-left: -7px; box-shadow: 0 0 0 2px var(--bg); }
.avatar.sm { width: 20px; height: 20px; font-size: 9.5px; }
.avatar.lg { width: 38px; height: 38px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 24px; }

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 20px calc(var(--tabbar) + 34px);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.scroll::-webkit-scrollbar { display: none; }

.page-title { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin: 10px 0 4px; }
.page-sub { font-size: 12.5px; color: var(--n-600); margin: 0 0 20px; line-height: 1.5; }

.backlink {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--a-500); font-size: 13px; font-weight: 500;
  padding: 10px 0; margin-bottom: 2px;
}
.backlink .icon { font-size: 18px; }

/* ------------------------------------------------------------------- héros */

.hero { padding: 18px 0 16px; }
.kicker {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--a-600); margin-bottom: 8px;
}
.hero-amount { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero-amount .value { font-size: 44px; font-weight: 500; line-height: 1; letter-spacing: -0.03em; }
.hero-amount .caption { font-size: 13px; color: var(--n-500); }
.fade-rule {
  height: 1px; border: 0; margin: 16px 0 14px;
  background: linear-gradient(to right, var(--a-500), rgba(145, 132, 217, 0.15) 60%, transparent);
}

/* ----------------------------------------------------------------- boutons */

.row { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 15px; border-radius: var(--radius);
  border: 1px solid var(--border); color: var(--n-300);
  font-size: 14px; font-weight: 500; transition: background 0.15s, border-color 0.15s;
}
.btn .icon { font-size: 17px; }
.btn:hover { background: rgba(233, 233, 237, 0.07); }
.btn.grow { flex: 1; }
.btn.accent { border-color: var(--a-500); color: var(--text); }
.btn.accent:hover { background: rgba(145, 132, 217, 0.12); }
.btn.accent .icon { color: var(--a-400); }
.btn.danger { border-color: rgba(224, 121, 108, 0.4); color: var(--danger); }
.btn.danger:hover { background: rgba(224, 121, 108, 0.1); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn.wide { width: 100%; }

/* ------------------------------------------------------------------ cartes */

.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--hairline); padding: 14px;
}
.card.pad { padding: 16px; }
.cards { display: flex; gap: 10px; }
.cards > * { flex: 1; min-width: 0; }
.stat .kicker { font-size: 10px; letter-spacing: 0.1em; color: var(--a-500); margin-bottom: 6px; }
.stat .value { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.stat .sub { font-size: 11px; color: var(--n-600); margin-top: 3px; }
button.card { display: block; width: 100%; text-align: left; }
button.card:hover { box-shadow: 0 0 0 1px var(--a-700); }

.section-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--n-600); margin: 26px 0 10px;
}

/* ------------------------------------------------------------- puces rapide */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid rgba(233, 233, 237, 0.1);
  font-size: 13px; color: var(--n-300); transition: border-color 0.15s, background 0.15s;
}
.chip .icon { font-size: 15px; color: var(--a-400); }
.chip:hover { border-color: var(--a-600); }
.chip .amt { font-weight: 500; color: var(--n-500); }
.chip.on { background: var(--a-800); border-color: var(--a-500); color: var(--a-100); }
.chip.on .icon { color: var(--a-300); }

.chips.scroller { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips.scroller::-webkit-scrollbar { display: none; }
.chips.scroller .chip { flex: none; }

/* ------------------------------------------------------------------ listes */

.list-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 0 4px;
}
.list-head h2 { font-size: 15px; font-weight: 500; margin: 0; }
.list-head .count { font-size: 12px; color: var(--n-600); flex: 1; }
.list-head .link { font-size: 12px; font-weight: 500; color: var(--a-500); }

.entry {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 0; border-bottom: 1px solid var(--rule); text-align: left;
}
.entry:hover { background: rgba(233, 233, 237, 0.02); }
.tile {
  width: 34px; height: 34px; border-radius: var(--radius); flex: none;
  display: grid; place-items: center;
  background: var(--surface); color: var(--a-400); font-size: 17px;
}
.entry .body { flex: 1; min-width: 0; }
.entry .name {
  font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0;
}
.entry .name .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.entry .meta { display: block; font-size: 11.5px; color: var(--n-600); margin-top: 2px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .right { text-align: right; flex: none; }
.entry .amount { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; }
.entry .split { display: block; font-size: 11px; color: var(--n-600); margin-top: 2px; white-space: nowrap; }

.tag-perso {
  font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--a-300); background: var(--a-900);
  padding: 2px 6px; border-radius: 100px; flex: none;
}

.empty {
  text-align: center; color: var(--n-600); font-size: 13px;
  padding: 40px 20px; line-height: 1.6;
}
.empty .icon { font-size: 26px; margin: 0 auto 12px; color: var(--n-700); }

/* -------------------------------------------------------------- barre bas */

.tabbar {
  position: fixed; bottom: 0; z-index: 20;
  width: 100%; max-width: var(--shell); height: var(--tabbar);
  padding: 12px 26px 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  background: linear-gradient(to top, var(--bg) 0, var(--bg) 74px, rgba(22, 24, 38, 0.86) 80px, rgba(22, 24, 38, 0));
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  width: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--n-600); transition: color 0.15s;
}
.tab .icon { font-size: 22px; }
.tab span { font-size: 9.5px; }
.tab.on { color: var(--text); }
.tab.on .icon { stroke-width: 2.2; }
.tab.spacer { pointer-events: none; opacity: 0; }

.fab {
  position: fixed; bottom: calc(46px + env(safe-area-inset-bottom)); z-index: 21;
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--a-500); color: var(--bg); font-size: 27px;
  box-shadow: 0 8px 28px rgba(145, 132, 217, 0.4);
  transition: background 0.15s, transform 0.1s;
}
.fab:hover { background: var(--a-400); }
.fab:active { transform: scale(0.94); }

/* ----------------------------------------------------------------- anneaux */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ring-card { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ring-card .head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.ring-card .head .icon { font-size: 16px; color: var(--a-400); }
.ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; align-self: center; }
.ring .disc {
  width: 50px; height: 50px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-size: 13px; font-weight: 500;
}
.ring-card .status { font-size: 11.5px; color: var(--n-500); align-self: center; }
.ring-card .status.over { color: var(--a-400); }

/* -------------------------------------------------------------- progression */

.bar { height: 8px; border-radius: 100px; background: var(--n-900); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 100px; background: linear-gradient(to right, var(--a-700), var(--a-500)); }
.bar.thin { height: 6px; }

.split-line { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--n-600); margin-top: 8px; }

.rail { display: flex; height: 5px; border-radius: 100px; overflow: hidden; gap: 2px; }
.rail > i { display: block; height: 100%; }

/* ---------------------------------------------------------------- segments */

.field { margin-bottom: 14px; }
.field > label,
.field > .lab {
  display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--n-600); margin-bottom: 7px;
}
.seg {
  display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.seg button {
  flex: 1; padding: 9px 4px; text-align: center; font-size: 12.5px; color: var(--n-500);
  transition: background 0.15s, color 0.15s; min-width: 0;
}
.seg button.on { background: var(--a-800); color: var(--a-100); }
.seg button:hover:not(.on) { background: rgba(233, 233, 237, 0.05); }

input[type="text"], input[type="date"], input[type="number"], input[type="password"], textarea, select {
  width: 100%; padding: 11px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 14px;
}
input::placeholder { color: var(--n-700); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

input[type="range"] {
  width: 100%; accent-color: var(--a-500); background: transparent; margin: 6px 0;
}

/* -------------------------------------------------------------------- modale */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(15, 16, 24, 0.6);
  display: flex; justify-content: center; align-items: flex-end;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }

.sheet {
  width: 100%; max-width: var(--shell);
  max-height: 94dvh; overflow-y: auto; scrollbar-width: none;
  background: var(--surface-2);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 0 0 1px var(--n-800), 0 -20px 50px rgba(0, 0, 0, 0.6);
  padding: 16px 20px calc(28px + env(safe-area-inset-bottom));
  animation: riseIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet::-webkit-scrollbar { display: none; }
@keyframes riseIn { from { transform: translateY(100%); } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.sheet-head .title { font-size: 13px; font-weight: 500; }
.sheet-head button { font-size: 13px; color: var(--n-500); }
.sheet-head button.save { color: var(--a-500); font-weight: 500; }

.big-amount {
  text-align: center; font-size: 52px; font-weight: 500; line-height: 1;
  letter-spacing: -0.04em; padding: 4px 0 18px;
}
.big-amount.muted { color: var(--n-700); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.keypad button {
  height: 46px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--hairline); font-size: 20px; font-weight: 500;
  display: grid; place-items: center;
}
.keypad button:hover { background: var(--n-900); }
.keypad button .icon { font-size: 20px; }

.notice {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--a-900); color: var(--a-300); font-size: 11.5px; line-height: 1.45;
}
.notice .icon { font-size: 16px; color: var(--a-400); margin-top: 1px; }
.notice.warn { background: rgba(224, 121, 108, 0.12); color: #f0b3aa; }
.notice.warn .icon { color: var(--danger); }

/* --------------------------------------------------------------- connexion */

.login {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 30px 28px calc(40px + env(safe-area-inset-bottom)); text-align: center;
}
.login .wordmark { font-size: 28px; letter-spacing: -0.03em; }
.login .lede { color: var(--n-600); font-size: 13px; margin: 8px 0 34px; line-height: 1.6; }
.who { display: flex; gap: 12px; justify-content: center; }
.who button {
  flex: 1; max-width: 150px; padding: 20px 12px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--hairline);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: box-shadow 0.15s;
}
.who button:hover { box-shadow: 0 0 0 1px var(--a-600); }
.who .nm { font-size: 15px; font-weight: 500; }
.who .hint { font-size: 10.5px; color: var(--n-600); }

.pips { display: flex; gap: 12px; justify-content: center; margin: 26px 0 8px; }
.pip { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 1px var(--n-700); transition: background 0.12s; }
.pip.on { background: var(--a-500); box-shadow: 0 0 0 1px var(--a-500); }

.login .keypad { max-width: 280px; margin: 22px auto 0; }
.login .keypad button { height: 58px; font-size: 22px; }
.err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin-top: 12px; }
.login .shake { animation: shake 0.35s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(4px); }
  50% { transform: translateX(-4px); }
}

/* ------------------------------------------------------------ histogrammes */

.months { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.months .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 6px; }
.months .col > i { display: block; background: var(--n-800); border-radius: 3px 3px 0 0; min-height: 2px; }
.months .col.now > i { background: var(--a-500); }
.months .col > span { font-size: 10px; color: var(--n-600); text-align: center; }

.cat-row { margin-bottom: 12px; }
.cat-row .lab { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.cat-row .lab .amt { color: var(--n-500); }

.kv { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); width: 100%; text-align: left; }
.kv .body { flex: 1; min-width: 0; }
.kv .k { font-size: 13.5px; }
.kv .hint { font-size: 11px; color: var(--n-600); margin-top: 2px; line-height: 1.4; }
.kv .v { font-size: 12.5px; font-weight: 500; color: var(--a-400); flex: none; }
.kv .icon { font-size: 16px; color: var(--a-400); flex: none; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + 30px); z-index: 60;
  background: var(--surface); box-shadow: var(--hairline), 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 11px 16px; border-radius: 100px; font-size: 12.5px;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 40px);
  animation: fade 0.2s ease;
}
.toast .icon { font-size: 15px; color: var(--a-400); }
.toast.bad .icon { color: var(--danger); }

.footnote { text-align: center; font-size: 11.5px; line-height: 1.6; color: var(--n-600); margin: 16px 0 0; }

.banner-offline {
  background: rgba(224, 121, 108, 0.14); color: #f0b3aa;
  font-size: 11.5px; text-align: center; padding: 7px 12px;
}
