:root{
  --bg: #05070a;
  --bg-accent: #0b1020;
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.66);
  --muted2: rgba(255,255,255,.5);
  --primary: #7c5cff;
  --primary-rgb: 124,92,255;
  --danger: #ff4d6d;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --border: rgba(255,255,255,.10);
  --border2: rgba(255,255,255,.14);
}
*{box-sizing:border-box}
html{
  background: var(--bg);
}
body{
  margin:0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 20% -10%, rgba(var(--primary-rgb), 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(47,232,155, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 50% 110%, rgba(255,77,109, 0.08) 0%, transparent 40%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 100%);
  background-attachment: fixed;
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--text);
}

.app{min-height:100%; display:flex; flex-direction:column}
.topbar{
  padding:18px 22px;
  display:flex;
  gap:18px;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:42px; height:42px; display:grid; place-items:center;
  border-radius:12px;
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(47,232,155,.70));
  box-shadow: 0 18px 40px rgba(124,92,255,.18);
  font-weight:800;
}
.title{font-weight:800}
.subtitle{color:var(--muted2); font-size:12px; margin-top:2px}

.hud{display:flex; gap:12px; align-items:stretch}
.hudItem{
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:14px;
  background: rgba(0,0,0,.16);
  min-width: 118px;
}
.hudLabel{font-size:11px; color:var(--muted2)}
.hudValue{font-size:16px; font-weight:800; margin-top:3px}
.topActions{display:flex; gap:10px; align-items:center}

.shell{
  width:min(1200px, calc(100% - 44px));
  margin: 20px auto 0;
  display:grid;
  grid-template-columns: 1fr;
  gap:16px;
}
@media (max-width: 1050px){
  .shell{width: calc(100% - 28px)}
  .topbar{flex-wrap:wrap}
  .hud{flex-wrap:wrap}
  .hudItem{min-width: 140px}
}

.card{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.cardPrimary{
  border-color: rgba(124,92,255,.26);
  background: linear-gradient(180deg, rgba(124,92,255,.16), rgba(255,255,255,.03));
}
.cardHeader{
  padding: 16px 16px 0;
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap:12px;
}
.cardHeader h2{margin:0; font-size: 15px}
.muted{color: var(--muted); font-size: 13px}
.muted.small{font-size:12px}
.chip{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.16);
  font-size:12px;
  color: var(--muted);
  cursor:pointer;
}
.quickActions{padding: 16px}
.divider{height:1px; background: var(--border); margin: 0 16px}
.twoCols{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  padding: 16px;
}
.stat{
  border:1px solid var(--border);
  background: rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 12px;
}
.statLabel{color: var(--muted2); font-size: 11px}
.statValue{font-weight:800; font-size: 14px; margin-top:6px}

.btn{
  border:1px solid var(--border2);
  background: rgba(0,0,0,.18);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight:700;
  transition: transform .06s ease, border-color .12s ease, background .12s ease;
}
.btn:hover{border-color: rgba(255,255,255,.22); background: rgba(0,0,0,.22)}
.btn:active{transform: translateY(1px)}
.btnPrimary{
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(124,92,255,.55));
  border-color: rgba(124,92,255,.5);
}
.btnSecondary{ background: rgba(255,255,255,.12); border-color: var(--border2); }
.btnSecondary:hover{ background: rgba(255,255,255,.18); }
.btnDanger{
  background: linear-gradient(135deg, rgba(255,77,109,.9), rgba(255,77,109,.55));
  border-color: rgba(255,77,109,.55);
}
.btnGhost{background: transparent}
.btnBig{width:100%; padding: 14px 14px; border-radius: 16px}

.tabs{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.10);
  flex-wrap: wrap;
}
.tab{
  border: 1px solid var(--border);
  background: rgba(0,0,0,.14);
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
}
.tab.isActive{
  color: var(--text);
  border-color: rgba(124,92,255,.48);
  background: linear-gradient(180deg, rgba(124,92,255,.22), rgba(0,0,0,.10));
}
.tabPanels{padding: 14px}
.tabPanel{display:none}
.tabPanel.isActive{display:block}

.panelHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.panelTitle{font-weight: 900}
.panelActions{display:flex; gap: 10px; align-items:center; flex-wrap:wrap}

.enterprisesLayout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
  padding-top: 12px;
}
@media (max-width: 1050px){
  .enterprisesLayout{grid-template-columns: 1fr}
}
.sideList{
  border:1px solid var(--border);
  background: rgba(0,0,0,.10);
  border-radius: 16px;
  overflow:hidden;
}
.sideItem{
  width: 100%;
  text-align:left;
  border:0;
  border-bottom:1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 12px;
  cursor:pointer;
}
.sideItem:hover{background: rgba(255,255,255,.04)}
.sideItem.isActive{background: rgba(124,92,255,.12)}
.sideItemTitle{font-weight: 900}
.sideItemSub{font-size: 12px; color: var(--muted); margin-top: 4px}
.sideItemMeta{display:flex; gap: 8px; flex-wrap:wrap; margin-top: 10px}
.badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border:1px solid var(--border);
  color: var(--muted);
  background: rgba(0,0,0,.14);
  white-space: nowrap;
}
.detail{
  border:1px solid var(--border);
  background: rgba(0,0,0,.10);
  border-radius: 16px;
  padding: 14px;
}
.detailHeader{display:flex; justify-content:space-between; gap: 12px}
.detailTitle{font-weight: 950; font-size: 16px}
.detailSub{color: var(--muted); font-size: 12px; margin-top: 6px}
.detailGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 1050px){.detailGrid{grid-template-columns: 1fr}}
.box{
  border:1px solid var(--border);
  background: rgba(0,0,0,.12);
  border-radius: 16px;
  padding: 12px;
}
.boxTitle{font-weight: 900}
.boxRow{display:flex; justify-content:space-between; gap: 10px; margin-top: 10px}
.kv{color: var(--muted); font-size: 12px}
.kv b{color: var(--text)}

.list{padding: 12px}
.row{
  display:grid;
  grid-template-columns: 1.4fr .95fr;
  gap: 10px;
  padding: 12px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.12);
  border-radius: 16px;
}
.row + .row{margin-top: 10px}
.rowTitle{display:flex; align-items:center; justify-content:space-between; gap:10px}
.rowName{font-weight:800}
.rowMeta{margin-top: 8px; display:flex; flex-wrap:wrap; gap: 8px; align-items:center}
.metaPill{
  font-size: 12px;
  color: var(--muted);
  border:1px solid var(--border);
  background: rgba(0,0,0,.08);
  border-radius: 999px;
  padding: 6px 10px;
}
.rowActions{display:flex; flex-direction:column; gap: 8px; justify-content:center}
.rowActions .btn{width:100%}

/* --- Bourse type Boursorama --- */
.chartHeader{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.12);
  margin-bottom: 12px;
}
.chartHeaderLeft{ display: flex; flex-direction: column; gap: 4px; }
.chartSymbol{ font-weight: 800; font-size: 15px; }
.chartPrice{ font-size: 14px; display: flex; align-items: center; gap: 10px; }
.chartPriceValue{ font-weight: 800; }
.chartTimeframes{ display: flex; gap: 6px; flex-wrap: wrap; }
.chartTfBtn{ padding: 6px 10px; font-size: 12px; }
.chartTfBtn.isActive{
  background: rgba(124,92,255,.25);
  border-color: rgba(124,92,255,.5);
  color: var(--text);
}
.chartWrap{
  position: relative;
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.10);
  overflow: hidden;
  margin-bottom: 12px;
}
.chartCanvas{
  display: block;
  width: 100%;
  height: 320px;
}
.chartOverlay{
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  background: rgba(0,0,0,.25);
  border-radius: 14px;
  pointer-events: none;
}
.orderBox{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.10);
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.orderHeader{ flex: 1; min-width: 160px; }
.orderName{ font-weight: 900; font-size: 15px; margin-bottom: 4px; }
.orderPrice{ font-size: 14px; color: var(--muted); }
.orderPrice b{ color: var(--text); }
.orderOwned{ margin-top: 4px; }
.orderForm{ display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.orderQtyWrap, .orderTotalWrap{ display: flex; flex-direction: column; gap: 4px; }
.orderLabel{ font-size: 11px; }
.orderQtyInput{ width: 80px; text-align: center; font-weight: 800; font-size: 15px; }
.orderTotalValue{ font-weight: 800; font-size: 15px; padding: 8px 0; }
.orderBtns{ display: flex; gap: 10px; }
.orderBuyBtn{
  background: linear-gradient(135deg, rgba(0,200,83,.85), rgba(0,200,83,.55));
  border-color: rgba(0,200,83,.5);
  color: #fff;
  font-size: 15px;
  padding: 12px 22px;
}
.orderBuyBtn:hover:not(:disabled){ background: linear-gradient(135deg, rgba(0,200,83,.95), rgba(0,200,83,.7)); }
.orderSellBtn{
  background: linear-gradient(135deg, rgba(244,67,54,.85), rgba(244,67,54,.55));
  border-color: rgba(244,67,54,.5);
  color: #fff;
  font-size: 15px;
  padding: 12px 22px;
}
.orderSellBtn:hover:not(:disabled){ background: linear-gradient(135deg, rgba(244,67,54,.95), rgba(244,67,54,.7)); }
.orderBuyBtn:disabled, .orderSellBtn:disabled{ opacity: .4; cursor: not-allowed; }
.stockSearch{ margin-bottom: 12px; position: relative; }
.stockSearchInput{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.stockSearchInput:focus{ border-color: rgba(124,92,255,.5); }
.stockSearchResults{
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15,20,40,.98);
  z-index: 20;
}
.stockSearchItem{
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.stockSearchItem:hover{ background: rgba(124,92,255,.15); }
.stockSearchItem:last-child{ border-bottom: 0; }
.portfolio{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.10);
  overflow: hidden;
  margin-top: 12px;
}
.portfolioHeader{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.portfolioTitle{ font-weight: 900; }
.portfolioTotalLine{ font-size: 13px; color: var(--muted); }
.portfolioCols{
  display: grid;
  grid-template-columns: 1.6fr .6fr .8fr .8fr .8fr 1.2fr;
  gap: 6px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--muted2);
  border-bottom: 1px solid var(--border);
}
.portfolioBody{ padding: 0; }
.portfolioRow{
  display: grid;
  grid-template-columns: 1.6fr .6fr .8fr .8fr .8fr 1.2fr;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s ease;
}
.portfolioRow:last-child{ border-bottom: 0; }
.portfolioRow:hover{ background: rgba(255,255,255,.05); }
.portfolioRowSelected{ background: rgba(124,92,255,.12); border-left: 3px solid rgba(124,92,255,.6); }
.portfolioAssetName{ font-weight: 700; }
.portfolioEmpty{ padding: 18px 14px; }
.badgeLive{ background: rgba(47,232,155,.2); color: rgba(47,232,155,.95); }
.stocksLayout{ display: flex; flex-direction: column; }
.chartAssetList .row{ margin-top: 8px; }

.chartAssetRow{
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chartAssetRow:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18);
}
.chartAssetRowSelected{
  border-color: rgba(124,92,255,.5);
  background: rgba(124,92,255,.12);
}
.chartAssetRowSelected:hover{
  background: rgba(124,92,255,.16);
}
.chartAssetRowHint{
  margin-top: 6px;
  font-size: 11px;
  opacity: .8;
}
.chartAssetRowLeft{ flex: 1; }

.spark{
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.10);
}
.sparkBig{
  width: 100%;
  height: 160px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.10);
}

.historyList{
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.12);
  overflow: hidden;
}
.historyHeader{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display:flex;
  justify-content:space-between;
  gap:10px;
  color: var(--muted);
  font-size: 12px;
}
.historyRow{
  padding: 10px 12px;
  display:flex;
  justify-content:space-between;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.historyRow:last-child{border-bottom:0}
.pos{color: rgba(47,232,155,.95)}
.neg{color: rgba(255,77,109,.95)}

.log{
  padding: 0 16px 16px;
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height: 260px;
  overflow:auto;
}
.logItem{
  font-size: 12px;
  color: var(--muted);
  border:1px solid var(--border);
  background: rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 10px;
}
.logItem b{color: var(--text)}

.footer{
  width:min(1200px, calc(100% - 44px));
  margin: 14px auto 18px;
  display:flex;
  justify-content:space-between;
  gap: 12px;
  padding: 0 2px;
}
.modal{
  width: min(760px, calc(100% - 24px));
  border:1px solid var(--border);
  border-radius: 18px;
  background: rgba(15,20,40,.96);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}
.modal::backdrop{background: rgba(0,0,0,.60)}
.modalHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 14px 0;
  gap: 12px;
}
.modalTitle{font-weight:900}
.modalBody{padding: 14px; color: var(--muted); font-size: 13px; line-height: 1.5}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  border:1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  padding: 12px;
  color: rgba(255,255,255,.82);
}
.input{
  width: 140px;
  padding: 10px 10px;
  border-radius: 14px;
  border:1px solid var(--border2);
  background: rgba(0,0,0,.18);
  color: var(--text);
  outline:none;
}
.input:focus{border-color: rgba(124,92,255,.55)}

/* Leaderboard */
.leaderboardPlaceholder{ padding: 20px; text-align: center; }
.leaderboardPlaceholder .small{ font-size: 12px; margin-top: 8px; }
.leaderboardPlaceholder code{ font-size: 11px; }
.leaderboardHeader{ display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.leaderboardHeader h3{ margin: 0; font-size: 16px; }
.leaderboardActions{ display: flex; gap: 8px; align-items: center; }
.leaderboardInput{ width: 140px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border2); background: rgba(0,0,0,.2); color: var(--text); font-size: 13px; }
.leaderboardList{ list-style: none; margin: 0; padding: 0; }
.leaderboardRow{ display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; background: rgba(0,0,0,.12); }
.leaderboardRow.isMe{ background: rgba(124,92,255,.15); border: 1px solid rgba(124,92,255,.35); }
.leaderboardRank{ font-weight: 700; color: var(--muted2); font-size: 13px; }
.leaderboardName{ font-weight: 600; }
.leaderboardWorth{ font-weight: 800; color: rgba(47,232,155,.95); }

/* Auth */
.authBox{ max-width: 360px; margin: 24px auto; padding: 24px; border: 1px solid var(--border2); border-radius: 16px; background: rgba(0,0,0,.2); }
.authTitle{ margin: 0 0 20px; font-size: 18px; font-weight: 700; text-align: center; }
.authWarning{ margin: 0 0 16px; padding: 10px; background: rgba(255,77,109,.15); border-radius: 10px; }
.authTabs{ display: flex; gap: 0; margin-bottom: 16px; }
.authTab{ flex: 1; padding: 10px; border: none; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; border-radius: 8px; }
.authTab.isActive{ background: rgba(124,92,255,.2); color: var(--text); font-weight: 600; }
.authForm{ display: flex; flex-direction: column; gap: 12px; }
.authInput{ width: 100%; box-sizing: border-box; }
.authButtons{ display: flex; flex-direction: column; gap: 8px; }
.authError{ margin: 0; color: var(--danger); min-height: 1.2em; }

/* Auth Gate (connexion obligatoire) */
.authGateOverlay{ position: fixed; inset: 0; z-index: 1000; background: rgba(11,16,32,.95); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .25s; }
.authGateOverlay.isVisible{ opacity: 1; pointer-events: auto; }
.authGateContent{ text-align: center; padding: 24px; max-width: 400px; }
.authGateTitle{ margin: 0 0 8px; font-size: 28px; font-weight: 800; }
.authGateSubtitle{ margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.authGateBox{ margin: 0 auto; }

/* Loader */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
