/* Patrimoine - mobile first, thème sombre */
:root {
  --bg: #0E1526;
  --card: #1A2338;
  --card-2: #212C46;
  --text: #E8ECF4;
  --muted: #8B96AD;
  --accent: #5B8DEF;
  --up: #3DDC97;
  --down: #FF6B6B;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: 70px; /* place pour la tabbar */
}
.wrap { max-width: 560px; margin: 0 auto; padding: 12px 14px; }

/* Barre du haut */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.brand { font-weight: 700; letter-spacing: 0.02em; }
.link { color: var(--muted); text-decoration: none; font-size: 14px; }

/* Carte patrimoine (signature du dashboard) */
.hero {
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border-radius: var(--radius);
  padding: 22px 18px;
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.hero-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-value { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-gains { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Cartes */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.06em; }

/* Répartition */
.repart-row { display: flex; justify-content: space-between; font-size: 14px; margin-top: 8px; }
.bar { background: var(--bg); border-radius: 6px; height: 6px; margin-top: 4px; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; border-radius: 6px; }

/* Positions et lignes de liste */
.pos { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.pos:last-child { border-bottom: none; }
.pos-head { display: flex; justify-content: space-between; gap: 10px; }
.pos-name { font-weight: 600; }
.pos-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-detail { display: flex; justify-content: space-between; margin-top: 2px; align-items: center; }

/* Formulaires */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, select {
  width: 100%; padding: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid rgba(255,255,255,0.10); border-radius: 10px;
  font-size: 16px; /* évite le zoom iOS */
}
input:focus, select:focus, button:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button[type=submit] {
  width: 100%; margin-top: 16px; padding: 13px;
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-link { background: none; border: none; color: var(--down); font-size: 13px; cursor: pointer; padding: 4px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Messages */
.ok { color: var(--up); margin-bottom: 10px; }
.error { color: var(--down); margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Pages d'authentification */
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 28px 22px; width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.code-input { text-align: center; font-size: 24px; letter-spacing: 0.4em; }
.qr { display: flex; justify-content: center; margin: 16px 0; background: #fff; border-radius: 10px; padding: 10px; }
.qr img, .qr canvas { display: block; }
code { word-break: break-all; }

/* Barre d'onglets bas d'écran */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--card);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 14px 0;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
}
.tabbar a.active { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
