:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0ea;
  --brand: #d93025;
  --brand-dark: #a82019;
  --green: #147a47;
  --blue: #2663d9;
  --gold: #a56a00;
  --soft-red: #fff1ef;
  --soft-blue: #eef4ff;
  --soft-green: #ebf8f1;
  --shadow: 0 16px 38px rgba(39, 56, 84, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  font-size: 22px;
}

.market-pulse {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.market-pulse span {
  min-width: 152px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-red);
  color: var(--muted);
  font-size: 14px;
}

.market-pulse strong {
  color: var(--brand);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px clamp(14px, 4vw, 48px) 42px;
}

.strategy-panel,
.results-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.strategy-panel {
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 20px;
  position: sticky;
  top: 16px;
}

.section-title {
  min-width: 0;
}

.strategy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.strategy-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 74px;
  padding: 12px;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.strategy-button strong,
.strategy-button span {
  display: block;
}

.strategy-button strong {
  margin-bottom: 5px;
  font-size: 15px;
}

.strategy-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.strategy-button.active {
  border-color: var(--brand);
  background: var(--soft-red);
}

.strategy-button:hover {
  transform: translateY(-1px);
}

.filter-card {
  display: grid;
  gap: 8px;
}

.filter-card label,
.label-text {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input[type="search"],
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.range-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

output {
  color: var(--brand);
  font-weight: 750;
}

input[type="range"] {
  accent-color: var(--brand);
  width: 100%;
}

.toggle-row {
  display: grid;
  gap: 9px;
}

.toggle-row label {
  align-items: center;
  display: flex;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.toggle-row input {
  accent-color: var(--brand);
}

.primary-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 750;
}

.results-panel {
  min-width: 0;
  padding: 20px;
}

.results-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.summary span,
.signal,
.risk-tag {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
}

.summary span {
  background: var(--soft-blue);
  color: var(--blue);
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.insight {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 86px;
  padding: 14px;
}

.insight span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.insight strong {
  display: block;
  font-size: 20px;
}

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

table {
  border-collapse: collapse;
  min-width: 820px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

td {
  font-size: 14px;
}

.stock-name strong,
.stock-name span {
  display: block;
}

.stock-name span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.score {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 110px;
}

.score-bar {
  background: #e8edf4;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 62px;
}

.score-bar i {
  background: var(--brand);
  display: block;
  height: 100%;
}

.up {
  color: var(--brand);
  font-weight: 750;
}

.down {
  color: var(--green);
  font-weight: 750;
}

.signal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.signal {
  background: var(--soft-blue);
  color: var(--blue);
}

.risk-tag {
  background: var(--soft-green);
  color: var(--green);
  white-space: nowrap;
}

.risk-tag.watch {
  background: #fff7e8;
  color: var(--gold);
}

.empty-state {
  color: var(--muted);
  padding: 34px 12px;
  text-align: center;
}

.mobile-list {
  display: none;
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-pulse {
    justify-content: flex-start;
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .strategy-panel {
    position: static;
  }

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

@media (max-width: 640px) {
  .topbar {
    padding-top: 22px;
  }

  .market-pulse span {
    flex: 1 1 100%;
  }

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

  .results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary {
    justify-content: flex-start;
  }

  .table-wrap {
    display: none;
  }

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

  .stock-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
  }

  .stock-card-head {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
  }

  .stock-card .signal-list {
    margin: 12px 0;
  }
}
