:root {
  --bg: #0b1220;
  --bg-elevated: #111827;
  --card: #151d2e;
  --card-border: #243044;
  --sidebar: linear-gradient(180deg, #0f1b33 0%, #0a1324 100%);
  --text: #e8eef9;
  --muted: #93a0b8;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --radius: 12px;
  --sidebar-w: 240px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.app-shell { display: flex; width: 100%; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--card-border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex-shrink: 0;
  align-self: stretch;
  height: auto;
  max-height: none;
  overflow: visible;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;  
}
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
}
.sidebar-avatar {
  width: 44px; height: 44px; border-radius: 999px; object-fit: cover;
  border: 2px solid rgba(255,255,255,0.15); background: #1f2937; flex-shrink: 0;
}
.sidebar-avatar.placeholder {
  display: grid; place-items: center; font-weight: 700; color: #dbe4f5; font-size: 16px;
}
.sidebar-user-text { min-width: 0; }
.sidebar-name {
  font-weight: 700; font-size: 14px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-nick {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand {
  display: flex; align-items: flex-start; justify-content: flex-start;
  margin: 2px 0 16px; padding: 2px 4px;
}
.brand-logo-link { display: inline-flex; line-height: 0; text-decoration: none; }
.brand-logo {
  display: block; width: 190px; height: auto; max-width: 100%;
  object-fit: contain;
}
.brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.brand-wordmark {
  font-size: 15px; font-weight: 800; letter-spacing: 0.02em; color: #e8eef9;
  padding-left: 4px;
}
.brand-mark { display: none; }
.nav-section { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 10px 10px 6px;
}
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 10px 14px; border-radius: 8px; color: #dbe4f5;
  border: 1px solid transparent;
}
.nav-link:hover { background: rgba(255,255,255,0.05); }
.nav-link.active {
  background: transparent; color: #fff; font-weight: 600;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: #13c744; /* eToro green accent */
}
.nav-foot { margin-top: auto; padding: 8px; }
.pill-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 8px 12px; color: var(--muted); font-size: 13px;
}

.main { flex: 1; padding: 22px 28px 40px; max-width: 1800px; margin-left: 240px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 22px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 10px 14px; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: #3b4d6b; }
.btn-primary {
  background: var(--green); color: #04140a; border-color: transparent; font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-blue { background: var(--blue); border-color: transparent; color: white; font-weight: 600; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card + .card { margin-top: 14px; }
.card.profile { margin-bottom: 18px; }

.profile {
  display: flex; justify-content: space-between; gap: 18px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px;
}
.kpi-row { margin-top: 4px; }
.profile-left { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 64px; height: 64px; border-radius: 999px; object-fit: cover;
  border: 3px solid var(--pi-border, var(--card-border)); background: #1f2937;
  box-sizing: border-box;
}
.avatar.placeholder {
  display: grid; place-items: center; font-weight: 700; color: var(--muted);
}
.profile h2 { margin: 0 0 4px; font-size: 26px; }
.profile .sub { color: var(--muted); font-size: 14px; }
.disclaimer { color: var(--muted); font-size: 11px; max-width: 280px; text-align: right; }

.pill-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; margin: 14px 0;
}
.pill-tab {
  white-space: nowrap; border: 1px solid var(--card-border); background: transparent;
  color: var(--muted); border-radius: 999px; padding: 8px 14px; font-size: 13px;
}
.pill-tab.active {
  background: var(--green); color: #04140a; border-color: transparent; font-weight: 700;
}

.kpi-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px;
}
.kpi {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 14px 16px; min-height: 96px;
}
.kpi .label {
  color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
}
.kpi .value { font-size: 28px; font-weight: 750; margin-top: 8px; line-height: 1.1; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.positive { color: var(--green); }
.negative { color: var(--red); }
.amber { color: var(--amber); }
.muted { color: var(--muted); }

.grid-2 {
  display: grid; grid-template-columns: 1.7fr 0.9fr; gap: 14px;
}
.chart-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.range-btn {
  border: none; background: transparent; color: var(--muted); padding: 6px 8px;
  border-bottom: 2px solid transparent; cursor: pointer; font-size: 13px;
}
.range-btn.active { color: var(--text); border-bottom-color: var(--green); font-weight: 650; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

.chart-box { position: relative; height: 360px; }
.chart-box.tall { height: 440px; }

.summary-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; margin-top: 8px;
}
.summary-item .v { font-size: 22px; font-weight: 700; }
.summary-item .l { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Period summary mini cards under KPI row — equal fixed height (THIS MONTH must stay 1 line) */
.summary-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
  width: 100%;
  align-items: stretch;
}
.summary-row > .card { margin-top: 0; }
.summary-mini {
  text-align: center;
  padding: 12px 10px;
  height: 72px;
  width: 100%;
  box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center;
  margin-top: 0 !important;
}
.summary-mini .v { font-size: 18px; font-weight: 700; line-height: 1.15; }
.summary-mini .l {
  color: var(--muted); font-size: 10px; margin-top: 4px; letter-spacing: 0.04em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-card-full { width: 100%; margin-top: 0; }
.chart-card-full + .ripartizione,
.chart-card-full + .diversification { margin-top: 18px; }

.section-title { margin: 0 0 12px; font-size: 16px; }
.banner {
  border: 1px solid var(--card-border); background: #182338; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px;
}
.banner.warn { border-color: #7c4a12; background: #2a1c0b; color: #fbbf24; }
.stub {
  min-height: 280px; display: grid; place-items: center; text-align: center; color: var(--muted);
}
.form-grid { display: grid; gap: 12px; max-width: 480px; }
.form-grid label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form-grid input {
  background: #0f172a; border: 1px solid var(--card-border); border-radius: 10px;
  padding: 10px 12px; color: var(--text);
}

@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .summary-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    width: 100%;
    max-width: none;
    padding: 16px;
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }

  .summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Open / Share actions */
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; position: relative; }
.btn .ico { width: 16px; height: 16px; flex-shrink: 0; }
.btn-etoro, .btn-share { display: inline-flex; align-items: center; gap: 8px; }
.btn-etoro { background: var(--green); color: #04140a; border-color: transparent; font-weight: 700; }
.share-wrap { position: relative; }
.share-popover {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 40;
  width: min(360px, 86vw);
  background: #151c29; border: 1px solid var(--card-border); border-radius: 14px;
  padding: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.45);
}
.share-pop-title { font-weight: 700; font-size: 15px; }
.share-pop-sub { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.share-url-row {
  display: flex; align-items: center; gap: 8px;
  background: #0d1420; border: 1px solid var(--card-border); border-radius: 10px; padding: 8px 10px;
}
.share-url {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #e8eef9;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.share-copy {
  border: 0; background: transparent; color: #c9d4e8; cursor: pointer; padding: 4px; border-radius: 8px;
}
.share-copy:hover, .share-copy.copied { color: var(--green); background: rgba(34,197,94,.08); }
.share-social { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.share-social-btn { justify-content: center; font-size: 13px; }
.profile-actions { align-items: flex-start; }


/* Sidebar nav icons */
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.9; }
.nav-link { gap: 12px; border-radius: 10px; padding: 11px 12px 11px 14px; }
.nav-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Charts */
.chart-box { height: 360px; position: relative; }
.chart-box.tall { height: 440px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-card .chart-head { align-items: center; }
.chart-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.chart-tab {
  border: 1px solid var(--card-border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.chart-tab.active { background: #e8eef9; color: #0b1220; font-weight: 600; border-color: transparent; }
.live-pill { border-color: #14532d; color: #86efac; }
.legend .dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; margin-right: 6px; }


/* Demo-style range underline tabs */
.demo-ranges { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.demo-ranges .range-btn {
  background: transparent; border: 0; color: #93a0b8; padding: 6px 2px 8px;
  cursor: pointer; font-size: 14px; border-radius: 0; border-bottom: 2px solid transparent;
}
.demo-ranges .range-btn:hover { color: #e8eef9; }
.demo-ranges .range-btn.active {
  color: #fff; font-weight: 600; border-bottom-color: #fff; background: transparent;
}
.demo-legend { margin-top: 10px; }
.chart-loading {
  position: absolute; right: 18px; top: 18px; font-size: 12px; color: var(--muted);
}
.chart-card { position: relative; }

/* Cumulative equity curve (above period bars) */
.equity-card { margin-bottom: 14px; }
.chart-card-full + .chart-card-full { margin-top: 14px; }
.equity-box { height: 420px; }
.add-benchmark-stub {
  color: #64748b;
  font-size: 12px;
  cursor: default;
  user-select: none;
  margin-left: 4px;
  opacity: 0.75;
}
.add-benchmark-stub:hover { color: #64748b; }


/* Ripartizione (segmented bar) */
.ripartizione { margin-top: 18px; padding: 24px 24px 28px; }
.ripartizione-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.ripartizione-title { margin: 0; font-size: 22px; font-weight: 700; }
.ripartizione-dd-wrap {
  margin-left: auto;
  position: relative;
}
.ripartizione-dd {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  appearance: none;
  background: #0f172a;
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px 10px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-width: 160px;
  line-height: 1.2;
}
.ripartizione-dd:hover { border-color: #3b4d6b; }
.ripartizione-dd-wrap.is-open .ripartizione-dd {
  border-color: #3b4d6b;
}
.ripartizione-dd-label { flex: 1; text-align: left; }
.ripartizione-dd-chevron {
  flex-shrink: 0;
  color: #93a0b8;
  transition: transform .15s ease;
}
.ripartizione-dd-wrap.is-open .ripartizione-dd-chevron {
  transform: rotate(180deg);
}
.ripartizione-dd-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 220px;
  padding: 10px 0 8px;
  background: #1e222d;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.25);
}
.ripartizione-dd-menu[hidden] { display: none; }
.ripartizione-dd-menu-head {
  padding: 4px 16px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #8b95a8;
  letter-spacing: 0.01em;
}
.ripartizione-dd-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 11px 16px;
  background: transparent;
  border: 0;
  color: #c5cddb;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.ripartizione-dd-option:hover {
  background: rgba(255,255,255,0.04);
  color: #fff;
}
.ripartizione-dd-option.is-selected {
  color: #fff;
  font-weight: 700;
}
.ripartizione-dd-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #13d46a;
  opacity: 0;
}
.ripartizione-dd-option.is-selected .ripartizione-dd-check {
  opacity: 1;
}
.ripartizione-sub {
  color: var(--muted); font-size: 14px; margin: 0 0 18px;
}
.ripartizione-sub strong { color: var(--text); font-weight: 650; }
.ripartizione-bar {
  display: flex; width: 100%; height: 88px; border-radius: 12px; overflow: hidden;
  background: #0d1420; border: 1px solid rgba(36,48,68,0.8);
}
.ripartizione-seg {
  display: flex; align-items: center; justify-content: flex-start;
  height: 100%; min-width: 0; overflow: hidden;
  color: #fff; font-weight: 600;
  border-right: 1px solid rgba(11,18,32,0.65);
  transition: filter .15s ease;
  padding: 0 16px;
  box-sizing: border-box;
}
.ripartizione-seg:last-child { border-right: 0; }
.ripartizione-seg:hover { filter: brightness(1.08); }
.ripartizione-seg .seg-stack {
  display: flex; flex-direction: column; gap: 5px; min-width: 0; max-width: 100%;
  padding: 2px 4px 2px 0; box-sizing: border-box;
}
.ripartizione-seg .seg-label {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  font-size: 13px; font-weight: 600; opacity: 0.95; line-height: 1.2;
  padding-right: 2px;
}
.ripartizione-seg .seg-pct {
  font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums;
  line-height: 1.15; letter-spacing: -0.01em;
  padding-right: 4px; /* breathing room so % is not clipped by segment edge */
}
.ripartizione-empty {
  display: grid; place-items: center; width: 100%; color: var(--muted); font-size: 14px;
}
.ripartizione-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px;
  color: var(--muted); font-size: 12px;
}
.ripartizione-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.ripartizione-leg-item em { font-style: normal; color: #dbe4f5; font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Legacy diversification (unused) */
.diversification { margin-top: 22px; }
.diversification-title {
  text-align: center; margin: 0 0 14px; font-size: 20px; font-weight: 700;
}

.demo-chart-head { justify-content: space-between; gap: 16px; }
.demo-chart-head .chart-tabs { margin-left: auto; }


/* Open on eToro — black pill; green <etoro> mark is the brand treatment (PNG has black bg) */
.btn-etoro-official {
  display: inline-flex; align-items: center; gap: 8px;
  background: #0a0a0a; color: #13d46a; border: 1px solid #13d46a; border-radius: 999px;
  padding: 8px 14px 8px 16px; font-weight: 700; text-decoration: none;
  line-height: 1;
}
.btn-etoro-official:hover { filter: brightness(1.08); background: #111; }
.btn-etoro-official .etoro-bracket-mark {
  height: 20px; width: auto; display: block;
  /* etoro-bracket-green.png = neon green <etoro> on black — blends into black pill */
}
.etoro-open-label { font-size: 14px; font-weight: 700; color: #13d46a; }
.etoro-brand {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 800; letter-spacing: -0.02em;
  color: #13d46a; font-size: 15px;
}
.share-actions-col { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hub-text-link {
  font-size: 12px; color: var(--muted); text-decoration: none;
  border-bottom: 1px dotted rgba(147,160,184,0.5); padding-bottom: 1px;
}
.hub-text-link:hover { color: #c9d4e8; border-bottom-color: #c9d4e8; }

/* Chart legend swatches (solid vs outlined) */
.legend-item { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }
.legend .swatch, .swatch {
  width: 14px; height: 10px; border-radius: 3px; display: inline-block;
  box-sizing: border-box; flex-shrink: 0;
}

/* Dividends 3-column section (English copy) */
.dividends-section { margin-top: 18px; }
.dividends-grid {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 14px;
  align-items: stretch;
}
.dividends-grid > .card { margin-top: 0; }
.div-card {
  padding: 18px 18px 16px;
  min-height: 320px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.div-card h3 {
  margin: 0 0 12px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 650;
}
.div-yield-big {
  font-size: 42px; font-weight: 800; color: #f5c542; line-height: 1.05; margin: 4px 0 10px;
}
.div-meta { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 6px; }
.div-meta strong { color: var(--text); }
.div-highest { margin-top: 14px; }
.div-highest-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.div-highest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.div-highest-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 14px;
}
.div-highest-list .sym { color: #f5c542; font-weight: 700; }
.div-footer-note {
  margin-top: auto; padding-top: 14px; font-size: 11px; color: var(--muted); line-height: 1.4;
}
.div-table-wrap { overflow: auto; max-height: 280px; margin: 0 -4px; scrollbar-gutter: stable; padding-right: 6px; }
.div-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.div-table th {
  text-align: left; color: var(--muted); font-weight: 650; font-size: 10px;
  letter-spacing: 0.05em; text-transform: uppercase; padding: 6px 8px; position: sticky; top: 0;
  background: var(--card); border-bottom: 1px solid var(--card-border);
}
.div-table td { padding: 8px; border-bottom: 1px solid rgba(36,48,68,0.7); vertical-align: middle; }
.div-inst { display: flex; align-items: center; gap: 8px; min-width: 0; }
.div-logo {
  width: 22px; height: 22px; border-radius: 999px; object-fit: cover; background: #1f2937;
  flex-shrink: 0;
}
.div-logo.ph {
  display: grid; place-items: center; font-size: 9px; color: var(--muted); font-weight: 700;
}
.div-upcoming {
  list-style: none; margin: 0; padding: 0 16px 0 0; overflow: auto; max-height: 280px;
  display: grid; gap: 10px; scrollbar-gutter: stable;
}
.div-upcoming li {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 4px 8px 0; border-bottom: 1px solid rgba(36,48,68,0.7);
}
.div-upcoming .ticker { font-weight: 700; font-size: 13px; }
.div-upcoming .when { color: var(--muted); font-size: 11px; margin-top: 2px; }
.div-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  background: rgba(245,197,66,0.12); color: #f5c542; border: 1px solid rgba(245,197,66,0.35);
}
.div-badge.pay { background: rgba(34,197,94,0.12); color: #86efac; border-color: rgba(34,197,94,0.35); }
.div-badge.est {
  background: rgba(147,160,184,0.12); color: #c9d4e8; border-color: rgba(147,160,184,0.4);
}
.div-amt {
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px;
  padding-right: 14px; min-width: 4.5ch; text-align: right; justify-self: end;
}
.div-table td:last-child, .div-table th:last-child { padding-right: 16px; }
@media (max-width: 1100px) {
  .dividends-grid { grid-template-columns: 1fr; }
  .ripartizione-bar { height: 72px; }
  .ripartizione-seg .seg-pct { font-size: 16px; }
}


/* Worst Historical Drawdowns */
.dd-monthly-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; align-items: stretch;
}
.dd-monthly-grid > .drawdowns-section,
.dd-monthly-grid > .monthly-section { margin-top: 0; min-width: 0; }
.dd-monthly-grid .drawdowns-card,
.dd-monthly-grid .monthly-card { height: 100%; }
@media (max-width: 1100px) {
  .dd-monthly-grid { grid-template-columns: 1fr; }
}
.drawdowns-section { margin-top: 18px; }
.drawdowns-card { padding: 22px 22px 18px; }
.drawdowns-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.drawdowns-title { margin: 0; font-size: 20px; font-weight: 700; }
.drawdowns-badge {
  display: inline-flex; align-items: center;
  border: 1px solid rgba(34,197,94,0.45); color: #86efac;
  background: rgba(34,197,94,0.1); border-radius: 999px;
  padding: 5px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap;
}
.drawdowns-sub { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.drawdowns-table-wrap { overflow: auto; }
.drawdowns-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.drawdowns-table th {
  text-align: left; color: var(--muted); font-weight: 700; font-size: 11px;
  letter-spacing: 0.05em; text-transform: uppercase; padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
}
.drawdowns-table td {
  padding: 10px 12px; border-bottom: 1px solid rgba(36,48,68,0.7); vertical-align: middle;
}
.dd-depth { color: #fb7185; font-weight: 800; font-variant-numeric: tabular-nums; }
.dd-empty { color: var(--muted); text-align: center; padding: 18px 12px; }

/* Monthly Performance heatmap */
.monthly-section { margin-top: 18px; }
.monthly-card { padding: 18px 14px 14px; overflow: hidden; }
.monthly-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.monthly-title { margin: 0; font-size: 18px; font-weight: 700; }
.monthly-sub { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; max-width: 720px; }
.monthly-pills {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px;
}
.monthly-pill {
  border: 1px solid var(--card-border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 10px; cursor: pointer; font-size: 12px;
}
.monthly-pill:hover { color: #e8eef9; border-color: #3b4d6b; }
.monthly-pill.active { background: #e8eef9; color: #0b1220; font-weight: 600; border-color: transparent; }
.monthly-table-wrap { overflow-x: hidden; margin: 0; width: 100%; }
.monthly-table {
  width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; font-size: 10px;
  min-width: 0;
}
.monthly-table th {
  padding: 6px 1px; color: var(--muted); font-size: 9px; font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase; border-bottom: 1px solid var(--card-border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.monthly-table th:first-child,
.monthly-table td:first-child { width: 9%; }
.monthly-table th.mp-fy,
.monthly-table td.mp-fy { width: 8.5%; }
.monthly-table td {
  padding: 4px 1px; border-bottom: 1px solid rgba(36,48,68,0.7); vertical-align: middle;
}
.monthly-year {
  text-align: left; font-weight: 700; color: var(--text); padding-left: 4px !important;
  white-space: normal; word-break: break-word; font-size: 10px; line-height: 1.15;
}
.mp-cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 22px; width: 100%; max-width: none;
  border-radius: 2px; padding: 2px 1px; box-sizing: border-box;
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 9px; line-height: 1.1;
  --mp-i: 0.35;
}
.mp-cell.pos {
  color: #86efac;
  background: rgba(34,197,94, calc(0.12 + var(--mp-i) * 0.28));
  border: 1px solid rgba(34,197,94, calc(0.2 + var(--mp-i) * 0.35));
}
.mp-cell.neg {
  color: #fda4af;
  background: rgba(251,113,133, calc(0.12 + var(--mp-i) * 0.28));
  border: 1px solid rgba(251,113,133, calc(0.2 + var(--mp-i) * 0.35));
}
.mp-cell.neu {
  color: #c9d4e8;
  background: rgba(147,160,184,0.1);
  border: 1px solid rgba(147,160,184,0.25);
}
.mp-empty { color: rgba(147,160,184,0.45); font-weight: 600; }
.mp-fy { border-left: 2px solid rgba(36,48,68,0.9); font-weight: 800; }
.monthly-foot {
  margin: 12px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4;
}

/* Performance Metrics gauges */
.metrics-section { margin-top: 18px; padding: 22px 22px 16px; }
.metrics-head {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.metrics-title-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center;
}
.metrics-title { margin: 0; font-size: 22px; font-weight: 700; }
.metrics-score {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(34,197,94,0.45); color: #86efac;
  background: rgba(34,197,94,0.1); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
}
.metrics-score.is-empty {
  border-color: rgba(147,160,184,0.35); color: var(--muted); background: transparent;
}
.metrics-period-wrap { justify-self: end; }
.metrics-period {
  appearance: none; background: #0f172a; color: var(--text);
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 10px 36px 10px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #93a0b8 50%),
    linear-gradient(135deg, #93a0b8 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(1em + 2px), calc(100% - 11px) calc(1em + 2px);
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.metrics-period:hover { border-color: #3b4d6b; }
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.metrics-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 24px; }
.gauge-card {
  background: #121a27; border: 1px solid var(--card-border); border-radius: 12px;
  padding: 16px 16px 14px; min-height: 168px;
  display: flex; flex-direction: column;
}
.gauge-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gauge-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
}
.gauge-help {
  position: relative;
  width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #93a0b8; border: 1px solid rgba(147,160,184,0.45);
  cursor: help; flex-shrink: 0; background: transparent; padding: 0; line-height: 1;
}
.gauge-help:hover, .gauge-help:focus-visible, .gauge-help.is-open {
  color: #e8eef9; border-color: #93a0b8; outline: none;
}
.gauge-tip {
  display: none; position: absolute; z-index: 40;
  top: calc(100% + 8px); right: 0; width: min(260px, 70vw);
  padding: 10px 12px; border-radius: 8px; text-align: left;
  background: #0f172a; color: #e8eef9; border: 1px solid #3b4d6b;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
  font-size: 11px; font-weight: 500; line-height: 1.45; letter-spacing: 0;
  text-transform: none; white-space: normal;
}
.gauge-tip::before {
  content: ""; position: absolute; top: -6px; right: 6px;
  border: 6px solid transparent; border-top: 0; border-bottom-color: #3b4d6b;
}
.gauge-help:hover .gauge-tip,
.gauge-help:focus-visible .gauge-tip,
.gauge-help.is-open .gauge-tip { display: block; }
.gauge-value {
  font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums;
  margin: 8px 0 12px; line-height: 1.1; color: #fff;
}
.gauge-track-wrap {
  position: relative; height: 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08); margin-bottom: 6px;
}
.gauge-bar-gradient {
  position: absolute; inset: 0; border-radius: 999px;
  background: linear-gradient(90deg, #FF4D6D 0%, #F5B800 45%, #13C636 100%);
}
.gauge-bar-gradient.inverse {
  background: linear-gradient(90deg, #13C636 0%, #F5B800 45%, #FF4D6D 100%);
}
.gauge-pin {
  position: absolute; top: -4px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid #0b1220; box-shadow: 0 0 8px rgba(255,255,255,0.55);
  transform: translateX(-50%); z-index: 2;
}
.gauge-scale {
  display: flex; justify-content: space-between; font-size: 10px; color: var(--muted);
  font-variant-numeric: tabular-nums; margin-bottom: 6px;
}
.gauge-desc { margin: auto 0 0; font-size: 12px; color: var(--muted); line-height: 1.35; }
.metrics-foot { margin: 14px 0 0; font-size: 11px; color: var(--muted); }
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics-head { grid-template-columns: 1fr; }
  .metrics-period-wrap { justify-self: center; }
}
@media (max-width: 640px) {
  .metrics-grid { grid-template-columns: 1fr; }
}


/* Holdings price-change treemap — reference look: sector chrome, solid tiles, readable labels */
.treemap-section { margin-top: 18px; padding: 22px 22px 16px; }
.treemap-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.treemap-title { margin: 0; font-size: 20px; font-weight: 700; }
.treemap-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; max-width: 640px; }
.treemap-periods { display: flex; gap: 8px; flex-wrap: wrap; }
.treemap-period {
  border: 1px solid var(--card-border); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.treemap-period:hover { color: #e8eef9; border-color: #3b4d6b; }
.treemap-period.active { background: #e8eef9; color: #0b1220; font-weight: 600; border-color: transparent; }
.treemap-canvas {
  position: relative; width: 100%; min-height: 560px; height: clamp(560px, 64vh, 720px);
  background: #03060c; border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden;
}
.treemap-empty {
  display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; padding: 24px; text-align: center;
}
.tm-sector {
  position: absolute; box-sizing: border-box; overflow: hidden;
  background: #0a0f18; border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.tm-sector-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center;
  padding: 0 10px;
  background: linear-gradient(180deg, #1a2233 0%, #121a28 100%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  color: #f3f6fc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.tm-sector-label { display: none; }
.tm-tile {
  position: absolute; box-sizing: border-box; overflow: hidden;
  border-radius: 4px; border: 1px solid rgba(0,0,0,0.35);
  padding: 8px 6px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-align: center;
  --tm-i: 0.55;
  --tm-ticker: 16px;
  --tm-pct: 13px;
  --tm-logo: 28px;
}
.tm-tile.tm-other { opacity: 0.88; }
.tm-tile.up {
  /* solid green with intensity via opacity layering — reference-like, no hairline wash */
  background: color-mix(in srgb, #16a34a calc(45% + var(--tm-i) * 45%), #052e16);
  color: #f0fdf4;
}
.tm-tile.down {
  background: color-mix(in srgb, #dc2626 calc(45% + var(--tm-i) * 45%), #450a0a);
  color: #fff1f2;
}
.tm-logo {
  width: var(--tm-logo); height: var(--tm-logo); border-radius: 8px; object-fit: cover;
  background: rgba(0,0,0,0.28); flex: 0 0 auto; margin-bottom: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.tm-ticker {
  font-size: var(--tm-ticker); font-weight: 800; line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  letter-spacing: -0.01em; text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.tm-pct {
  font-size: var(--tm-pct); font-weight: 700; font-variant-numeric: tabular-nums;
  opacity: 0.96; line-height: 1.1; text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.treemap-foot { margin: 12px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* Trades page */
.trades-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trades-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
}

.trades-top > .card {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .trades-top {
    grid-template-columns: 1fr;
  }
}
.trades-card { padding: 18px 18px 16px; }
.trades-card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: #e8eef9; }
.trades-logos { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.trades-logo {
  width: 76px; height: 76px; border-radius: 999px; object-fit: cover;
  background: #1a2333; border: 1px solid #2a364d;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.trades-logo-more {
  width: 76px; height: 76px; border-radius: 999px; display: grid; place-items: center;
  background: #2a3346; color: #c5d0e4; font-size: 16px; font-weight: 700;
}
.trades-empty {
  padding: 36px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5;
  border: 1px dashed #2a364d; border-radius: 10px; background: rgba(255,255,255,0.02);
}
.trades-empty-inline { margin: 0; color: var(--muted); font-size: 13px; }
.winrate-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 140px; }
.winrate-gauge { width: 180px; height: 100px; position: relative; }
.winrate-gauge canvas { width: 180px !important; height: 100px !important; }
.winrate-value {
  margin-top: -8px; font-size: 28px; font-weight: 800; color: #f3f6fc;
  font-variant-numeric: tabular-nums;
}
.trade-stats-list { display: flex; flex-direction: column; gap: 12px; }
.trade-stats-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px; color: #93a0b8;
}
.trade-stats-row strong { font-size: 15px; font-weight: 700; }
.stat-green { color: #22c55e; }
.stat-blue { color: #38bdf8; }
.stat-orange { color: #fb923c; }
.stat-pink { color: #f472b6; }
.stat-red { color: #ef4444; }

/* Latest Trades (live open positions) */
.trades-latest-card { padding: 18px 18px 12px; }
.trades-latest-head { margin-bottom: 10px; }
.trades-latest-eyebrow {
  font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.trades-latest-title-row {
  display: flex; align-items: center; gap: 8px;
}
.trades-latest-title-row h3 {
  margin: 0; font-size: 20px; font-weight: 750; color: #e8eef9;
}
.trades-latest-card .trades-info { margin-top: 2px; }
.trades-latest-scroll {
  /* ~20 dense rows visible (~44px each + sticky head) */
  max-height: min(920px, 72vh); min-height: 640px;
  overflow-y: auto; overflow-x: auto;
  border-radius: 8px; scrollbar-width: thin; scrollbar-color: #3b4d6b transparent;
}
.trades-latest-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.trades-latest-scroll::-webkit-scrollbar-thumb {
  background: #3b4d6b; border-radius: 999px;
}
.trades-latest-table {
  width: 100%; border-collapse: collapse; min-width: 640px;
}
.trades-latest-table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #7f8aa3; font-weight: 650; padding: 10px 8px;
  border-bottom: 1px solid #243044; background: var(--card);
}
.trades-latest-table td {
  padding: 10px 8px; border-bottom: 1px solid #1b2434; font-size: 15px; color: #e8eef9;
  vertical-align: middle; font-variant-numeric: tabular-nums; line-height: 1.25;
}
.trades-latest-table tbody tr:last-child td { border-bottom: none; }
.trades-latest-table .trades-inst { gap: 12px; font-size: 15px; font-weight: 700; }
.trades-latest-table .trades-inst img {
  width: 32px; height: 32px; border-radius: 999px; object-fit: cover; background: #1a2333;
  flex-shrink: 0;
}
.trades-latest-table .pos { color: #22c55e; font-weight: 700; }
.trades-latest-table .neg { color: #ef4444; font-weight: 700; }
.trades-latest-date { color: #c5d0e4; white-space: nowrap; font-size: 14px; }

.trades-table-card { padding: 18px 18px 10px; }
.trades-table-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.trades-table-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.trades-export {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #3b4d6b; background: transparent; color: #e8eef9;
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.trades-table-wrap { overflow-x: auto; }
.trades-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.trades-table th {
  text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #7f8aa3; font-weight: 650; padding: 10px 8px; border-bottom: 1px solid #243044;
}
.trades-table td {
  padding: 12px 8px; border-bottom: 1px solid #1b2434; font-size: 13px; color: #e8eef9;
  vertical-align: middle;
}
.trades-inst { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.trades-inst img {
  width: 32px; height: 32px; border-radius: 999px; object-fit: cover; background: #1a2333;
}
.trades-table .pos { color: #22c55e; font-weight: 700; }
.trades-table .neg { color: #ef4444; font-weight: 700; }
.trades-demo-note { display: none; }


/* Compact monthly table inside half grid — must fit without horizontal scroll */
.dd-monthly-grid .monthly-table { min-width: 0; font-size: 10px; table-layout: fixed; }
.dd-monthly-grid .mp-cell { min-width: 0; max-width: none; font-size: 9px; padding: 2px 1px; }
.dd-monthly-grid .monthly-pills { gap: 6px; }
.dd-monthly-grid .monthly-pill { padding: 6px 10px; font-size: 12px; }
.dd-monthly-grid .monthly-table-wrap { overflow-x: hidden; }
.dd-monthly-grid .monthly-card { padding: 16px 12px 12px; }

/* =========================================================
   MOBILE NAVIGATION
   ========================================================= */

.mobile-menu-toggle {
  display: none;
}

.mobile-menu-overlay {
  display: none;
}

@media (max-width: 800px) {

  /* ---------- Mobile header button ---------- */

  .mobile-menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;

    width: 44px;
    height: 44px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;

    padding: 0;

    background: #151d2e;
    border: 1px solid var(--card-border);
    border-radius: 10px;

    cursor: pointer;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;

    background: #e8eef9;
    border-radius: 999px;

    transition: transform .2s ease, opacity .2s ease;
  }

  .mobile-menu-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }


  /* ---------- Sidebar drawer ---------- */

  .sidebar {
    display: flex;

    position: fixed;
    z-index: 1050;

    top: 0;
    bottom: 0;
    left: 0;

    width: min(280px, 82vw);
    height: 100vh;
    max-height: none;

    margin: 0;
    padding: 20px 14px;

    flex-direction: column;

    background: var(--sidebar);

    border-right: 1px solid var(--card-border);

    overflow-y: auto;
    overflow-x: hidden;

    transform: translateX(-105%);
    transition: transform .25s ease;

    box-shadow: 12px 0 35px rgba(0,0,0,.35);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }


  /* ---------- Keep the original sidebar content ---------- */

  .sidebar .brand,
  .sidebar .sidebar-user,
  .sidebar .nav-label {
    display: flex;
  }

  .sidebar .nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .sidebar .nav-foot {
    display: block;
  }

  .sidebar .nav-link {
    display: flex;
    flex-direction: row;

    width: auto;
    min-width: 0;
    height: auto;

    padding: 11px 12px 11px 14px;

    gap: 12px;

    font-size: inherit;
  }

  .sidebar .nav-link span {
    max-width: none;
  }

  .sidebar .nav-ico {
    width: 18px;
    height: 18px;
  }

  .sidebar .nav-link.active::before {
    left: 0;
    top: 8px;
    bottom: 8px;

    width: 3px;
    height: auto;

    transform: none;
  }


  /* ---------- Dark overlay ---------- */

  .mobile-menu-overlay {
    display: block;

    position: fixed;
    inset: 0;

    z-index: 1040;

    background: rgba(0, 0, 0, .62);

    opacity: 0;
    visibility: hidden;

    transition: opacity .25s ease, visibility .25s ease;
  }

  .mobile-menu-overlay.is-visible {
    opacity: 1;
    visibility: visible;
  }


  /* ---------- Main content ---------- */

  .main {
    margin-left: 0;
    width: 100%;
    max-width: none;

    padding: 68px 16px 30px;
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }

  .summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Main topbar + user menu ---------- */

/* User menu beside Share in profile card */
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
}
.profile-user-menu {
  display: flex;
  align-items: center;
  align-self: flex-start;
  padding-top: 4px;
  margin-left: 10px;
}
.profile-user-menu .user-menu-dropdown {
  right: 0;
  left: auto;
}

.main-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -6px 0 12px;
  min-height: 40px;
}

.user-menu {
  position: relative;
  z-index: 40;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;
  line-height: 0;
}

.user-menu-trigger:focus-visible {
  outline: 2px solid #13c744;
  outline-offset: 2px;
}

.user-menu-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.18);
  background: #1f2937;
  display: block;
}

.user-menu-avatar.placeholder {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #dbe4f5;
  font-size: 14px;
}

.user-menu-avatar--sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #1a2336;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 8px 0;
  z-index: 50;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 12px;
}

.user-menu-email {
  font-size: 13px;
  color: #e8eef9;
  word-break: break-all;
  line-height: 1.3;
}

.user-menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #dbe4f5;
  text-decoration: none;
  font-size: 14px;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.user-menu-item--button {
  font: inherit;
}

.user-menu-logout-form {
  margin: 0;
}

.user-menu-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}

.user-menu-login {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: #dbe4f5;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.user-menu-login:hover {
  border-color: #3b4d6b;
  color: #fff;
}

.sidebar-version {
  margin-top: auto;
  padding: 14px 12px 8px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
  opacity: 0.85;
}

@media (max-width: 800px) {
  .main-topbar {
    margin: 0 0 10px;
    padding-right: 48px;
  }

  .user-menu-dropdown {
    right: 0;
    min-width: 220px;
  }
}

/* Page loading bar (public/assets/js/page-loader.js) */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  width: 0;
  height: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, var(--green), var(--blue));
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: width 0.25s ease, opacity 0.2s ease;
}
.page-loader.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .page-loader { transition: opacity 0.2s ease; }
}

/* Trades: other users' profiles only show Most Traded (full width) */
.trades-top.trades-top-single { grid-template-columns: 1fr; }
