:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --ink: #18202a;
  --muted: #77808c;
  --line: #e7e9ee;
  --purple: #6750ce;
  --purple-soft: #eeeafe;
  --negative: #bd6049;
  --negative-soft: #faede9;
  --positive: #2f8a71;
  --positive-soft: #e8f5f0;
  --warning: #d59446;
  --shadow: 0 12px 35px rgba(30, 38, 53, 0.055);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  font-size: 14px;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 20;
  display: flex;
  width: 230px;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #fbfbfc;
  padding: 24px 16px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 34px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--purple);
  color: white;
}

.brand-mark svg {
  width: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.brand-mark path {
  fill: currentColor;
  stroke: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 12px 14px;
  color: #69727d;
  cursor: pointer;
  text-align: right;
}

.nav-item:hover {
  background: #f1f0f8;
  color: var(--ink);
}

.nav-item.active {
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 700;
}

.nav-icon {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  font-size: 19px;
}

.nav-badge {
  margin-right: auto;
  border-radius: 12px;
  background: #eeeef1;
  padding: 2px 7px;
  color: #747984;
  font-size: 11px;
}

.alert-dot,
.notification-btn span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--negative);
}

.alert-dot {
  margin-right: auto;
}

.side-bottom {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.market-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  border: 1px solid #e6eee9;
  border-radius: 13px;
  background: #f5faf7;
  padding: 11px 12px;
}

.market-mini strong,
.market-mini small {
  display: block;
}

.market-mini strong {
  font-size: 12px;
}

.market-mini small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.live-pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
}

.live-pulse::after {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--positive);
  border-radius: inherit;
  animation: pulse 1.7s infinite;
  content: "";
}

@keyframes pulse {
  from {
    opacity: 0.8;
    transform: scale(0.7);
  }
  to {
    opacity: 0;
    transform: scale(1.5);
  }
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding: 16px 4px 0;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #e4dfcf;
  color: #665e48;
  font-weight: 700;
}

.user-card strong,
.user-card small {
  display: block;
}

.user-card strong {
  font-size: 12px;
}

.user-card small {
  max-width: 125px;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  margin-right: auto;
  color: var(--muted);
}

.main-content {
  max-width: 1700px;
  margin-right: 230px;
  padding: 24px 34px 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  font-weight: 750;
}

.top-actions,
.data-quality {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 8px;
}

.data-quality {
  gap: 7px;
  margin-left: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 9px 12px;
  color: var(--muted);
  font-size: 10px;
}

.data-quality strong {
  color: var(--ink);
}

.quality-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 3px var(--positive-soft);
}

.quality-dot.stale {
  background: var(--warning);
  box-shadow: 0 0 0 3px #fff3e4;
}

.icon-btn,
.ghost-icon,
.chart-menu,
.info-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.icon-btn {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: #525b66;
  font-size: 18px;
}

.notification-btn span {
  position: absolute;
  top: 7px;
  right: 8px;
  border: 1px solid white;
}

.session-progress-card {
  margin-bottom: 12px;
  border: 1px solid #e2ece7;
  border-radius: 16px;
  background: linear-gradient(135deg, #fbfdfc, #f3faf7);
  box-shadow: var(--shadow);
  padding: 11px 16px 12px;
}

.session-progress-head,
.session-progress-head > div,
.session-time-grid {
  display: flex;
  align-items: center;
}

.session-progress-head {
  justify-content: space-between;
  margin-bottom: 9px;
}

.session-progress-head > div {
  gap: 8px;
}

.session-progress-head strong {
  font-size: 10px;
}

.session-progress-head > span {
  color: var(--positive);
  font-size: 10px;
  font-weight: 750;
}

.session-time-grid {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  gap: 14px;
}

.session-time small,
.session-time strong,
.session-time span {
  display: block;
}

.session-time small,
.session-time span {
  color: var(--muted);
  font-size: 7px;
}

.session-time strong {
  margin: 2px 0;
  font-size: 14px;
}

.session-time.remaining {
  text-align: left;
}

.session-progress-track {
  position: relative;
  height: 7px;
  overflow: visible;
  border-radius: 10px;
  background: #dfe9e4;
}

.session-progress-track i {
  position: absolute;
  inset: 0 0 0 auto;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #65b39b, var(--positive));
  transition: width .35s ease;
}

.session-progress-track span {
  position: absolute;
  top: 50%;
  right: 0;
  width: 13px;
  height: 13px;
  transform: translate(50%, -50%);
  border: 3px solid white;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 1px 5px rgba(35, 80, 65, .25);
  transition: right .35s ease;
}

.portfolio-strip {
  display: grid;
  grid-template-columns: minmax(280px, 1.35fr) repeat(3, minmax(160px, 0.75fr));
  gap: 12px;
  margin-bottom: 16px;
}

.portfolio-main,
.metric-card,
.forecast-card,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.portfolio-main,
.metric-card {
  min-height: 120px;
  border-radius: 17px;
}

.portfolio-main {
  padding: 19px 21px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.ghost-icon {
  color: #a1a7af;
  font-size: 12px;
}

.portfolio-value {
  margin: 6px 0 8px;
  font-size: 29px;
  font-weight: 750;
  letter-spacing: -1px;
}

.portfolio-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.loss-pill {
  border-radius: 7px;
  background: var(--negative-soft);
  padding: 4px 7px;
  color: var(--negative);
}

.loss-pill.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.loss-pill.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.positive-text {
  color: var(--positive);
}

.divider {
  width: 1px;
  height: 12px;
  background: var(--line);
}

.loss-text,
.down {
  color: var(--negative);
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
}

.metric-icon {
  display: grid;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
}

.metric-icon.violet {
  background: var(--purple-soft);
  color: var(--purple);
}

.metric-icon.orange {
  background: #fff3e4;
  color: var(--warning);
}

.metric-icon.teal {
  background: var(--positive-soft);
  color: var(--positive);
}

.metric-card small,
.metric-card strong,
.metric-card span {
  display: block;
}

.metric-card small {
  color: var(--muted);
  font-size: 10px;
}

.metric-card strong {
  margin: 5px 0 4px;
  font-size: 14px;
}

.metric-card span {
  color: var(--muted);
  font-size: 9px;
}

.metric-card span b {
  color: var(--ink);
}

.forecast-card {
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--radius);
}

.forecast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 17px;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 7px;
}

.section-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.model-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  background: var(--positive-soft);
  padding: 3px 8px;
  color: var(--positive);
  font-size: 8px;
}

.model-status i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.forecast-header h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.forecast-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 10px;
}

.period-tabs,
.stock-filters {
  display: flex;
  align-items: center;
  border-radius: 11px;
  background: var(--surface-soft);
  padding: 3px;
}

.period-tab,
.stock-filter {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.period-tab {
  min-width: 68px;
  padding: 8px 13px;
}

.period-tab.active,
.stock-filter.active {
  background: var(--surface);
  box-shadow: 0 2px 9px rgba(30, 38, 53, 0.08);
  color: var(--ink);
  font-weight: 700;
}

.forecast-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.8fr) minmax(480px, 1.4fr);
  border-top: 1px solid var(--line);
}

.forecast-summary {
  padding: 22px 24px;
}

.direction-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.direction-orb {
  display: grid;
  width: 49px;
  height: 49px;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
}

.direction-orb.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.direction-orb.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.direction-orb.neutral {
  background: #f2f0fb;
  color: var(--purple);
}

.direction-row small,
.direction-row strong,
.direction-row span {
  display: block;
}

.direction-row small {
  color: var(--muted);
  font-size: 9px;
}

.direction-row strong {
  margin: 3px 0;
  font-size: 17px;
}

.direction-row span {
  color: var(--muted);
  font-size: 8px;
}

.probability-block {
  margin: 22px 0 18px;
}

.probability-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.probability-labels b {
  color: var(--ink);
}

.probability-bar {
  display: flex;
  height: 7px;
  overflow: hidden;
  border-radius: 8px;
  background: #eee;
}

.prob-down {
  width: 64%;
  background: var(--negative);
}

.prob-up {
  width: 36%;
  background: var(--positive);
}

.range-box {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  padding: 13px 14px 11px;
}

.range-top,
.range-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-top {
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 9px;
}

.range-top strong {
  color: var(--ink);
  font-size: 10px;
}

.range-track {
  position: relative;
  height: 4px;
  border-radius: 5px;
  background: linear-gradient(to left, #d9eee7 0 50%, #f4dcd5 50% 100%);
}

.range-zone {
  position: absolute;
  top: -4px;
  right: 35%;
  width: 50%;
  height: 12px;
  border: 2px solid var(--surface);
  border-radius: 8px;
  background: #d6927e;
  box-shadow: 0 1px 3px rgba(40, 40, 45, .15);
  transition: all .35s ease;
}

.range-zero {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  padding: 1px 4px;
  color: var(--muted);
  font-size: 7px;
}

.range-marker {
  position: absolute;
  top: -6px;
  right: 64%;
  width: 3px;
  height: 16px;
  border-radius: 5px;
  background: var(--negative);
  transition: right .35s ease;
}

.range-values {
  margin-top: 10px;
  color: var(--muted);
  font-size: 8px;
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 9px;
}

.confidence-row strong {
  margin-right: auto;
  color: var(--ink);
}

.confidence-meter {
  display: flex;
  gap: 3px;
}

.confidence-meter i {
  width: 17px;
  height: 4px;
  border-radius: 4px;
  background: #e6e7eb;
}

.confidence-meter i:nth-child(-n + 3) {
  background: var(--purple);
}

.info-button {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 8px;
}

.chart-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 17px 21px 12px;
}

.chart-toolbar,
.legend {
  display: flex;
  align-items: center;
}

.chart-toolbar {
  justify-content: space-between;
  gap: 8px;
}

.legend {
  flex-wrap: wrap;
  gap: 15px;
  color: var(--muted);
  font-size: 8px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.line-actual {
  width: 13px;
  height: 2px;
  background: var(--purple);
}

.area-forecast {
  width: 13px;
  height: 7px;
  border: 1px dashed;
}

.area-forecast.range-50 {
  border-color: var(--positive);
  background: var(--positive-soft);
}

.area-forecast.range-80 {
  border-color: var(--negative);
  background: var(--negative-soft);
}

.news-dot-legend {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

.chart-live-status {
  color: var(--muted);
  font-size: 7px;
}

.chart-menu {
  color: var(--muted);
}

.chart-wrap {
  position: relative;
  min-height: 255px;
  padding-top: 4px;
}

.forecast-chart {
  width: 100%;
  height: 225px;
  overflow: visible;
}

.grid-lines line {
  stroke: #eff0f3;
  stroke-width: 1;
}

.actual-area {
  fill: url(#actualGradient);
}

.actual-line {
  fill: none;
  stroke: var(--purple);
  stroke-width: 2.5;
}

.forecast-area {
  transition: d .35s ease;
}

.range-80-area {
  fill: url(#forecast80Gradient);
}

.range-50-area {
  fill: url(#forecast50Gradient);
}

.forecast-midline {
  fill: none;
  stroke: var(--negative);
  stroke-dasharray: 5 5;
  stroke-width: 2;
}

.now-line {
  stroke: #cfd2d8;
  stroke-dasharray: 3 4;
}

.now-dot {
  fill: var(--surface);
  stroke: var(--purple);
  stroke-width: 3;
}

.chart-hover-line,
.chart-hover-dot {
  opacity: 0;
  pointer-events: none;
}

.chart-hover-line {
  stroke: #9299a4;
  stroke-dasharray: 3 3;
}

.chart-hover-dot {
  fill: white;
  stroke: var(--purple);
  stroke-width: 3;
}

.news-marker {
  cursor: pointer;
  stroke: white;
  stroke-width: 2;
}

.news-marker.positive {
  fill: var(--positive);
}

.news-marker.negative {
  fill: var(--negative);
}

.news-marker.neutral {
  fill: var(--warning);
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  min-width: 130px;
  max-width: 210px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 8px 25px rgba(25, 30, 40, .12);
  padding: 7px 9px;
  color: var(--text);
  font-size: 8px;
  line-height: 1.55;
  pointer-events: none;
}

.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}

.chart-tooltip span {
  color: var(--muted);
}

.price-tag {
  position: absolute;
  z-index: 2;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 8px;
  font-weight: 700;
}

.current-tag {
  top: 98px;
  right: 58%;
  transform: translateX(-100%);
  background: var(--purple);
  color: white;
}

.forecast-tag {
  top: 130px;
  left: 4%;
  transform: translateX(-100%);
  background: var(--negative-soft);
  color: var(--negative);
}

.chart-now-label {
  position: absolute;
  right: 58%;
  bottom: 13px;
  transform: translateX(50%);
  color: var(--muted);
  font-size: 7px;
}

.chart-axis {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  color: #9ba0a8;
  direction: ltr;
  font-size: 7px;
}

.chart-detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 7px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.95fr) minmax(430px, 1.25fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  border-radius: var(--radius);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 21px 14px;
}

.panel-header h3 {
  margin: 4px 0 0;
  font-size: 14px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--purple);
  cursor: pointer;
  font-size: 9px;
  text-decoration: none;
}

.driver-list {
  padding: 3px 21px 5px;
}

.driver-row {
  display: grid;
  grid-template-columns: 36px minmax(120px, 1fr) 1.5fr 38px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid #f0f1f3;
  padding: 11px 0;
  cursor: pointer;
}

.driver-row:last-child {
  border-bottom: 0;
}

.driver-row:hover .driver-name strong {
  color: var(--purple);
}

.driver-symbol {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-soft);
  color: #717884;
  font-size: 13px;
}

.driver-name strong,
.driver-name small {
  display: block;
}

.driver-name strong {
  font-size: 10px;
}

.driver-name small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 7px;
}

.driver-track {
  position: relative;
  height: 5px;
  border-radius: 5px;
  background: #f0f1f3;
}

.driver-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: inherit;
}

.driver-fill.negative {
  left: 50%;
  background: #d58c78;
}

.driver-fill.positive {
  right: 50%;
  background: #63aa93;
}

.driver-score {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
}

.driver-score.negative {
  color: var(--negative);
}

.driver-score.positive {
  color: var(--positive);
}

.driver-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 11px 21px;
  color: var(--muted);
  font-size: 8px;
}

.net-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
  border-radius: 8px;
  padding: 5px 8px;
}

.net-score.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.net-score.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.net-score strong {
  font-size: 12px;
}

.driver-footer p {
  margin: 0 0 0 auto;
}

.news-list {
  padding: 0 21px 13px;
}

.news-item {
  display: grid;
  grid-template-columns: 5px 1fr auto;
  gap: 12px;
  border-top: 1px solid #f0f1f3;
  padding: 14px 0;
  cursor: pointer;
}

.news-item:first-child {
  border-top: 0;
}

.news-item:hover .news-copy h4 {
  color: var(--purple);
}

.impact-line {
  border-radius: 8px;
  background: #98a1ac;
}

.impact-line.negative {
  background: var(--negative);
}

.impact-line.positive {
  background: var(--positive);
}

.impact-line.neutral {
  background: #98a1ac;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 7px;
}

.sentiment-badge,
.impact-badge,
.source-badge {
  border-radius: 9px;
  padding: 2px 6px;
}

.impact-badge.high {
  background: var(--purple-soft);
  color: var(--purple);
}

.impact-badge.medium {
  background: #fff3e3;
  color: #a96f2a;
}

.impact-badge.low {
  background: var(--surface-soft);
  color: #68717c;
}

.sentiment-badge.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.sentiment-badge.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.sentiment-badge.neutral {
  background: var(--surface-soft);
  color: #68717c;
}

.source-badge {
  background: var(--surface-soft);
}

.news-copy h4 {
  margin: 0 0 6px;
  font-size: 10px;
  line-height: 1.6;
}

.ticker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ticker-tags span {
  border-radius: 5px;
  background: var(--surface-soft);
  padding: 2px 5px;
  color: #68717c;
  font-size: 7px;
}

.news-impact {
  min-width: 70px;
  text-align: left;
}

.news-impact small,
.news-impact strong,
.news-impact span {
  display: block;
}

.news-impact small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 7px;
}

.news-impact strong,
.news-impact a {
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.news-impact strong.positive {
  color: var(--positive);
}

.news-impact strong.negative {
  color: var(--negative);
}

.news-impact strong.neutral {
  color: #68717c;
}

.news-impact span {
  margin: 2px 0 5px;
  color: var(--muted);
  font-size: 7px;
}

.news-impact a {
  color: var(--purple);
  font-size: 8px;
}

.learning-panel {
  margin-bottom: 16px;
  overflow: hidden;
}

.learning-state {
  border-radius: 20px;
  background: #fff3e3;
  padding: 5px 9px;
  color: #a96f2a;
  font-size: 8px;
}

.learning-state.validated {
  background: var(--positive-soft);
  color: var(--positive);
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.learning-stat {
  border-left: 1px solid var(--line);
  padding: 17px 20px;
}

.learning-stat:last-child {
  border-left: 0;
}

.learning-stat small,
.learning-stat strong,
.learning-stat span {
  display: block;
}

.learning-stat small,
.learning-stat span {
  color: var(--muted);
  font-size: 8px;
}

.learning-stat strong {
  margin: 6px 0 5px;
  font-size: 17px;
}

.learning-detail {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
}

.learning-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.8;
}

.model-weights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.weight-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  padding: 5px 7px;
  font-size: 8px;
}

.weight-chip span {
  color: var(--muted);
}

.source-links {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.source-links a {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--purple);
  font-size: 9px;
  text-decoration: none;
}

.holdings-panel {
  margin-bottom: 16px;
  overflow: hidden;
}

.holdings-header {
  padding-bottom: 16px;
}

.stock-filter {
  padding: 7px 12px;
}

.holdings-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  white-space: nowrap;
}

th {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 10px 20px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
}

td {
  border-bottom: 1px solid #f0f1f3;
  padding: 12px 20px;
  font-size: 9px;
}

td > strong,
.stock-day-change {
  display: block;
}

.stock-day-change {
  margin-top: 3px;
  font-size: 7px;
}

.stock-day-change.positive {
  color: var(--positive);
}

.stock-day-change.negative {
  color: var(--negative);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafafe;
}

.stock-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.stock-logo {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: #eef0f4;
  color: #4f5864;
  font-size: 9px;
  font-weight: 800;
}

.stock-cell strong,
.stock-cell small {
  display: block;
}

.stock-cell strong {
  font-size: 10px;
}

.stock-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
}

.change {
  font-weight: 700;
}

.change.negative {
  color: var(--negative);
}

.change.positive {
  color: var(--positive);
}

.forecast-pill {
  border-radius: 8px;
  padding: 4px 7px;
}

.forecast-pill.negative {
  background: var(--negative-soft);
  color: var(--negative);
}

.forecast-pill.positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.category-pill {
  border-radius: 8px;
  background: var(--purple-soft);
  padding: 4px 7px;
  color: var(--purple);
}

.mini-confidence {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-confidence span {
  width: 45px;
  height: 3px;
  overflow: hidden;
  border-radius: 4px;
  background: #eceef1;
}

.mini-confidence i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--purple);
}

.row-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  color: #969ca5;
  font-size: 8px;
}

.page-footer p {
  margin-bottom: 0;
}

.mobile-nav {
  display: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  visibility: hidden;
  background: rgba(22, 27, 34, 0.25);
  opacity: 0;
  transition: .25s ease;
}

.drawer-backdrop.open {
  visibility: visible;
  opacity: 1;
}

.detail-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: min(420px, 94vw);
  overflow-y: auto;
  background: var(--surface);
  box-shadow: 15px 0 35px rgba(20, 25, 32, .13);
  padding: 28px;
  transform: translateX(-105%);
  transition: transform .3s ease;
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  margin-right: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-size: 18px;
}

.drawer-content {
  padding-top: 22px;
}

.drawer-content .drawer-label {
  color: var(--purple);
  font-size: 10px;
}

.drawer-content h2 {
  margin: 8px 0 10px;
  font-size: 20px;
  line-height: 1.55;
}

.drawer-content > p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.9;
}

.drawer-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 20px 0;
}

.drawer-stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
}

.drawer-stat small,
.drawer-stat strong {
  display: block;
}

.drawer-stat small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 8px;
}

.drawer-stat strong {
  font-size: 14px;
}

.drawer-section {
  border-top: 1px solid var(--line);
  padding-top: 17px;
}

.drawer-section h3 {
  font-size: 12px;
}

.drawer-section ul {
  margin: 0;
  padding-right: 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 2;
}

.tooltip {
  position: fixed;
  z-index: 70;
  display: none;
  max-width: 210px;
  border-radius: 9px;
  background: #222a35;
  padding: 8px 10px;
  color: white;
  font-size: 8px;
  line-height: 1.7;
}

@media (max-width: 1250px) {
  .portfolio-strip {
    grid-template-columns: 1.3fr repeat(3, 1fr);
  }

  .metric-card {
    gap: 8px;
    padding: 14px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1050px) {
  .sidebar {
    width: 74px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .brand {
    justify-content: center;
    margin-right: 0;
    margin-left: 0;
  }

  .brand > span:last-child,
  .nav-item > span:not(.nav-icon, .nav-badge, .alert-dot),
  .side-bottom .market-mini div,
  .user-card div:not(.avatar),
  .chevron {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 12px;
  }

  .nav-badge,
  .alert-dot {
    position: absolute;
    top: 6px;
    left: 8px;
  }

  .market-mini {
    justify-content: center;
    padding: 12px;
  }

  .user-card {
    justify-content: center;
  }

  .main-content {
    margin-right: 74px;
  }

  .portfolio-strip {
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .metric-card:last-child {
    display: none;
  }

  .forecast-grid {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    border-top: 1px solid var(--line);
    border-right: 0;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 68px;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    margin-right: 0;
    padding: 17px 13px 20px;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 18px;
  }

  .data-quality {
    display: none;
  }

  .session-progress-card {
    padding: 10px 12px 11px;
  }

  .session-progress-head {
    margin-bottom: 8px;
  }

  .session-progress-head strong,
  .session-progress-head > span {
    font-size: 8px;
  }

  .session-time-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }

  .session-progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 2px 4px;
  }

  .session-time strong {
    font-size: 12px;
  }

  .session-time small,
  .session-time span {
    font-size: 6.5px;
  }

  .portfolio-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .portfolio-main,
  .metric-card {
    min-width: 78vw;
    scroll-snap-align: start;
  }

  .forecast-header {
    display: block;
    padding: 18px 16px 13px;
  }

  .forecast-header h2 {
    font-size: 17px;
  }

  .period-tabs {
    margin-top: 15px;
  }

  .period-tab {
    flex: 1;
  }

  .forecast-summary {
    padding: 18px 16px;
  }

  .chart-panel {
    padding: 12px 8px 10px;
  }

  .chart-toolbar {
    display: block;
    min-height: 31px;
    padding: 0 4px;
  }

  .legend {
    flex-wrap: nowrap;
    gap: 9px;
    overflow-x: auto;
    padding-bottom: 5px;
    font-size: 7px;
    scrollbar-width: none;
  }

  .legend::-webkit-scrollbar {
    display: none;
  }

  .legend span {
    flex: 0 0 auto;
  }

  .legend span:last-child {
    display: none;
  }

  .chart-live-status {
    display: block;
    margin-top: 1px;
    color: #9299a4;
    font-size: 6.5px;
    text-align: right;
  }

  .chart-wrap {
    min-height: 240px;
    margin-top: 2px;
    overflow: hidden;
  }

  .forecast-chart {
    height: 215px;
  }

  .price-tag {
    max-width: 74px;
    overflow: hidden;
    padding: 3px 5px;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .current-tag {
    transform: translateX(-105%);
  }

  .forecast-tag {
    transform: translateX(-100%);
  }

  .chart-now-label {
    bottom: 16px;
    font-size: 6px;
  }

  .chart-axis {
    padding: 0 3px;
    font-size: 6px;
  }

  .chart-detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 4px 0;
    font-size: 6.5px;
    line-height: 1.6;
  }

  #chartHistoryStart,
  #chartForecastTracking {
    display: none;
  }

  .chart-tooltip {
    max-width: 165px;
    font-size: 7px;
  }

  .news-marker {
    stroke-width: 1.5;
  }

  .content-grid {
    display: block;
  }

  .content-grid .panel {
    margin-bottom: 14px;
  }

  .panel-header {
    padding: 17px 16px 12px;
  }

  .driver-list,
  .news-list {
    padding-right: 16px;
    padding-left: 16px;
  }

  .driver-row {
    grid-template-columns: 32px minmax(95px, 1fr) 1fr 32px;
  }

  .news-item {
    grid-template-columns: 4px 1fr;
  }

  .news-impact {
    display: none;
  }

  .holdings-header {
    display: block;
  }

  .learning-grid {
    grid-template-columns: 1fr 1fr;
  }

  .learning-stat:nth-child(2) {
    border-left: 0;
  }

  .learning-stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .learning-detail {
    grid-template-columns: 1fr;
    padding: 15px 16px;
  }

  .stock-filters {
    margin-top: 13px;
  }

  .stock-filter {
    flex: 1;
  }

  th,
  td {
    padding-right: 14px;
    padding-left: 14px;
  }

  .page-footer {
    display: block;
    line-height: 1.8;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    padding: 7px 6px 9px;
    backdrop-filter: blur(12px);
  }

  .mobile-nav button {
    display: grid;
    gap: 3px;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 8px;
  }

  .mobile-nav button span {
    font-size: 18px;
  }

  .mobile-nav button.active {
    color: var(--purple);
    font-weight: 700;
  }
}
