:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-alt: #eef3f0;
  --ink: #18201f;
  --muted: #68736f;
  --line: #dce3df;
  --green: #0d8f62;
  --green-soft: #e6f6ef;
  --red: #cf4a42;
  --red-soft: #fbeae8;
  --amber: #b97b12;
  --amber-soft: #fff4d7;
  --teal: #137b86;
  --shadow: 0 14px 40px rgba(30, 41, 36, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(19, 123, 134, 0.08), transparent 420px),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 36px) 40px;
}

.market-strip {
  display: grid;
  grid-template-columns: minmax(230px, 320px) 1fr;
  gap: 18px;
  align-items: stretch;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #173b36;
  color: #f7faf7;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.6vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1rem, 1.7vw, 1.28rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.ticker-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 10px;
  min-width: 0;
}

.ticker-card {
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 20px rgba(30, 41, 36, 0.04);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.ticker-card:hover,
.ticker-card.active {
  transform: translateY(-2px);
  border-color: rgba(19, 123, 134, 0.45);
  box-shadow: var(--shadow);
}

.ticker-card strong,
.ticker-card span {
  display: block;
  white-space: nowrap;
}

.ticker-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.98rem;
}

.ticker-card .ticker-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.ticker-card .ticker-move {
  margin-top: 3px;
  font-weight: 800;
  font-size: 0.86rem;
}

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

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

.search-band {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
  gap: 18px;
  align-items: end;
  margin-top: 28px;
}

.search-box {
  position: relative;
}

.search-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.search-control {
  display: grid;
  grid-template-columns: 1fr 48px;
  overflow: hidden;
  border: 1px solid #cbd6d1;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-control:focus-within {
  border-color: var(--teal);
  outline: 3px solid rgba(19, 123, 134, 0.14);
}

.search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 16px 18px;
  color: var(--ink);
  background: transparent;
  font-size: 1rem;
}

.search-control button {
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--line);
  background: #173b36;
  color: #fff;
  font-size: 1.3rem;
}

.suggestions {
  position: absolute;
  z-index: 10;
  right: 0;
  left: 0;
  display: none;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.suggestions.open {
  display: block;
}

.suggestion {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover {
  background: var(--surface-alt);
}

.suggestion code {
  color: var(--teal);
  font-weight: 800;
}

.suggestion small {
  color: var(--muted);
}

.session-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.session-summary > div,
.metrics-grid > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.session-summary span,
.metrics-grid span,
.prediction-tile span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.session-summary strong,
.metrics-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-size: 0.92rem;
  white-space: nowrap;
}

.summary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #173b36;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
}

.summary-action:hover,
.summary-action:focus-visible {
  background: #24574f;
}

.summary-action.loading {
  opacity: 0.72;
  cursor: wait;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(460px, 1.55fr) minmax(300px, 0.9fr);
  gap: 18px;
  margin-top: 22px;
}

.quote-panel,
.chart-panel,
.trend-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.quote-panel,
.trend-panel {
  padding: 18px;
}

.chart-panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
}

.panel-header.compact {
  padding: 18px 18px 0;
}

.price-stack {
  flex: 0 0 auto;
  text-align: right;
}

.price-stack strong {
  display: block;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1;
}

.price-stack span {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  font-size: 0.84rem;
  font-weight: 800;
}

.price-stack span.positive {
  background: var(--green);
  color: #fff;
}

.price-stack span.negative {
  background: var(--red);
  color: #fff;
}

.prediction-grid {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.prediction-tile {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prediction-tile.high {
  background: var(--green-soft);
  border-color: rgba(13, 143, 98, 0.25);
}

.prediction-tile.low {
  background: var(--red-soft);
  border-color: rgba(207, 74, 66, 0.25);
}

.prediction-tile.neutral {
  background: var(--amber-soft);
  border-color: rgba(185, 123, 18, 0.24);
}

.prediction-tile strong {
  display: block;
  font-size: clamp(1.36rem, 3vw, 2rem);
  line-height: 1.05;
}

.prediction-tile small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.32;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-item::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
}

.legend-item.high-line::before {
  background: var(--green);
}

.legend-item.low-line::before {
  background: var(--red);
}

.chart-frame {
  width: 100%;
  height: 420px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(rgba(24, 32, 31, 0.04) 1px, transparent 1px) 0 0 / 100% 70px,
    #fbfcfb;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sparkline-wrap {
  width: 100%;
  height: 134px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.text-action {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--teal);
  font-weight: 800;
}

.text-action:hover {
  border-color: rgba(19, 123, 134, 0.55);
  background: var(--surface-alt);
}

.trend-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.trend-list li {
  display: grid;
  grid-template-columns: 64px 1fr 72px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.trend-list li:last-child {
  border-bottom: 0;
}

.trend-list .empty-trend {
  display: block;
  color: var(--muted);
  text-align: center;
}

.trend-list span {
  color: var(--muted);
}

.trend-list strong {
  text-align: right;
}

.trend-bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-alt);
}

.trend-bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--move-width);
  border-radius: 999px;
  background: var(--move-color);
  transform: translateX(var(--move-shift));
}

.news-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.news-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filter-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.filter-button.active,
.filter-button:hover {
  border-color: rgba(19, 123, 134, 0.5);
  background: #173b36;
  color: #fff;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.news-card {
  display: grid;
  min-height: 184px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(30, 41, 36, 0.05);
}

.news-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.news-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 850;
}

.news-time {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.news-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.32;
  letter-spacing: 0;
}

.news-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.48;
}

.news-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: end;
  margin-top: 16px;
}

.stock-chip {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
}

.stock-chip:hover {
  border-color: rgba(19, 123, 134, 0.55);
  color: var(--teal);
}

@media (max-width: 1180px) {
  .market-strip,
  .search-band,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .ticker-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .chart-panel {
    grid-column: 1 / -1;
  }

  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px 12px 28px;
  }

  .ticker-rail,
  .dashboard-grid,
  .news-grid,
  .session-summary,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .brand-block,
  .panel-header,
  .section-heading {
    align-items: flex-start;
  }

  .brand-block,
  .panel-header,
  .section-heading,
  .session-summary {
    flex-direction: column;
  }

  .session-summary {
    display: grid;
  }

  .chart-frame {
    height: 340px;
  }

  .price-stack {
    text-align: left;
  }

  .suggestion {
    grid-template-columns: 72px 1fr;
  }

  .suggestion small {
    grid-column: 1 / -1;
  }

  .news-filters {
    justify-content: flex-start;
  }
}
