:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --gain: #0d9e6e;
  --loss: #d93025;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --border: #dadce0;
  --bg: #f8f9fa;
  --card-bg: #fff;
  --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Google Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 560px;
}

.search-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 0 16px 0 40px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2380868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 12px center / 16px no-repeat;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
  background-color: #fff;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  overflow: hidden;
  z-index: 200;
}

.search-dropdown.open { display: block; }

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  transition: background .1s;
  cursor: pointer;
}

.search-result:hover { background: var(--bg); }

.sr-ticker {
  font-weight: 700;
  font-size: 13px;
  min-width: 48px;
  color: var(--text);
}

.sr-name {
  flex: 1;
  color: var(--text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-price {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
}

.sr-chg { font-weight: 400; font-size: 12px; }

.header-nav { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }

.nav-link {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background .1s, color .1s;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: #e8f0fe; color: var(--blue); }

/* ── Colors ── */
.gain { color: var(--gain); }
.loss { color: var(--loss); }

/* ── Page layout ── */
.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* ── Market strip ── */
.market-strip-wrap {
  background: #fff;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.strip-cards {
  display: flex;
  gap: 0;
  overflow-x: auto;
  max-width: 1200px;
  margin: 0 auto;
  scrollbar-width: none;
}

.strip-cards::-webkit-scrollbar { display: none; }

.strip-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 20px;
  min-width: 160px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  transition: background .1s;
  cursor: pointer;
}

.strip-card:hover { background: var(--bg); }
.strip-card--index { background: #f1f3f4; }
.strip-card--index:hover { background: #e8eaed; }

.strip-name { font-size: 13px; font-weight: 600; color: var(--text); }
.strip-meta { font-size: 11px; color: var(--text-tertiary); }
.strip-sparkline { margin: 4px 0; line-height: 0; }

.strip-price {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.strip-price span { font-weight: 600; font-size: 12px; }

/* ── Section titles ── */
.section-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
}

/* ── Stock cards (watchlist) ── */
.cards-grid {
  display: grid;
  gap: 12px;
}

.cards-grid--watchlist { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

#watchlist-section, #trending-section { margin-bottom: 32px; }

.stock-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  transition: box-shadow .15s;
  cursor: pointer;
}

.stock-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }

.sc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.sc-name { font-size: 13px; font-weight: 600; color: var(--text); }
.sc-ticker { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.sc-change { font-size: 13px; font-weight: 600; flex-shrink: 0; }
.sc-sparkline { line-height: 0; }
.sc-price { font-size: 13px; color: var(--text); }
.sc-price span { font-weight: 600; font-size: 12px; }

/* ── Stocks table ── */
.stocks-table {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.stocks-table-head {
  display: grid;
  grid-template-columns: 1fr repeat(4, 100px) 130px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stocks-table-row {
  display: grid;
  grid-template-columns: 1fr repeat(4, 100px) 130px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background .1s;
  cursor: pointer;
}

.stocks-table-row:last-child { border-bottom: none; }
.stocks-table-row:hover { background: #f8f9ff; }

.col-name { display: flex; flex-direction: column; gap: 2px; }
.col-ticker { font-weight: 700; font-size: 14px; }
.col-fullname { font-size: 12px; color: var(--text-secondary); }
.col-num { text-align: right; font-size: 13px; font-weight: 500; }
.col-chart { display: flex; justify-content: flex-end; line-height: 0; }
.tbl-sparkline { display: inline-block; }

/* ── Chart card ── */
.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.range-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
}

.range-tab {
  padding: 5px 12px;
  border: none;
  background: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .1s, color .1s;
}

.range-tab:hover { background: var(--bg); color: var(--text); }
.range-tab.active { background: #e8f0fe; color: var(--blue); }

.chart-container { min-height: 280px; }

/* ── Stock detail page ── */
.breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--blue); }
.breadcrumb a:hover { text-decoration: underline; }

.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}

.stock-name { font-size: 24px; font-weight: 400; color: var(--text); }
.stock-exchange { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.watchlist-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .1s, border-color .1s, color .1s;
}

.watchlist-btn:hover { background: var(--bg); }
.watchlist-btn.in-list { background: #e8f0fe; border-color: var(--blue); color: var(--blue); }

.stock-price-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stock-price-big { font-size: 32px; font-weight: 400; color: var(--text); }
.stock-change-big { font-size: 16px; font-weight: 500; }
.price-label { font-size: 12px; color: var(--text-tertiary); align-self: center; }

.stock-directory-title { margin-bottom: 16px; }

.stock-directory {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 560px;
}

.stock-directory-row {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.stock-directory-row:last-child { border-bottom: none; }
.stock-directory-row:hover { background: #f8f9ff; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.stat-item {
  padding: 14px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-item--range {
  grid-column: 1 / -1;
  border-right: none;
}

.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 14px; font-weight: 500; color: var(--text); }

.range-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.range-low, .range-high { font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }

.range-bar {
  flex: 1;
  height: 4px;
  background: linear-gradient(to right, var(--loss), var(--gain));
  border-radius: 2px;
  position: relative;
}

.range-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--blue);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* ── About / News cards ── */
.detail-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.detail-card h2 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text);
}

.detail-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.company-meta {
  display: flex;
  gap: 24px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.news-item {
  display: block;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  transition: background .1s;
}

.news-item:first-of-type { border-top: none; }
.news-item:hover .news-headline { color: var(--blue); }

.news-headline { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.news-meta { font-size: 12px; color: var(--text-tertiary); }

/* ── Empty state ── */
.empty-note { font-size: 14px; color: var(--text-secondary); }

/* ── Responsive ── */
@media (max-width: 700px) {
  .stocks-table-head,
  .stocks-table-row {
    grid-template-columns: 1fr 90px 90px 130px;
  }
  .stocks-table-head span:nth-child(3),
  .stocks-table-row span:nth-child(3),
  .stocks-table-head span:nth-child(5),
  .stocks-table-row span:nth-child(5) { display: none; }

  .stock-price-big { font-size: 26px; }
  .stock-name { font-size: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
