:root {
  --bg: #f4efe7;
  --bg-strong: #efe6d8;
  --surface: rgba(255, 252, 247, 0.78);
  --surface-strong: #fffaf2;
  --ink: #1e2430;
  --muted: #6e7583;
  --line: rgba(30, 36, 48, 0.09);
  --positive: #1f8f5f;
  --negative: #c2553d;
  --warning: #b88016;
  --accent: #0f6c78;
  --accent-soft: #d7eef0;
  --shadow: 0 18px 60px rgba(61, 53, 39, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 108, 120, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(184, 128, 22, 0.15), transparent 24%),
    linear-gradient(180deg, #fbf8f2 0%, #f2ebdf 100%);
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel,
.info-card,
.chart-card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 40px;
  border-radius: var(--radius-xl);
}

.eyebrow,
.panel-kicker,
.chart-label,
.info-title {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.5rem, 2vw, 2rem);
}

h3 {
  font-size: 1.15rem;
}

.hero-text {
  max-width: 62ch;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.data-status {
  margin: 16px 0 0;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}

.refresh-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-actions,
.journal-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-action {
  background: linear-gradient(135deg, #105f69, #0f7d73);
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 108, 120, 0.25);
}

.secondary-action {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-action:hover,
.secondary-action:hover,
.watchlist-item:hover {
  transform: translateY(-2px);
}

.small {
  padding: 10px 14px;
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  justify-content: space-between;
}

.hero-card-header,
.panel-header,
.chart-head,
.watchlist-item,
.detail-topline,
.signal-row,
.mini-stats,
.watchlist-summary,
.chart-tools,
.range-toggle {
  display: flex;
  align-items: center;
}

.hero-card-header,
.panel-header,
.chart-head {
  justify-content: space-between;
}

.chart-tools {
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.range-toggle {
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.range-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.range-button.active {
  background: var(--accent);
  color: #fff;
}

.label-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(15, 108, 120, 0.28);
  background: rgba(215, 238, 240, 0.9);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: help;
  z-index: 20;
}

.tooltip:hover,
.tooltip:focus,
.tooltip:focus-within {
  z-index: 60;
}

.tooltip-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(240px, 70vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: #1e2430;
  color: #f7f4ee;
  box-shadow: 0 14px 28px rgba(30, 36, 48, 0.22);
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  z-index: 10;
}

.tooltip:hover .tooltip-tip,
.tooltip:focus-within .tooltip-tip,
.tooltip:focus .tooltip-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip-tip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  background: #1e2430;
  transform: translateX(-50%) rotate(45deg);
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pulse-card,
.summary-card {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.pulse-card strong,
.summary-card strong,
.metric-value {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.compare-panel {
  margin-bottom: 24px;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.macro-summary {
  margin: 14px 0 0;
  color: var(--muted);
}

.macro-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.macro-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.68);
}

.macro-card strong {
  display: block;
  margin-bottom: 6px;
  font-family: 'Space Grotesk', sans-serif;
}

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

.compare-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.compare-card h3 {
  font-size: 1.1rem;
}

.compare-metric {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.compare-metric:last-child {
  border-bottom: 0;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.panel-badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.watchlist-summary {
  gap: 12px;
  margin: 18px 0;
}

.summary-card {
  flex: 1;
}

.watchlist {
  display: grid;
  gap: 12px;
}

.watchlist-item {
  width: 100%;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.52);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.watchlist-item.active {
  border-color: rgba(15, 108, 120, 0.25);
  background: rgba(215, 238, 240, 0.82);
}

.watchlist-item strong,
.price-value,
.percent-move {
  font-family: 'Space Grotesk', sans-serif;
}

.watchlist-meta,
.stock-meta,
.metric-label,
.chip,
.signal-note,
#journal-status {
  color: var(--muted);
}

.detail-panel {
  display: grid;
  gap: 20px;
}

.detail-topline {
  flex-wrap: wrap;
  gap: 16px;
}

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

.score-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.score-card strong {
  display: block;
  margin-top: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
}

.score-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.92rem;
}

.metric-card {
  min-width: 140px;
  flex: 1;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.chart-card {
  position: relative;
  border-radius: var(--radius-xl);
  padding: 22px;
}

.mini-stats {
  gap: 10px;
  flex-wrap: wrap;
}

.mini-stat {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.86rem;
}

#chart {
  width: 100%;
  height: 240px;
  margin-top: 18px;
  overflow: visible;
}

.chart-hover-tip {
  position: absolute;
  min-width: 108px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 36, 48, 0.94);
  color: #f7f4ee;
  box-shadow: 0 14px 28px rgba(30, 36, 48, 0.24);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  z-index: 5;
}

.chart-hover-tip strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
}

.chart-hover-tip span {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: rgba(247, 244, 238, 0.82);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  overflow: visible;
}

.info-card {
  position: relative;
  overflow: visible;
  padding: 20px;
  border-radius: var(--radius-lg);
  z-index: 1;
}

.info-card:hover,
.info-card:focus-within {
  z-index: 50;
}

.wide-card {
  grid-column: 1 / -1;
}

.chip-list,
.signal-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.signal-stack {
  flex-direction: column;
}

.news-list {
  display: grid;
  gap: 12px;
}

.earnings-list,
.driver-list,
.checklist-list,
.journal-timeline {
  display: grid;
  gap: 12px;
}

.checklist-summary {
  margin-bottom: 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
}

.checklist-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}

.checklist-item strong {
  display: block;
  margin-bottom: 6px;
}

.checklist-badge {
  white-space: nowrap;
  align-self: flex-start;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.earnings-item,
.driver-item,
.timeline-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}

.earnings-item strong,
.driver-item strong,
.timeline-item strong {
  display: block;
  margin-bottom: 6px;
}

.timeline-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.news-item {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item strong {
  display: block;
  line-height: 1.45;
}

.news-source {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.signal-row {
  position: relative;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.signal-score {
  position: relative;
  z-index: 2;
}

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

.signal-label {
  font-weight: 700;
}

.signal-score {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.score-bullish {
  color: var(--positive);
  background: rgba(31, 143, 95, 0.12);
}

.score-neutral {
  color: var(--warning);
  background: rgba(184, 128, 22, 0.12);
}

.score-bearish {
  color: var(--negative);
  background: rgba(194, 85, 61, 0.12);
}

.journal-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(250, 245, 236, 0.92);
  color: var(--ink);
}

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

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

.neutral {
  color: var(--warning);
}

@media (max-width: 1080px) {
  .hero,
  .macro-grid,
  .layout-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

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

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

  .app-shell {
    width: min(100% - 24px, 1080px);
  }
}

@media (max-width: 640px) {
  .hero-copy,
  .hero-card,
  .panel,
  .chart-card,
  .info-card {
    padding: 18px;
  }

  h1 {
    max-width: 12ch;
  }

  .watchlist-summary,
  .detail-topline,
  .hero-actions,
  .score-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .score-strip {
    display: flex;
  }

  .chart-tools {
    justify-content: flex-start;
  }

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

  .macro-cards,
  .checklist-item {
    grid-template-columns: 1fr;
  }

  .checklist-item {
    display: grid;
  }
}
