:root {
  --bg: #070a0f;
  --bg-soft: #0e131b;
  --card: #121924;
  --card-2: #16202d;
  --line: #1f2b3a;
  --text: #eaf2ff;
  --muted: #8598ad;
  --call: #14e0a0;
  --call-soft: rgba(20, 224, 160, 0.12);
  --put: #ff5a72;
  --put-soft: rgba(255, 90, 114, 0.12);
  --wait: #f5b23d;
  --wait-soft: rgba(245, 178, 61, 0.12);
  --accent: #4c8dff;
  --radius: 18px;
  --tabbar: 74px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(76, 141, 255, 0.16), transparent 70%),
    var(--bg);
  overscroll-behavior-y: none;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(var(--tabbar) + 22px);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Barre supérieure ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 12px;
}

.brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }

.logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: #04121a;
  background: linear-gradient(145deg, #1ff0b6, #35b7ff);
  box-shadow: 0 8px 24px rgba(31, 240, 182, 0.24);
  flex: none;
}
.logo svg { width: 22px; height: 22px; }

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.icon-btn {
  width: 40px; height: 40px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:active { transform: scale(.94); background: var(--card-2); }
.icon-btn.spinning svg { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Ligne d'état ---------- */
.statusline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px 12px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--wait);
  box-shadow: 0 0 0 3px rgba(245, 178, 61, .15);
}
.dot.live { background: var(--call); box-shadow: 0 0 0 3px rgba(20, 224, 160, .16); animation: pulse 2.4s ease-out infinite; }
.dot.off { background: var(--put); box-shadow: 0 0 0 3px rgba(255, 90, 114, .16); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(20, 224, 160, .35); }
  70% { box-shadow: 0 0 0 8px rgba(20, 224, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(20, 224, 160, 0); }
}
.spacer { flex: 1; }
.clock { font-variant-numeric: tabular-nums; letter-spacing: .4px; }

/* ---------- Filtres ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all .18s ease;
}
.chip.active {
  color: #061019;
  background: linear-gradient(140deg, #1ff0b6, #66d0ff);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(31, 240, 182, .22);
}

/* ---------- Cartes ---------- */
.view { display: flex; flex-direction: column; gap: 12px; }

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted);
  margin: 6px 2px 0;
}

.hero {
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(150deg, rgba(20,224,160,.14), rgba(76,141,255,.10));
  border: 1px solid rgba(31, 240, 182, .28);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: auto -40px -60px auto;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(31,240,182,.22), transparent 65%);
}
.hero-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--call); font-weight: 700; }
.hero-market { font-size: 22px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -0.4px; }
.hero-sub { font-size: 12.5px; color: var(--muted); }
.hero-actions { display: flex; gap: 8px; margin-top: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color .18s ease, transform .12s ease;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--wait);
}
.card.call::before { background: var(--call); }
.card.put::before { background: var(--put); }
.card:active { transform: scale(.994); }

.card-top { display: flex; align-items: center; gap: 10px; }
.card-name { font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(76,141,255,.14);
  color: #8fb8ff;
  white-space: nowrap;
}
.badge.live { background: rgba(20,224,160,.13); color: var(--call); }
.badge.stale { background: rgba(245,178,61,.13); color: var(--wait); }
.card-price { margin-left: auto; text-align: right; }
.card-price b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.card-price small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-price small.up { color: var(--call); }
.card-price small.down { color: var(--put); }

.card-mid { display: flex; align-items: center; gap: 12px; }
.direction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .4px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--wait-soft);
  color: var(--wait);
}
.card.call .direction { background: var(--call-soft); color: var(--call); }
.card.put .direction { background: var(--put-soft); color: var(--put); }
.direction svg { width: 13px; height: 13px; }

.spark { flex: 1; height: 40px; min-width: 0; }
.spark path.line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { opacity: .16; }

.meta-row { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
.meta-row .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--line); }
.meta-row b { color: var(--text); font-weight: 600; }

.confbar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; }
.confbar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #35b7ff, #1ff0b6); }
.card.put .confbar span { background: linear-gradient(90deg, #ff8f6b, #ff5a72); }
.card.wait .confbar span { background: linear-gradient(90deg, #b98a2f, #f5b23d); }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 12px;
  line-height: 1.6;
}

.disclaimer {
  font-size: 11px;
  line-height: 1.55;
  color: #6d8095;
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-top: 6px;
}
.disclaimer b { color: #93a7bd; }

/* ---------- Vue marchés ---------- */
.mrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.mrow-name { font-size: 13.5px; font-weight: 600; }
.mrow-cls { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.mrow-right { margin-left: auto; text-align: right; }
.mrow-price { font-size: 13px; font-variant-numeric: tabular-nums; }
.mrow-chg { font-size: 11px; font-variant-numeric: tabular-nums; }
.mrow-chg.up { color: var(--call); }
.mrow-chg.down { color: var(--put); }
.pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--wait-soft);
  color: var(--wait);
  min-width: 52px;
  text-align: center;
}
.pill.call { background: var(--call-soft); color: var(--call); }
.pill.put { background: var(--put-soft); color: var(--put); }

/* ---------- Réglages ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.setting { display: flex; align-items: center; gap: 12px; }
.setting-text { flex: 1; }
.setting-text b { display: block; font-size: 13.5px; font-weight: 600; }
.setting-text small { color: var(--muted); font-size: 11.5px; }

.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0;
  background: #22303f;
  border-radius: 999px;
  transition: background .2s ease;
  pointer-events: none;
}
.switch span::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px; border-radius: 50%;
  background: #8fa3b8;
  transition: transform .2s ease, background .2s ease;
}
.switch input:checked + span { background: rgba(20,224,160,.35); }
.switch input:checked + span::after { transform: translateX(19px); background: var(--call); }

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 4px;
  background: linear-gradient(90deg, #1ff0b6, #35b7ff);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; margin-top: -7.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
input[type="range"]::-moz-range-track { height: 5px; background: #2a3a4c; border-radius: 4px; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: none; border-radius: 50%; background: #fff; }

.value-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--call);
  background: var(--call-soft);
  padding: 4px 9px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.btn {
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary {
  background: linear-gradient(140deg, #1ff0b6, #66d0ff);
  color: #061019;
  border: none;
}
.btn.ghost { background: transparent; }
a.btn { display: inline-block; text-align: center; text-decoration: none; line-height: 1.4; }
.btn:disabled, .switch input:disabled + span { opacity: .45; cursor: not-allowed; }

/* ---------- Alertes Telegram ---------- */
.hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(53, 183, 255, .06);
  border: 1px solid rgba(53, 183, 255, .18);
  border-radius: 12px;
  padding: 10px 12px;
}
.hint b { color: #cfe2f4; font-weight: 600; }

.code-line {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  line-height: 1.5;
  color: #9fd7ff;
  background: #0a1018;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  overflow-wrap: anywhere;
}

.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.money-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.money-cell small { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.money-cell b { font-size: 18px; font-variant-numeric: tabular-nums; }
.money-cell span { font-size: 10.5px; color: var(--muted); }
.money-up { color: var(--call); }
.money-down { color: var(--put); }
.money-wait { color: var(--wait); }
.money-last {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-size: 12px;
}
.money-last div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.money-last small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.money-last b { font-variant-numeric: tabular-nums; }
.money-last .arrow { color: var(--muted); }

.notice {
  font-size: 12px;
  line-height: 1.5;
  border-radius: 10px;
  padding: 9px 11px;
}
.notice.ok { color: var(--call); background: var(--call-soft); }
.notice.err { color: var(--put); background: var(--put-soft); }

.alert-log { display: flex; flex-direction: column; gap: 7px; }
.log-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.log-row span { color: var(--text); }
.log-row b { font-variant-numeric: tabular-nums; font-size: 11.5px; }
.log-row b.up { color: var(--call); }
.log-row b.down { color: var(--put); }
.log-row small { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(9, 13, 19, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: #6f8399;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 8px 0;
  cursor: pointer;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--call); }

/* ---------- Feuille de détail ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(3, 6, 10, .66);
  backdrop-filter: blur(3px);
  z-index: 40;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  max-height: 88vh;
  overflow-y: auto;
  background: #0d131c;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(26px + env(safe-area-inset-bottom));
  z-index: 50;
  animation: slideUp .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes slideUp { from { transform: translateY(28px); opacity: .4; } }

.grabber { width: 42px; height: 4px; border-radius: 4px; background: #2a3949; margin: 4px auto 16px; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.3px; }
.sheet .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; font-size: 12.5px; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; font-weight: 600; }

.reasons { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.reasons li {
  font-size: 12.5px;
  color: #b7c7d8;
  line-height: 1.45;
  padding-left: 18px;
  position: relative;
}
.reasons li::before {
  content: '';
  position: absolute; left: 0; top: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--call);
}

.sheet-block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }

@media (min-width: 620px) {
  .app { padding-top: 22px; }
  .tabbar { border-radius: 0 0 0 0; }
}

/* ---------------- Comptes ---------------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }
.user-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #e8edf5);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(64, 132, 255, 0.18), transparent 60%), #080b10;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.gate-card .logo.big { width: 64px; height: 64px; }
.gate-card h2 { margin: 0; font-size: 22px; }
.gate-text { margin: 0; font-size: 14px; opacity: 0.75; line-height: 1.5; }
.gate-card .btn { width: 100%; }
.gate-card .hint { font-size: 12px; opacity: 0.6; margin: 0; }
