:root{
  --bg:#0b0e14;
  --panel:#12161f;
  --panel-2:#171c27;
  --border:#232936;
  --text:#eef1f6;
  --text-dim:#8891a3;
  --text-faint:#5b6376;
  --up:#2ed573;
  --down:#ff5c5c;
  --accent:#7c5cff;
  --accent-2:#3fa9ff;
  --tesla-red:#e31937;
  --radius:16px;
}
*{box-sizing:border-box;margin:0;padding:0;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:'Inter','Segoe UI',system-ui,-apple-system,sans-serif;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;text-decoration:none;}

.app{
  display:grid;
  grid-template-columns:76px 1fr;
  min-height:100vh;
}
.app--no-sidebar{
  grid-template-columns:1fr;
}

/* Sidebar */
.sidebar{
  background:var(--panel);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:22px 0;
  gap:28px;
}
.logo{
  width:38px;height:38px;border-radius:11px;
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:15px;color:#fff;
}
.nav{display:flex;flex-direction:column;gap:6px;flex:1;align-items:center;margin-top:12px;}
.nav-item{
  width:44px;height:44px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  color:var(--text-faint);cursor:pointer;
  transition:background .15s, color .15s;
}
.nav-item svg{width:20px;height:20px;}
.nav-item.active{background:rgba(124,92,255,.14);color:var(--accent);}
.nav-item:hover{background:var(--panel-2);color:var(--text);}
.avatar{
  width:38px;height:38px;border-radius:50%;
  background:linear-gradient(135deg,#3a3f52,#20242f);
  border:1px solid var(--border);
}

/* Main */
.main{padding:26px 32px 40px;max-width:1500px;}

.page-header{max-width:520px;margin:0 auto 14px;}
.page-header h1{font-size:26px;font-weight:800;letter-spacing:-.4px;}
.page-header p{color:var(--text-dim);font-size:14px;margin-top:14px;}

.intro-note{
  max-width:520px;
  margin:0 auto 24px;
}
.intro-note p{
  color:#f1edfc;
  font-size:14px;
  line-height:1.6;
}

.topbar{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:26px;flex-wrap:wrap;gap:16px;
}
.topbar h1{font-size:22px;font-weight:700;letter-spacing:-.3px;}
.topbar .sub{color:var(--text-dim);font-size:13px;margin-top:4px;}
.top-actions{display:flex;align-items:center;gap:12px;}
.search{
  background:var(--panel);border:1px solid var(--border);
  border-radius:10px;padding:9px 14px;color:var(--text-dim);
  font-size:13px;width:220px;display:flex;align-items:center;gap:8px;
}
.btn{
  background:var(--panel);border:1px solid var(--border);
  color:var(--text);padding:9px 16px;border-radius:10px;
  font-size:13px;font-weight:600;cursor:pointer;
}
.btn.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  border:none;color:#fff;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px 22px;
}
.card-label{
  font-size:12px;color:var(--text-dim);
  font-weight:600;text-transform:uppercase;letter-spacing:.6px;
  margin-bottom:10px;
}

/* Hero ticker card */
.hero{
  display:flex;align-items:center;justify-content:space-between;
  padding:26px 28px;margin-bottom:20px;flex-wrap:wrap;gap:20px;
}
.hero-left{display:flex;align-items:center;gap:18px;}
.ticker-badge{
  width:58px;height:58px;border-radius:14px;
  background:#1a1d24;border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:13px;color:var(--tesla-red);
  letter-spacing:.5px;
}
.ticker-info .name-row{display:flex;align-items:center;gap:10px;}
.ticker-info h2{font-size:20px;font-weight:700;}
.exch-tag{
  font-size:11px;color:var(--text-dim);
  background:var(--panel-2);border:1px solid var(--border);
  padding:2px 8px;border-radius:6px;font-weight:600;
}
.ticker-info .company{color:var(--text-dim);font-size:13px;margin-top:3px;}

.hero-price{text-align:right;}
.hero-price .price{font-size:36px;font-weight:800;letter-spacing:-.5px;}
.hero-price .change{
  font-size:14px;font-weight:700;margin-top:6px;
  display:flex;align-items:center;justify-content:flex-end;gap:6px;
}
.change.up{color:var(--up);}
.change.down{color:var(--down);}
.hero-price .asof{color:var(--text-faint);font-size:11.5px;margin-top:6px;}

.hero-range{
  display:flex;flex-direction:column;gap:8px;min-width:180px;
}
.range-row{display:flex;justify-content:space-between;font-size:11.5px;color:var(--text-dim);}
.range-bar{
  height:6px;border-radius:4px;background:var(--panel-2);
  position:relative;overflow:hidden;
}
.range-bar .fill{
  position:absolute;top:0;bottom:0;left:0;
  background:linear-gradient(90deg,var(--down),var(--accent-2),var(--up));
  width:100%;opacity:.35;
}
.range-bar .dot{
  position:absolute;top:50%;width:10px;height:10px;border-radius:50%;
  background:#fff;transform:translate(-50%,-50%);
  box-shadow:0 0 0 3px rgba(255,255,255,.15);
}

/* Metrics grid — one metric after another, top to bottom, on every
   screen size. Cards are capped to a fixed width instead of stretching
   to fill the page, so there's no wasted blank space inside a card;
   any leftover horizontal space just sits empty to the right. */
.metrics-grid{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
  margin-bottom:20px;
}

/* Each stat-col stacks a value card on top of its description card. */
.stat-col{
  display:flex;
  flex-direction:column;
  gap:16px;
  width:100%;
  max-width:520px;
}
.desc-card{
  padding:18px 20px;
  background:rgba(124,92,255,.08);
  border-color:rgba(124,92,255,.28);
}
.desc-card p{
  font-size:13px;
  color:var(--text-dim);
  line-height:1.55;
}

.stat-card{min-height:118px;}
.stat-card .val{font-size:20px;font-weight:700;letter-spacing:-.2px;}

.info-tip{
  position:relative;
  display:inline-block;
}
.tip-bubble{
  position:absolute;
  top:130%;
  left:0;
  width:220px;
  max-width:70vw;
  background:#1c2230;
  color:var(--text);
  font-size:11.5px;
  font-weight:400;
  line-height:1.45;
  text-transform:none;
  letter-spacing:normal;
  padding:10px 12px;
  border-radius:8px;
  border:1px solid var(--border);
  box-shadow:0 8px 24px rgba(0,0,0,.4);
  opacity:0;
  visibility:hidden;
  transition:opacity .15s ease;
  z-index:20;
  pointer-events:none;
}
.info-tip.flip .tip-bubble{
  left:auto;
  right:0;
}
.info-tip::before{
  content:"";
  position:absolute;
  top:118%;
  left:10px;
  border:6px solid transparent;
  border-bottom-color:#1c2230;
  opacity:0;
  visibility:hidden;
  transition:opacity .15s ease;
  z-index:20;
}
.info-tip.flip::before{
  left:auto;
  right:10px;
}
.stat-card:hover .tip-bubble,.stat-card:hover .info-tip::before,
.stat-card.show-tip .tip-bubble,.stat-card.show-tip .info-tip::before{
  opacity:1;
  visibility:visible;
}
.ticker-row{display:flex;align-items:center;gap:10px;}
.tesla-logo{width:24px;height:24px;color:var(--tesla-red);flex-shrink:0;}
.stat-card .delta{font-size:12px;font-weight:600;margin-top:6px;}
.stat-card .delta.up{color:var(--up);}
.stat-card .delta.down{color:var(--down);}
.stat-card .delta.neutral{color:var(--text-faint);}

/* Content grid */
.content-grid{
  display:grid;grid-template-columns:2fr 1fr;
  gap:20px;margin-bottom:20px;
}

.chart-card .chart-head{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:18px;flex-wrap:wrap;gap:12px;
}
.chart-head .price-mini{font-size:26px;font-weight:800;}
.chart-head .price-mini .chg{font-size:13px;font-weight:700;margin-left:8px;}
.range-tabs{display:flex;gap:4px;background:var(--panel-2);padding:4px;border-radius:10px;}
.range-tabs span{
  padding:6px 12px;font-size:12px;font-weight:600;color:var(--text-dim);
  border-radius:7px;cursor:pointer;
}
.range-tabs span.active{background:var(--accent);color:#fff;}
.chart-wrap{height:280px;}

.side-stack{display:flex;flex-direction:column;gap:20px;}

.kv-list{display:flex;flex-direction:column;gap:0;}
.kv-row{
  display:flex;justify-content:space-between;align-items:center;
  padding:11px 0;border-bottom:1px solid var(--border);
  font-size:13px;
}
.kv-row:last-child{border-bottom:none;}
.kv-row .k{color:var(--text-dim);}
.kv-row .v{font-weight:700;}

.rating-card .gauge-wrap{display:flex;flex-direction:column;align-items:center;gap:10px;}
.rating-card .verdict{font-size:18px;font-weight:800;color:var(--up);}
.rating-card .analysts{font-size:12px;color:var(--text-dim);text-align:center;}
.rating-bar{
  width:100%;height:10px;border-radius:6px;
  background:linear-gradient(90deg,var(--down) 0%, #ffb454 35%, var(--up) 100%);
  position:relative;margin-top:8px;
}
.rating-bar .marker{
  position:absolute;top:-4px;width:3px;height:18px;background:#fff;border-radius:2px;
}
.rating-labels{display:flex;justify-content:space-between;width:100%;font-size:10.5px;color:var(--text-faint);margin-top:4px;}

.bottom-grid{
  display:grid;grid-template-columns:1.3fr 1fr;gap:20px;
}

.news-item{
  display:flex;gap:12px;padding:13px 0;border-bottom:1px solid var(--border);
}
.news-item:last-child{border-bottom:none;}
.news-thumb{
  width:52px;height:52px;border-radius:10px;flex-shrink:0;
  background:linear-gradient(135deg,#20242f,#171a22);
  border:1px solid var(--border);
}
.news-item .headline{font-size:13.5px;font-weight:600;line-height:1.4;}
.news-item .meta{font-size:11.5px;color:var(--text-faint);margin-top:5px;}

.watch-row{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 0;border-bottom:1px solid var(--border);
}
.watch-row:last-child{border-bottom:none;}
.watch-left{display:flex;align-items:center;gap:12px;}
.watch-badge{
  width:36px;height:36px;border-radius:9px;background:var(--panel-2);
  border:1px solid var(--border);display:flex;align-items:center;justify-content:center;
  font-size:10.5px;font-weight:800;color:var(--text-dim);
}
.watch-name{font-size:13px;font-weight:700;}
.watch-sub{font-size:11.5px;color:var(--text-faint);}
.watch-right{text-align:right;}
.watch-price{font-size:13.5px;font-weight:700;}
.watch-chg{font-size:11.5px;font-weight:700;margin-top:2px;}

.disclaimer{
  margin-top:22px;font-size:11.5px;color:var(--text-faint);
  text-align:center;
}

@media (max-width:1100px){
  .content-grid,.bottom-grid{grid-template-columns:1fr;}
}

