/* ==========================================================================
   Bot Signal89 - Feuille de style de l'application
   Mobile-first. Toutes les grilles passent a 1 colonne sous 768px.
   ========================================================================== */

:root {
  --brand: #00c2ff;
  --brand-strong: #0090d6;
  --brand-soft: rgba(0, 194, 255, 0.14);
  --bg: #070c16;
  --bg-2: #0d1424;
  --surface: #131c2e;
  --surface-2: #1a2439;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eff8;
  --text-soft: #9fb0c6;
  --text-dim: #6d7f97;
  --up: #17c98a;
  --down: #f0576b;
  --warn: #f5b942;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
  --nav-h: 68px;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(0, 194, 255, 0.12), transparent 60%),
    radial-gradient(900px 460px at 92% 4%, rgba(23, 201, 138, 0.09), transparent 62%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Ecran d'ouverture (PWA installable) ---------- */
#app-splash {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #070c16;
}
#app-splash.show { display: flex; animation: splashOut .4s ease 1.2s forwards; }
#app-splash img { width: 96px; height: 96px; }
#app-splash .splash-name { font-size: 20px; font-weight: 700; letter-spacing: .4px; color: #e9eff8; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }

/* ---------- Mise en page ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
  padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom, 0px));
}
.container.narrow { max-width: 560px; }
.page { padding-top: 18px; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 900;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(7, 12, 22, 0.84);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(140deg, var(--brand), #0a63c9);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 194, 255, .32);
}
.brand-logo svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--brand), #0a7fd0); color: #04121c; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border-color: rgba(0, 194, 255, .28); }
.btn-danger { background: rgba(240, 87, 107, .14); color: var(--down); border-color: rgba(240, 87, 107, .3); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.btn-icon svg { width: 18px; height: 18px; }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-tight { padding: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 700; letter-spacing: .2px; margin: 0; }
.card-sub { font-size: 12px; color: var(--text-dim); margin: 2px 0 0; }

.section-title {
  font-size: 17px; font-weight: 700; margin: 26px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .muted { font-size: 12px; font-weight: 500; }

/* ---------- Grilles ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid-2, .grid-3, .grid-4 { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* ---------- Statistiques ---------- */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12px; color: var(--text-dim); }

.stats-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stats-strip .card { padding: 14px; margin: 0; }
.stats-strip .stat-value { font-size: 18px; }
.stats-strip .stat-label { font-size: 11px; }
.stats-strip .stat-hint { font-size: 11.5px; }

/* ---------- Tickers / lignes d'actifs ---------- */
.tickers { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.tickers::-webkit-scrollbar { display: none; }
.ticker {
  flex: 0 0 auto; min-width: 132px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px;
  transition: transform .12s ease;
}
.ticker:active { transform: scale(.97); }
.ticker-sym { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.ticker-price { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticker-chg { font-size: 12px; font-weight: 600; }

.asset-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border-bottom: 1px solid var(--line);
}
.asset-row:last-child { border-bottom: none; }
.asset-row .btn-icon { width: 34px; height: 34px; flex: 0 0 auto; }
.asset-main { flex: 1 1 auto; min-width: 0; }
.asset-sym { font-weight: 700; font-size: 15px; }
.asset-name { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-price { text-align: right; font-variant-numeric: tabular-nums; }
.asset-price .p { font-weight: 700; font-size: 15px; }
.asset-price .c { font-size: 12px; font-weight: 600; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

/* ---------- Couleurs marche ---------- */
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-soft); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
}
.badge-acheter { background: rgba(23, 201, 138, .16); color: var(--up); }
.badge-vendre { background: rgba(240, 87, 107, .16); color: var(--down); }
.badge-neutre { background: rgba(159, 176, 198, .16); color: var(--text-soft); }
.badge-soft { background: var(--surface-2); color: var(--text-soft); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background .18s ease, color .18s ease;
}
.chip:active { transform: scale(.97); }
.chip.active { background: var(--brand-soft); border-color: rgba(0, 194, 255, .35); color: var(--brand); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

/* ---------- Barre de confiance ---------- */
.meter { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--up)); }
.meter.bear > span { background: linear-gradient(90deg, var(--warn), var(--down)); }

/* ---------- Signal ---------- */
.signal-card { display: flex; flex-direction: column; gap: 12px; }
.signal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.signal-meta { display: flex; flex-wrap: wrap; gap: 14px; }
.signal-meta .kv { font-size: 12px; }
.signal-meta .kv b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.signal-note { font-size: 13px; color: var(--text-soft); line-height: 1.55; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .6px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-soft); }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: border-color .18s ease, box-shadow .18s ease;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 194, 255, .16); }
.input::placeholder { color: var(--text-dim); }
.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.form-error { background: rgba(240, 87, 107, .12); border: 1px solid rgba(240, 87, 107, .3); color: #ffb3bd; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }

/* ---------- Hero accueil ---------- */
.hero { padding: 26px 0 6px; }
.hero h1 { font-size: 30px; line-height: 1.15; margin: 12px 0 10px; letter-spacing: -.4px; }
.hero p.lead { color: var(--text-soft); font-size: 15px; margin: 0 0 18px; max-width: 620px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 6px 12px; border-radius: 999px; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 rgba(23, 201, 138, .6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(23, 201, 138, .55); } 70% { box-shadow: 0 0 0 9px rgba(23, 201, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(23, 201, 138, 0); } }

.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.feature-ico svg { width: 20px; height: 20px; }
.feature h3 { margin: 0 0 3px; font-size: 15px; }
.feature p { margin: 0; font-size: 13px; color: var(--text-soft); }

/* ---------- Barre de navigation basse ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 950;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(13, 20, 36, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 7px 2px; border-radius: 14px;
  color: var(--text-dim); font-size: 10.5px; font-weight: 600;
  transition: transform .12s ease, color .18s ease, background .18s ease;
  max-width: 110px;
}
.bottom-nav a:active { transform: scale(.94); }
.bottom-nav a svg { width: 21px; height: 21px; }
.bottom-nav a.active { color: var(--brand); background: var(--brand-soft); }
.bottom-nav a.active svg { color: var(--brand); }

/* ---------- Notifications ---------- */
.toast-host { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); z-index: 9999; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  background: rgba(19, 28, 46, .97); border: 1px solid var(--line-strong);
  color: var(--text); padding: 12px 14px; border-radius: 14px; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: toastIn .22s ease;
}
.toast.ok { border-color: rgba(23, 201, 138, .4); }
.toast.err { border-color: rgba(240, 87, 107, .45); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Etats vides / chargement ---------- */
.empty { text-align: center; padding: 30px 18px; color: var(--text-dim); }
.empty svg { width: 34px; height: 34px; opacity: .5; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.11), rgba(255,255,255,.05)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 10px; height: 14px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Graphiques ---------- */
.chart-box { position: relative; height: 240px; width: 100%; }
.chart-box.sm { height: 190px; }

/* ---------- Modale ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9800;
  background: rgba(4, 8, 16, .7);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 22px 22px 0 0; width: 100%; max-width: 520px;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: 88vh; overflow-y: auto;
  animation: sheetUp .24s ease;
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.modal-sub { font-size: 13px; color: var(--text-soft); margin: 0 0 16px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- Pied de page ---------- */
.site-footer {
  margin-top: 34px; padding: 22px 0 8px;
  border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: 12.5px;
}
.site-footer .links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.site-footer a { color: var(--text-soft); }
.disclaimer { font-size: 11.5px; line-height: 1.6; color: var(--text-dim); margin-top: 10px; }

.legal { line-height: 1.7; color: var(--text-soft); font-size: 14px; }
.legal h2 { color: var(--text); font-size: 17px; margin: 24px 0 8px; }
.legal p, .legal li { margin: 0 0 10px; }

.muted { color: var(--text-dim); }
.soft { color: var(--text-soft); }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.right { text-align: right; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; }

/* ---------- Administration ---------- */
.admin-lock { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.admin-shell { padding-bottom: calc(var(--nav-h) + 32px + env(safe-area-inset-bottom, 0px)); }
.admin-badge { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--warn); background: rgba(245, 185, 66, .14); padding: 4px 10px; border-radius: 999px; }

/* ==========================================================================
   Tablette et ordinateur
   ========================================================================== */
@media (min-width: 768px) {
  body { font-size: 15.5px; }
  .container { padding: 0 24px; padding-bottom: 40px; }
  .page { padding-top: 26px; }
  .hero { padding: 46px 0 10px; }
  .hero h1 { font-size: 40px; }

  .grid { gap: 16px; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-strip .stat-value { font-size: 22px; }
  .stats-strip .stat-label { font-size: 12px; }
  .stats-strip .stat-hint { font-size: 12px; }
  .asset-row .btn-icon { width: 40px; height: 40px; }
  .card { padding: 22px; }

  /* Sur grand ecran la barre de navigation remonte sous l'en-tete */
  .bottom-nav {
    position: static;
    border-top: 1px solid var(--line);
    padding: 4px 24px 6px;
    gap: 6px;
    justify-content: center;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .bottom-nav a {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
    font-size: 13.5px;
    padding: 9px 16px;
    max-width: none;
  }
  .toast-host { bottom: 24px; }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 22px; max-height: 84vh; }
}

@media (min-width: 1024px) {
  .grid.sidebar-2 { grid-template-columns: 1.6fr 1fr; }
}
