:root {
  --bg: #0d0f16;
  --bg2: #11141d;
  --surface: #161a25;
  --surface2: #1d2230;
  --border: #272d3d;
  --text: #e9ebf2;
  --muted: #8a91a5;
  --faint: #5b6275;
  --accent: #7c5cff;
  --accent2: #22d3ee;
  --grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 16px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5fa;
  --bg2: #eceef6;
  --surface: #ffffff;
  --surface2: #f3f4f9;
  --border: #e1e4ee;
  --text: #171a26;
  --muted: #646b80;
  --faint: #9aa0b2;
  --shadow: 0 10px 30px rgba(30, 40, 80, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.num, .money { font-variant-numeric: tabular-nums; }
kbd {
  font-family: inherit; font-size: 11px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
}

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.sidebar {
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 18px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 6px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px;
  box-shadow: 0 6px 18px rgba(124, 92, 255, .45);
}
img.brand-logo { background: none; box-shadow: none; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  border: 0; background: transparent; color: var(--muted); text-align: left; transition: .15s;
}
.nav button em { font-style: normal; }
.nav button:hover { background: var(--surface); color: var(--text); }
.nav button.active { background: var(--surface2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: 11px; color: var(--faint); line-height: 1.8; text-align: center; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.view { flex: 1; overflow-y: auto; padding: 24px 28px 60px; scroll-behavior: smooth; }
.view > * { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Generic ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.mt { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.w100 { width: 100%; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.up { color: var(--green); }
.down { color: var(--red); }
.center { text-align: center; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; min-width: 0;
}
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card h3 .actions { display: flex; gap: 6px; }

.btn {
  border: 1px solid var(--border); background: var(--surface2); padding: 9px 14px;
  border-radius: 10px; font-weight: 600; transition: transform .1s, filter .15s, background .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-glow { background: var(--grad); border: 0; color: #fff; padding: 12px; box-shadow: 0 8px 22px rgba(124, 92, 255, .35); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; font-size: 16px;
}
.icon-btn:hover { background: var(--surface2); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--border); font-size: 12px; font-weight: 600;
}
button.chip:hover { border-color: var(--accent); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface2); color: var(--muted); font-weight: 600; }
.pill.up { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.pill.down { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

input[type=range] { width: 100%; accent-color: var(--accent); }

.progress { height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.progress.thin { height: 5px; }

/* ---------- Privacy ---------- */
body.privacy .money { filter: blur(9px); user-select: none; transition: filter .2s; }
body.privacy .money:hover { filter: blur(0); }

/* ---------- Dashboard ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(124, 92, 255, .35), transparent 55%),
              radial-gradient(120% 140% at 100% 100%, rgba(34, 211, 238, .25), transparent 55%), var(--surface);
  border: 1px solid var(--border);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px;
}
.hero-label { color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: .3px; }
.hero-value { font-size: 52px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin: 6px 0 10px; }
.hero-delta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ticker { margin-top: 16px; font-size: 12px; color: var(--muted); }
.ticker b { color: var(--green); font-variant-numeric: tabular-nums; }
.level-box { background: color-mix(in srgb, var(--bg) 55%, transparent); border: 1px solid var(--border); border-radius: 16px; padding: 16px; backdrop-filter: blur(6px); }
.level-emoji { font-size: 38px; line-height: 1; }
.level-name { font-weight: 800; font-size: 18px; }
.hero-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.kpi .k-value { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.kpi .k-sub { font-size: 12px; color: var(--faint); }

.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; padding: 4px 6px; border-radius: 8px; cursor: pointer; }
.legend-item:hover { background: var(--surface2); }
.legend-item i { width: 12px; height: 12px; border-radius: 4px; }
.donut-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }

.insight { display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface2); align-items: flex-start; }
.insight + .insight { margin-top: 8px; }
.insight .ico { font-size: 20px; }
.insight b { display: block; margin-bottom: 2px; }
.insight p b { display: inline; margin: 0; }
.insight p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.score-ring { position: relative; width: 120px; height: 120px; flex: none; }
.score-ring .score-val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; font-weight: 800; }
.score-lines { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.score-line { font-size: 12px; }
.score-line .row { margin-bottom: 4px; }

.rank-bar { position: relative; height: 14px; border-radius: 99px; background: linear-gradient(90deg, #f87171, #fbbf24, #34d399, #22d3ee, #7c5cff); margin: 26px 0 8px; }
.rank-marker { position: absolute; top: -22px; transform: translateX(-50%); font-size: 18px; transition: left 1s cubic-bezier(.2, .8, .2, 1); }
.rank-marker::after { content: ""; position: absolute; left: 50%; top: 24px; width: 3px; height: 18px; background: var(--text); transform: translateX(-50%); border-radius: 2px; }
.rank-scale { position: relative; height: 30px; font-size: 11px; color: var(--faint); }
.rank-scale span { position: absolute; top: 0; transform: translateX(-50%); text-align: center; white-space: nowrap; }

.fun-eq { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fun-eq > div { background: var(--surface2); border-radius: 12px; padding: 12px; text-align: center; }
.fun-eq .e { font-size: 24px; }
.fun-eq .v { font-weight: 800; font-size: 17px; margin-top: 4px; }
.fun-eq .l { font-size: 11px; color: var(--muted); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--faint); font-size: 11px; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface2); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap;
  opacity: 0; transition: opacity .12s; z-index: 5;
}
.chart-tip .t-row { display: flex; gap: 8px; align-items: center; }
.chart-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.empty-chart { height: 200px; display: grid; place-items: center; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 12px; padding: 20px; }

/* ---------- Accounts ---------- */
.cat-block + .cat-block { margin-top: 16px; }
.cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cat-head .dot { width: 10px; height: 10px; border-radius: 3px; }
.cat-head h4 { margin: 0; font-size: 14px; }
.cat-head .total { margin-left: auto; font-weight: 700; }
.acc {
  display: grid; grid-template-columns: 42px 1fr 170px 150px 84px; gap: 14px; align-items: center;
  padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; transition: .15s;
}
.acc:hover { background: var(--surface2); border-color: var(--border); }
.acc .emo { width: 42px; height: 42px; border-radius: 12px; background: var(--surface2); display: grid; place-items: center; font-size: 20px; }
.acc .name { font-weight: 600; }
.acc .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.acc .val { text-align: right; font-weight: 700; font-size: 15px; }
.acc .val input { text-align: right; font-weight: 700; padding: 7px 10px; }
.acc .cap { font-size: 11px; color: var(--muted); }
.acc .cap .progress { margin-top: 4px; }
.quick-add { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-btns { display: flex; gap: 6px; justify-content: flex-end; }
.auto-val {
  width: 100%; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 6px 10px;
  border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.auto-val b { font-size: 15px; }
.auto-val:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.lines { margin: -2px 12px 8px 68px; border-left: 2px solid var(--border); padding-left: 12px; cursor: pointer; }
.lines:hover { border-left-color: var(--accent); }
.line { display: grid; grid-template-columns: 90px minmax(0, 1fr) 170px 100px 80px 150px; gap: 10px; align-items: center; font-size: 12px; padding: 4px 0; }
.line .tick { font-weight: 700; color: var(--accent2); }
.line .lname { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line > b, .line .lchg, .line .lpl, .line > .money { text-align: right; }
.movers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.modal.wide { width: min(900px, 100%); }
.hold-wrap { overflow-x: auto; }
.tbl.holdings td { vertical-align: middle; padding: 8px 6px; }
.tbl.holdings input { padding: 7px 9px; }
.search-box { background: var(--surface2); border-radius: 14px; padding: 12px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
.results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.res { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 9px 10px; border-radius: 10px; border: 1px solid transparent; background: var(--surface); }
.res:hover { border-color: var(--accent); }
.res b { color: var(--accent2); }

/* ---------- Goals & badges ---------- */
.goal { display: flex; flex-direction: column; gap: 10px; }
.goal-top { display: flex; gap: 12px; align-items: center; }
.goal-emo { font-size: 30px; }
.goal.done { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 18px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); transition: .2s; }
.badge .b-emo { font-size: 38px; }
.badge .b-name { font-weight: 700; margin-top: 6px; }
.badge .b-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.badge .b-date { font-size: 11px; color: var(--green); margin-top: 6px; }
.badge.locked { opacity: .45; }
.badge.locked .b-emo { filter: grayscale(1); }
.badge:not(.locked):hover { transform: translateY(-3px) rotate(-1deg); box-shadow: var(--shadow); }
.levels { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.lvl { flex: none; width: 104px; text-align: center; padding: 12px 6px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--border); font-size: 12px; }
.lvl .e { font-size: 26px; }
.lvl.cur { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.lvl.locked { opacity: .4; }

/* ---------- Table ---------- */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tbl td.r, .tbl th.r { text-align: right; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(5, 7, 12, .6); backdrop-filter: blur(5px); display: grid; place-items: center; z-index: 50; animation: fade .2s; padding: 20px; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px 24px; box-shadow: var(--shadow); animation: pop .25s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-foot .left { margin-right: auto; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-bottom: 16px; }
.tpl { border: 1px solid var(--border); background: var(--bg2); border-radius: 10px; padding: 6px 4px; font-size: 11px; font-weight: 600; text-align: center; }
.tpl span { display: block; font-size: 17px; margin-bottom: 2px; }
.tpl:hover, .tpl.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg2)); }

/* ---------- Express ---------- */
.express { width: min(520px, 100%); text-align: center; }
.express .dots { display: flex; gap: 5px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.express .dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--border); transition: .2s; }
.express .dots i.on { background: var(--accent); width: 20px; }
.express .dots i.done { background: var(--green); }
.ex-emo { font-size: 54px; }
.ex-name { font-size: 22px; font-weight: 800; margin-top: 6px; }
.ex-prev { color: var(--muted); margin: 6px 0 18px; }
.ex-input { font-size: 32px; font-weight: 800; text-align: center; padding: 14px; }
.ex-delta { height: 24px; margin-top: 10px; font-weight: 700; }
.ex-quick { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.ex-card { animation: slide .28s ease both; }
@keyframes slide { from { opacity: 0; transform: translateX(40px); } }
.ex-result { font-size: 44px; font-weight: 800; margin: 10px 0; }

/* ---------- Toast & confetti ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--surface2); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); min-width: 260px; max-width: 360px; animation: toastIn .35s cubic-bezier(.2, .9, .3, 1.3); }
.toast.badge-toast { border-left-color: var(--amber); }
.toast b { display: block; }
.toast small { color: var(--muted); }
@keyframes toastIn { from { transform: translateX(120%); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100vw; height: 100vh; }

.empty { text-align: center; padding: 50px 20px; }
.empty .big { font-size: 64px; }
.empty h2 { margin: 10px 0 6px; }
.empty p { color: var(--muted); max-width: 520px; margin: 0 auto 20px; line-height: 1.5; }

.slider-row { display: grid; grid-template-columns: 1fr 76px; gap: 12px; align-items: center; }
.slider-row output { text-align: right; font-weight: 700; }
.milestones { display: flex; flex-direction: column; gap: 8px; }
.milestone { display: flex; justify-content: space-between; padding: 10px 12px; background: var(--surface2); border-radius: 10px; font-size: 13px; }

.proj-grid { grid-template-columns: 320px minmax(0, 1fr); }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .proj-grid { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .view { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .acc { grid-template-columns: 42px 1fr 120px 84px; }
  .lines { margin-left: 12px; }
  .line { grid-template-columns: 70px 1fr 90px; }
  .line .lname, .line > .money, .line .lpl { display: none; }
  .acc .cap { display: none; }
  .donut-wrap { grid-template-columns: 1fr; }
  .hero-value { font-size: 38px; }
}

/* ---------- Amis ---------- */
.hero-friends { display: flex; gap: 18px; align-items: center; background: radial-gradient(120% 140% at 0% 0%, rgba(124, 92, 255, .28), transparent 60%), var(--surface); }
.hero-friends .big { font-size: 54px; }
.steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; color: var(--muted); font-size: 13px; }
.steps li { margin-bottom: 6px; }
.steps b { color: var(--text); }
textarea.input { resize: vertical; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; }
.board { display: flex; flex-direction: column; gap: 6px; }
.board-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: var(--surface2); }
.board-row:hover { border-color: var(--accent); }
.board-row.me { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.board-row .rank { font-size: 18px; text-align: center; font-weight: 800; }
.board-row .who { display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.board-row .score { text-align: right; white-space: nowrap; }
.race-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.race-legend span { display: inline-flex; align-items: center; gap: 6px; }
.race-legend i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.member { display: flex; flex-direction: column; gap: 10px; text-align: left; cursor: pointer; border-top: 4px solid var(--mc); transition: transform .15s, box-shadow .15s; }
.member:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.member .m-emo { font-size: 32px; }
.member .m-name { font-weight: 800; font-size: 15px; }
.member .m-net { font-size: 26px; font-weight: 800; letter-spacing: -.5px; text-align: left; }
.mcat + .mcat { margin-top: 14px; }
.macc { display: flex; justify-content: space-between; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--border); font-size: 13px; }
.lines.nolink { cursor: default; margin: 6px 0 8px 18px; }
.mini-badges { display: flex; flex-wrap: wrap; gap: 8px; font-size: 26px; }
.mini-badges .locked { filter: grayscale(1); opacity: .3; }
.modal .donut-wrap { grid-template-columns: 140px minmax(0, 1fr); gap: 14px; }
.modal .legend-item { grid-template-columns: 12px minmax(0, 1fr) auto auto; font-size: 12px; }
.paused-banner { border-color: color-mix(in srgb, var(--amber) 60%, transparent); background: color-mix(in srgb, var(--amber) 10%, var(--surface)); }
.paused-banner .small { color: var(--muted); margin-top: 4px; }
.m-warn { color: var(--amber); text-align: left; }

/* ---------- Ajout en 2 étapes ---------- */
.modal.add-flow { width: min(720px, 100%); }
.af-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.af-head h2 { margin: 0; }
.af-step { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface2); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.af-search { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 2px 14px; transition: border-color .15s, box-shadow .15s; }
.af-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.af-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; padding: 12px 0; min-width: 0; }
.af-body { margin-top: 6px; max-height: min(56vh, 520px); overflow-y: auto; padding-right: 4px; }
.af-group + .af-group { margin-top: 6px; }
.af-glabel { font-size: 12px; font-weight: 700; color: var(--muted); margin: 14px 0 8px; }
.af-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.af-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); text-align: left; transition: border-color .15s, transform .1s; }
.af-tile .e { font-size: 20px; margin-bottom: 2px; }
.af-tile b { font-size: 13px; }
.af-tile small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.af-tile:hover, .af-tile:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg2)); outline: none; }
.af-tile:active { transform: scale(.97); }
.af-row { width: 100%; display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; }
.af-row:hover, .af-row.on { background: var(--surface2); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.af-ico { font-size: 22px; text-align: center; }
.af-ico.tick, .af-badge.tick { font-size: 11px; font-weight: 800; color: var(--accent2); background: var(--bg2); border-radius: 8px; padding: 6px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.af-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-main small { color: var(--muted); font-size: 12px; }
.af-tag { font-size: 11px; color: var(--muted); background: var(--bg2); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.af-note { font-size: 12px; color: var(--muted); padding: 6px 4px; }
.af-tip { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.6; background: var(--surface2); border-radius: 12px; padding: 10px 12px; }
.af-chosen { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface2); margin-bottom: 16px; }
.af-chosen .af-main { flex: 1; }
.af-badge { width: 52px; height: 52px; border-radius: 12px; background: var(--bg2); display: grid; place-items: center; font-size: 26px; flex: none; }
.af-badge.tick { display: grid; padding: 4px; }
.af-big { font-size: 26px; font-weight: 800; padding: 12px 14px; }
.af-calc { font-size: 13px; color: var(--muted); font-weight: 500; min-height: 20px; }
.af-calc b { color: var(--text); font-size: 17px; }
.af-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.af-mode { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg2); display: flex; flex-direction: column; gap: 4px; }
.af-mode small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.af-mode.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--bg2)); }
.af-targets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.af-target { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg2); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.af-target small { font-weight: 400; color: var(--muted); font-size: 11px; }
.af-target.new { border-style: dashed; }
.af-target.on { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 14%, var(--bg2)); }
.af-warn { font-size: 12px; color: var(--amber); line-height: 1.5; margin: -2px 0 10px; }
.af-warn:empty { display: none; }
details.af-adv { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
details.af-adv summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
details.af-adv .form-grid { margin-top: 12px; }
@media (max-width: 640px) { .af-modes { grid-template-columns: 1fr; } .af-row { grid-template-columns: 54px minmax(0, 1fr); } .af-tag { display: none; } }

/* ---------- Ajout : retours immédiats & réussite ---------- */
.af-tile.owned small { color: var(--green); }
.af-tile .e.tick { font-size: 11px; font-weight: 800; color: var(--accent2); background: var(--surface2); border-radius: 6px; padding: 3px 6px; margin-bottom: 4px; }
.af-info { font-size: 13px; line-height: 1.5; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; background: color-mix(in srgb, var(--accent2) 10%, var(--surface2)); border: 1px solid color-mix(in srgb, var(--accent2) 35%, transparent); }
.af-feedback { font-size: 13px; color: var(--muted); line-height: 1.6; min-height: 4px; margin-top: 6px; }
.af-feedback b { color: var(--text); }
.af-feedback .warn, .warn { color: var(--amber); }
.af-link { border: 0; background: none; color: var(--accent2); font-size: 12px; font-weight: 600; padding: 4px 0; text-align: left; width: fit-content; }
.af-link:hover { text-decoration: underline; }
.af-surf { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.af-surf[hidden] { display: none; }
.af-surf span { color: var(--muted); }
#wShare > span, .af-flabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.af-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.af-chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg2); font-size: 13px; font-weight: 600; }
.af-chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg2)); }
.af-seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.af-seg button { border: 0; background: transparent; padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.af-seg button.on { background: var(--accent); color: #fff; }
.af-seg button:disabled { opacity: .4; cursor: not-allowed; }
.af-done { text-align: center; padding: 8px 4px 2px; }
.af-done-ico { font-size: 52px; animation: pop .4s cubic-bezier(.2, .9, .3, 1.4); }
.af-done h2 { margin: 8px 0 0; }
.af-impact { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin: 18px 0 8px; padding: 14px 26px; border-radius: 16px; background: var(--surface2); }
.af-impact b { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.af-next { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.af-sugg { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.af-done .af-glabel { text-align: center; }
div.field { display: flex; flex-direction: column; gap: 6px; }
div.field > label:first-child { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Profil de test ---------- */
body.test-profile .sidebar { box-shadow: inset 0 4px 0 var(--amber); }
.test-pill { display: inline-block; margin-top: 3px; background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }

/* ---------- Organisateur du groupe ---------- */
.admin-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 8%, var(--surface2)); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.admin-box .small { margin-top: 3px; line-height: 1.5; max-width: 640px; }
.brand-user { font-size: 11px; color: var(--muted); margin-top: 2px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-user b { color: var(--text); }
.test-banner { background: var(--amber); color: #1a1205; font-weight: 600; font-size: 13px; padding: 8px 28px; text-align: center; }

/* ---------- Périodes, direct, total du groupe ---------- */
.seg-sm button { padding: 5px 10px; font-size: 12px; }
.card h3 { flex-wrap: wrap; }
.period-seg { flex-wrap: wrap; }
.chart-note { margin-top: 8px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; vertical-align: 1px;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); animation: livedot 2s infinite; }
@keyframes livedot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
.group-total { display: flex; flex-direction: column; gap: 16px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(124, 92, 255, .26), transparent 60%), radial-gradient(90% 120% at 100% 100%, rgba(34, 211, 238, .14), transparent 60%), var(--surface); }
.gt-value { font-size: 40px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.gt-delta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.gt-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--surface2); gap: 2px; }
.gt-bar i { display: block; height: 100%; transition: width .6s ease; }
.gt-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.gt-row { display: grid; grid-template-columns: 12px 1fr auto 52px; gap: 8px; align-items: center; font-size: 13px; }
.gt-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.gt-row span:last-child { text-align: right; }

/* ---------- Fil du groupe, récap, duel, mises à jour ---------- */
.feed { display: flex; flex-direction: column; gap: 2px; max-height: 460px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.feed-item { display: flex; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-emo { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }
.feed-body { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.4; }
.feed-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.reacts { display: flex; gap: 4px; }
.react { border: 1px solid var(--border); background: var(--surface2); border-radius: 999px; padding: 2px 8px; font-size: 13px; cursor: pointer; transition: transform .1s; }
.react:hover { transform: scale(1.12); }
.react.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.react b { font-size: 11px; margin-left: 2px; }
.recap { background: radial-gradient(120% 120% at 100% 0%, rgba(251, 191, 36, .14), transparent 60%), var(--surface); }
.recap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 15px; }
.recap-grid { display: flex; flex-direction: column; gap: 10px; }
.recap-row { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; }
.recap-ico { font-size: 22px; width: 30px; text-align: center; flex-shrink: 0; }
.modal .recap-head { font-size: 18px; }
.duel-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; text-align: center; }
.duel-side { background: var(--surface2); border-radius: 14px; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.duel-score { font-size: 34px; font-weight: 800; padding: 0 10px; }
.duel-sec { margin-top: 16px; }
.duel-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.duel-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.duel-table td { padding: 7px 4px; border-bottom: 1px solid var(--border); }
.update-overlay { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(6px); }
.update-overlay .card { text-align: center; padding: 28px 40px; }
.notes { display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.4; background: var(--surface2); border-radius: 12px; padding: 14px 16px; }

/* =========================================================
   Téléphone (≤ 860 px) : barre d'onglets, feuilles qui montent du bas,
   cibles tactiles ≥ 44 px, champs en 16 px (pas de zoom automatique sur iPhone)
   ========================================================= */
.tabbar, .phone-only { display: none !important; }
html.web .pc-only { display: none !important; }
.restore-ok { background: var(--surface2); border-radius: 12px; padding: 12px 14px; line-height: 1.6; }
.phone-qr { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.qr-box { padding: 6px; background: #fff; border-radius: 16px; line-height: 0; }
.phone-steps { margin: 0; }
.kbdish { display: inline-block; padding: 0 5px; border-radius: 5px; background: var(--surface2); border: 1px solid var(--border); }
.sheet-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-list.compact { margin-top: 12px; }
.sheet-item { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface2); min-height: 60px; -webkit-tap-highlight-color: transparent; }
.sheet-item b { display: block; font-size: 15px; }
.sheet-item small { color: var(--muted); font-size: 12.5px; }
.sheet-item.primary { background: var(--grad); border-color: transparent; color: #fff; }
.sheet-item.primary small { color: rgba(255, 255, 255, .85); }
.sheet-item:active, .sheet-tile:active { transform: scale(.98); }
.si-ico { font-size: 24px; width: 32px; text-align: center; flex: none; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface2); font-size: 12.5px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.sheet-tile span { font-size: 26px; }
.sheet-tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface2)); }
.more-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.more-lvl { font-size: 34px; width: 52px; height: 52px; border-radius: 16px; background: var(--surface2); display: grid; place-items: center; }

@media (max-width: 860px) {
  html, body { height: 100%; }
  body { font-size: 15px; }
  button, a, input, select, textarea { touch-action: manipulation; }
  .app, .main { height: 100dvh; }
  .phone-only { display: block !important; }
  .desk-only, .hint, kbd { display: none !important; }

  /* En-tête compact, sous la barre d'état de l'iPhone */
  .topbar { padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; border-bottom: 0; background: var(--bg); }
  .topbar h1 { font-size: 24px; letter-spacing: -.4px; }
  #btnAdd, #btnTheme { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .view { padding: 4px 14px calc(100px + env(safe-area-inset-bottom)); overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }

  /* Barre d'onglets */
  .tabbar {
    display: grid !important; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg2) 86%, transparent); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border-top: 1px solid var(--border);
  }
  .tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 2px; min-height: 52px; color: var(--muted); font-size: 10.5px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
  .tabbar button span { font-size: 22px; line-height: 1.1; filter: grayscale(.7); opacity: .75; transition: transform .18s, filter .18s, opacity .18s; }
  .tabbar button em { font-style: normal; }
  .tabbar button.on { color: var(--text); }
  .tabbar button.on span { filter: none; opacity: 1; transform: translateY(-1px) scale(1.1); }
  .tabbar .tab-fab { justify-content: center; }
  .tabbar .tab-fab span { width: 56px; height: 56px; margin-top: -26px; border-radius: 19px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 30px; font-weight: 300; filter: none; opacity: 1; box-shadow: 0 10px 24px rgba(124, 92, 255, .5), 0 0 0 5px var(--bg); }
  .tabbar .tab-fab:active span { transform: scale(.92); }

  /* Toasts au-dessus des onglets */
  .toasts { left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
  @keyframes toastIn { from { transform: translateY(120%); opacity: 0; } }

  /* Fenêtres : feuilles qui montent du bas */
  .overlay { place-items: end stretch; padding: 0; }
  .modal, .modal.wide, .modal.add-flow, .express {
    width: 100%; max-width: none; max-height: calc(100dvh - env(safe-area-inset-top) - 10px);
    border-radius: 24px 24px 0 0; border-bottom: 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    animation: sheetUp .3s cubic-bezier(.2, .9, .3, 1);
  }
  .modal::before { content: ''; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .modal h2 { font-size: 19px; }
  .modal-foot { flex-wrap: wrap; position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: var(--surface); padding: 10px 0 2px; margin-top: 16px; }
  .modal-foot .btn { flex: 1 1 40%; justify-content: center; }
  .modal-foot .left { margin-right: 0; }
  .modal.add-flow { height: calc(100dvh - env(safe-area-inset-top) - 10px); display: flex; flex-direction: column; }
  .modal.add-flow .af-body { max-height: none; flex: 1; }

  /* Boutons et champs adaptés au doigt */
  .btn { min-height: 44px; padding: 10px 14px; }
  .btn-sm { min-height: 36px; }
  .input, select, textarea, input { font-size: 16px !important; }
  .input { min-height: 44px; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; min-height: 34px; }
  .card { padding: 14px; border-radius: 16px; }
  .card h3 { font-size: 13.5px; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid { gap: 12px; }
  .mt { margin-top: 12px; }

  /* Tableau de bord */
  .hero { padding: 18px 16px; gap: 14px; border-radius: 20px; }
  .hero-label { font-size: 11.5px; }
  .hero-value { font-size: 40px; letter-spacing: -1px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions .btn { justify-content: center; padding: 10px 8px; }
  .level-box { padding: 14px; }
  .kpi .k-value { font-size: 19px; }
  .kpi .k-sub { font-size: 11.5px; }
  .donut-wrap { grid-template-columns: 1fr; gap: 12px; }
  .legend-item { min-height: 40px; }
  .ticker { line-height: 1.5; }

  /* Patrimoine : lignes lisibles au doigt */
  .acc-top { gap: 8px; }
  .acc-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; padding-bottom: 2px; }
  .acc-chips::-webkit-scrollbar { display: none; }
  .acc-chips .chip { white-space: nowrap; flex: none; }
  .acc-actions { width: 100%; justify-content: space-between; }
  .acc-actions .btn .lbl { display: inline; }
  .cat-head { flex-wrap: nowrap; }
  .cat-head h4 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .cat-head .cat-count { display: none; }
  .acc { grid-template-columns: 40px minmax(0, 1fr) 118px 36px; gap: 10px; padding: 10px 2px; min-height: 64px; }
  .acc:hover { background: transparent; border-color: transparent; }
  .acc .emo { width: 40px; height: 40px; font-size: 19px; cursor: pointer; }
  .acc-info { cursor: pointer; min-width: 0; }
  .acc .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .acc .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .acc .cap { display: none; }
  .acc .val input { font-size: 17px !important; padding: 8px 10px; }
  .auto-val { padding: 6px 8px; }
  .auto-val b { font-size: 15px; }
  .acc-btns { flex-direction: column; gap: 4px; }
  .acc-btns .icon-btn { width: 36px; height: 32px; font-size: 15px; }
  .lines { margin: -4px 0 8px 50px; padding-left: 10px; }
  .line { grid-template-columns: 62px minmax(0, 1fr) 64px; font-size: 12.5px; padding: 5px 0; }
  .line .lname, .line > .money, .line .lpl { display: none; }
  .quick-add { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .quick-add .chip { flex: none; white-space: nowrap; min-height: 40px; }

  /* Amis */
  .friends-head > .row:last-child { width: 100%; }
  .friends-head > .row:last-child .btn { flex: 1; justify-content: center; }
  .gt-value { font-size: 32px; }
  .gt-row { font-size: 13.5px; }
  .board-row { min-height: 56px; }
  .members { grid-template-columns: 1fr; gap: 12px; }
  .race-legend { gap: 8px 12px; }
  .react { padding: 5px 10px; font-size: 15px; min-height: 34px; }
  .feed { max-height: none; }
  .duel-top { grid-template-columns: 1fr auto 1fr; gap: 6px; }
  .duel-side { padding: 10px 6px; }
  .duel-side .money { font-size: 16px !important; }
  .duel-score { font-size: 26px; padding: 0 2px; }
  .duel-table { font-size: 12px; }
  .admin-box { flex-direction: column; align-items: stretch; }
  .admin-box .btn { width: 100%; justify-content: center; }
  .phone-qr { grid-template-columns: 1fr; justify-items: center; }

  /* Objectifs, succès, projection, réglages */
  .badges { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .badge { padding: 14px 8px; }
  .lvl { width: 92px; }
  .proj-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 9px 5px; }
  .empty { padding: 30px 8px; }
  .empty .big { font-size: 52px; }
  .ex-input { font-size: 30px !important; }
}

/* Corrections téléphone (tour 2) */
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero > *, .level-box, .hero-actions .btn { min-width: 0; }
  .hero-actions .btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
  .ticker { overflow-wrap: anywhere; }
  .line > b.money { display: block; }
  .line > span.money { display: none; }
  /* Notifications en haut, sous la barre d'état : jamais sur les onglets ni sur les feuilles */
  .toasts { top: calc(env(safe-area-inset-top) + 8px); bottom: auto; z-index: 95; }
  @keyframes toastIn { from { transform: translateY(-130%); opacity: 0; } }
  .feed-item { padding: 10px 2px; }
  .feed-emo { font-size: 20px; width: 26px; }
  .feed-meta { margin-top: 6px; }
  .reacts { width: 100%; justify-content: space-between; }
  .react { flex: 1; padding: 4px 0; font-size: 15px; text-align: center; }
}
.feed-more { width: 100%; margin-top: 8px; justify-content: center; }

/* Fil : format messagerie sur téléphone */
.react-add { display: none; }
@media (max-width: 860px) {
  .reacts { width: auto; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .react { flex: none; padding: 3px 10px; min-height: 32px; }
  .feed-item:not(.open) .react:not(.has):not(.on):not(.react-add) { display: none; }
  .react-add { display: inline-flex; align-items: center; gap: 1px; opacity: .8; }
  .react-add small { font-size: 11px; font-weight: 700; }
  .feed-item.open .react-add { display: none; }
  .feed-meta { flex-wrap: nowrap; }
  .modal .donut-wrap { grid-template-columns: 1fr; }
  .modal .donut-wrap svg { max-width: 170px !important; }
  input[type=range] { accent-color: var(--accent); height: 28px; }
  .goals-head { flex-direction: column; align-items: stretch !important; }
}

.view.no-anim > * { animation: none; }


/* Version téléphone : récupérer son patrimoine en premier */
.restore-first { text-align: center; background: radial-gradient(120% 140% at 50% 0%, rgba(124, 92, 255, .28), transparent 65%), var(--surface); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.restore-first .big { font-size: 46px; }
.restore-first h2 { margin: 6px 0 6px; }
.restore-first p { color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.steps-mini { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 12px; text-align: left; background: var(--surface2); border-radius: 12px; padding: 10px 12px; }

/* Installation sur l'écran d'accueil */
.install-ask { text-align: center; padding: 4px 6px 0; }
.install-icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 10px 26px rgba(124, 92, 255, .4); }
.install-ask h2 { margin: 14px 0 8px; }
.install-ask p { line-height: 1.5; margin: 0; }
.ios-guide { position: fixed; inset: 0; z-index: 96; background: rgba(5, 7, 12, .55); display: flex; flex-direction: column; align-items: center; padding: 16px; animation: fade .2s; }
.ios-guide.bottom { justify-content: flex-end; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.ios-guide.top { justify-content: flex-start; align-items: flex-end; flex-direction: column-reverse; padding-top: calc(10px + env(safe-area-inset-top)); }
.ios-card { position: relative; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 18px 18px 14px; box-shadow: var(--shadow); }
.ios-card ol { margin: 10px 0 0; padding-left: 22px; line-height: 1.9; font-size: 15px; }
.ios-title { font-weight: 800; font-size: 17px; }
.ios-close { position: absolute; top: 10px; right: 10px; }
.ios-share { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface2); border: 1px solid var(--border); color: #3b82f6; font-weight: 800; }
.ios-arrow { font-size: 38px; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); animation: bob 1.1s ease-in-out infinite; margin: 6px 0; }
.ios-guide.top .ios-arrow { margin-right: 14px; }
@keyframes bob { 50% { transform: translateY(8px); } }
