:root {
  --ink: #0f172a;
  --muted: #64748b;
  --paper: #f8fafc;
  --card: #ffffff;
  --navy: #0f3d63;
  --emerald: #10b981;
  --emerald-bg: #ecfdf5;
  --rose: #ef4444;
  --rose-bg: #fef2f2;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --radius: 16px;
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Financial Marquee Ticker Tape */
.ticker-tape {
  width: 100%;
  overflow: hidden;
  background: #090e17;
  color: #e2e8f0;
  font-size: 0.78rem;
  padding: 9px 0;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 50;
}

.ticker-inner {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  animation: tickerSlide 35s linear infinite;
  width: max-content;
}

.ticker-inner:hover {
  animation-play-state: paused;
}

@keyframes tickerSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ticker-symbol {
  color: #94a3b8;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.ticker-price {
  font-weight: 600;
  color: #f8fafc;
}

.ticker-up {
  color: #34d399;
  font-weight: 600;
}

.ticker-down {
  color: #f87171;
  font-weight: 600;
}

main {
  width: min(1200px, calc(100% - 32px));
  margin: auto;
  padding: 36px 0 90px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 32px;
  align-items: end;
  margin: 24px 0 40px;
}

.hero-badges {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.badge-market {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  background: var(--emerald-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
  transition: all 0.2s ease;
}

.badge-market.closed {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.free-tag {
  padding: 5px 12px;
  border-radius: 99px;
  color: #0369a1;
  background: #e0f2fe;
  font-size: 0.72rem;
  font-weight: 750;
  border: 1px solid #bae6fd;
}

.hero h1 {
  margin: 0;
  font: 600 clamp(2.3rem, 5vw, 4rem) / 1.05 Georgia, serif;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.hero h1 em {
  color: #047857;
  font-style: italic;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.market-clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--navy);
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: #154c78;
  transform: translateY(-1px);
}

.section-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-top h2 {
  margin: 0;
  font: 600 clamp(1.4rem, 2.5vw, 1.8rem) Georgia, serif;
}

/* Benchmark Indices Grid */
.indices-section {
  margin-bottom: 45px;
}

.indices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 20px;
}

.index-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.index-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px -6px rgba(15, 23, 42, 0.08);
}

.index-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.index-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.index-tag {
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 600;
}

.index-price {
  font: 700 1.9rem Georgia, serif;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.index-change {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 750;
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}

.index-change.up {
  color: #065f46;
  background: var(--emerald-bg);
}

.index-change.down {
  color: #991b1b;
  background: var(--rose-bg);
}

.range-wrap {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.range-bar {
  height: 5px;
  border-radius: 3px;
  background: #e2e8f0;
  overflow: hidden;
  position: relative;
}

.range-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #047857);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.index-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 8px;
}

/* Bluechip Watchlist Table Card */
.watchlist-section {
  margin-bottom: 45px;
}

.equities-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.equities-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 16px;
}

.equities-title {
  margin: 0;
  font: 600 1.25rem Georgia, serif;
}

.equities-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.search-wrap {
  max-width: 100%;
  flex: 1 1 200px;
}

.search-wrap input {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 1rem; /* 16px to prevent iOS Safari auto-zoom */
  width: 100%;
  max-width: 260px;
  outline: none;
  background: #f8fafc;
  touch-action: manipulation;
}

.search-wrap input:focus {
  border-color: #047857;
  background: #ffffff;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.stocks-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.stocks-table th {
  padding: 13px 22px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
}

.stocks-table td {
  padding: 15px 22px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.stocks-table tr:hover td {
  background: #f8fafc;
}

.num-col {
  text-align: right;
}

.stock-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.75rem;
}

.stock-pill.up {
  color: #065f46;
  background: var(--emerald-bg);
}

.stock-pill.down {
  color: #991b1b;
  background: var(--rose-bg);
}

.stock-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  font-size: 0.74rem;
  color: #475569;
}

/* Interactive Calculator & Sector Highlights Grid */
.tools-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  margin-bottom: 45px;
}

.calc-card, .sectors-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.card-header-flex {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.card-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.card-header-flex h3 {
  margin: 0;
  font: 600 1.2rem Georgia, serif;
}

.card-header-flex p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.calc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.form-row input,
.form-row select {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 1rem; /* 16px to prevent iOS Safari auto-zoom */
  font-weight: 600;
  color: var(--ink);
  background: #f8fafc;
  touch-action: manipulation;
}

.calc-result {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.calc-line strong {
  color: var(--ink);
  font-weight: 700;
}

.calc-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--ink);
}

.calc-total strong.profit {
  color: #047857;
}

.calc-total strong.loss {
  color: #b91c1c;
}

/* Sectors Weight List */
.sectors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sector-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.sector-row .sector-weight {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 6px;
}

.sector-row .sector-trend {
  font-weight: 700;
  font-size: 0.8rem;
}

.sector-row .sector-trend.up {
  color: #047857;
}

.sector-row .sector-trend.down {
  color: #b91c1c;
}

/* Cross-Tool Banner back to Tool 10 */
.cross-nav-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 45px;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.08);
  flex-wrap: wrap;
}

.cross-nav-text h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 750;
  color: #92400e;
}

.cross-nav-text p {
  margin: 0;
  font-size: 0.85rem;
  color: #78350f;
}

.btn-cross-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  background: #b45309;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-cross-nav:hover {
  background: #92400e;
  transform: translateX(2px);
  color: #ffffff;
}

/* Site Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
}
