@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Mobile-First Design System ─────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #065F46;
  --primary-dark:   #044E39;
  --primary-light:  #ECFDF5;

  /* Layout */
  --max-width:      840px;
  --header-h:       96px;   /* topbar (56px) + filter pill row (~40px) */

  /* Surface */
  --bg:             #FFFFFF;
  --card-bg:        #FFFFFF;
  --surface:        #F9FAFB;
  --border:         #E5E7EB;
  --border-subtle:  #F3F4F6;

  /* Text */
  --text:           #111827;
  --text-muted:     #6B7280;
  --text-xs:        #9CA3AF;

  /* Signal: Earnings (S1) */
  --sig-earnings-text:   #16A34A;
  --sig-earnings-bg:     #F0FDF4;
  --sig-earnings-border: #BBF7D0;

  /* Signal: Contract / Orders (S7) */
  --sig-contract-text:   #2563EB;
  --sig-contract-bg:     #EFF6FF;
  --sig-contract-border: #BFDBFE;

  /* Signal: Block Deals (S12) */
  --sig-blockdeal-text:   #7C3AED;
  --sig-blockdeal-bg:     #F5F3FF;
  --sig-blockdeal-border: #DDD6FE;

  /* Signal: Insider Activity (S3) */
  --sig-insider-text:   #EA580C;
  --sig-insider-bg:     #FFF7ED;
  --sig-insider-border: #FED7AA;

  /* Signal: Negative — Regulatory / Rating / Litigation (S4, S8, S10) */
  --sig-negative-text:   #DC2626;
  --sig-negative-bg:     #FEF2F2;
  --sig-negative-border: #FECACA;

  /* Signal: M&A (S2) */
  --sig-ma-text:   #0D9488;
  --sig-ma-bg:     #F0FDFA;
  --sig-ma-border: #99F6E4;

  /* Signal: Dividend / Buyback (S5) */
  --sig-dividend-text:   #0891B2;
  --sig-dividend-bg:     #ECFEFF;
  --sig-dividend-border: #A5F3FC;

  /* Signal: Institutional (S11) */
  --sig-institutional-text:   #4F46E5;
  --sig-institutional-bg:     #EEF2FF;
  --sig-institutional-border: #C7D2FE;

  /* Signal: Management (S6) */
  --sig-management-text:   #B45309;
  --sig-management-bg:     #FFFBEB;
  --sig-management-border: #FDE68A;

  /* Signal: Default / Fundraise (S9, unknown) */
  --sig-default-text:   #4B5563;
  --sig-default-bg:     #F9FAFB;
  --sig-default-border: #E5E7EB;

  /* Backward compat urgency classes */
  --high-bg:     #FEF2F2;
  --high-text:   #DC2626;
  --medium-bg:   #FFFBEB;
  --medium-text: #D97706;
  --routine-bg:  #F9FAFB;
  --routine-text:#4B5563;

  /* Summary / card surface (was missing — fixed transparent light-mode issue) */
  --summary-bg: #F9FAFB;
}

/* ── Dark Mode ───────────────────────────────────────────────────────────── */
body.dark-mode {
  --bg:            #0F172A;
  --card-bg:       #1E293B;
  --summary-bg:    #1E293B;
  --border:        #334155;
  --border-subtle: #1E293B;
  --text:          #F1F5F9;
  --text-muted:    #94A3B8;
  --text-xs:       #64748B;
}

/* Dark mode: keep header surface consistent */
body.dark-mode .site-header { box-shadow: 0 1px 8px rgba(0,0,0,0.4); }
body.dark-mode .logo { color: #34D399; } /* lighter emerald on dark bg */

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

img { max-width: 100%; height: auto; display: block; }

/* ── Mobile-First Top Navigation Bar ─────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding-top: env(safe-area-inset-top);
}

.topbar {
  background: var(--bg);
}

.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  justify-content: flex-start;
  width: 100%;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-mark {
  font-size: 0.85rem;
  color: var(--primary);
  line-height: 1;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #DC2626;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #DC2626;
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* Today page indicator — sits in topbar-right before the icon buttons */
.topbar-today {
  display: none;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
  transition: color 0.15s;
}

.topbar-today.active {
  color: var(--primary);
}

.topbar-today:hover {
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Icon-only buttons (refresh, dark mode) */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}
.search-svg { color: var(--text); }
.icon-btn:hover {
  background: var(--summary-bg);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.icon-btn:hover .search-svg { color: var(--primary); }
/* ── Utility Classes ─────────────────────────────────────────────────────── */
.desktop-only { display: none !important; }
.mobile-only  { display: flex !important; }

@media (min-width: 640px) {
  .desktop-only { display: flex !important; }
  .mobile-only  { display: none !important; }
}

/* ── Mobile Menu Toggle Button ────────────────────────────────────────────── */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 150ms ease-out, color 150ms ease-out;
  touch-action: manipulation;
}

.menu-toggle:hover {
  background: var(--surface);
  color: var(--primary);
}

.menu-toggle:active {
  background: var(--border);
}

/* ── Mobile Menu Drawer ──────────────────────────────────────────────────── */
.menu-drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 250ms ease-out;
  z-index: 999;
}

.menu-drawer.open {
  max-height: 500px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body.dark-mode .menu-drawer.open {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.menu-nav {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.menu-nav.menu-signals {
  padding: 12px 0;
}

.menu-label {
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-xs);
}

.menu-link,
.menu-signal-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  font-family: inherit;
  transition: background 150ms ease-out, color 150ms ease-out;
  cursor: pointer;
  touch-action: manipulation;
}

.menu-link:hover,
.menu-signal-link:hover {
  background: var(--surface);
  color: var(--primary);
}

.menu-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* ── Desktop Top Navigation (hidden on mobile) ───────────────────────────── */

/* ── Category Nav: Signal Filters ──────────────────────────────────────── */
.category-nav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav-inner {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 1.25rem;
  white-space: nowrap;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

/* Pill-style filter tabs */
.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid transparent;
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  touch-action: manipulation;
  scroll-snap-align: start;
}

.cat-tab:hover {
  background: var(--summary-bg);
  color: var(--text);
  border-color: var(--border);
}

.cat-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 1px 6px rgba(6, 95, 70, 0.25);
}

/* Per-category signal colour dot */
.cat-tab::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.7;
}
.cat-tab[data-filter="all"]::before          { display: none; }
.cat-tab[data-filter="breaking"]::before     { background: #DC2626; }
.cat-tab[data-filter="analysis"]::before     { background: var(--sig-ma-text); }
.cat-tab[data-filter="event"]::before        { background: var(--sig-earnings-text); }
.cat-tab[data-filter="roundup"]::before      { background: var(--sig-management-text); }

/* Active tab — dot turns white */
.cat-tab.active::before { background: rgba(255,255,255,0.75); opacity: 1; }

/* Topbar search: hidden on mobile (search lives in bottom-nav instead) */
@media (max-width: 639px) {
  /* Compact filter pills on mobile */
  .category-nav-inner {
    justify-content: flex-start;
    padding: 6px 1rem;
    gap: 5px;
  }
  .cat-tab {
    padding: 0.28rem 0.7rem;
    font-size: 0.72rem;
  }
}

/* Dark mode */
body.dark-mode .cat-tab:hover { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .cat-tab.active { box-shadow: 0 1px 8px rgba(52, 211, 153, 0.2); }

main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content-wrapper,
.feed-container,
.article-page-container,
.news-article {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.25rem 5rem; /* Added 1rem top padding */
}

.article-page-container {
  max-width: var(--max-width); /* Simplified */
}

/* ── Time Bucket Labels ──────────────────────────────────────────────────── */
.time-bucket {
  margin-top: 1.75rem;
}
.time-bucket:first-child { margin-top: 0.75rem; }

.bucket-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-xs);
  padding-bottom: 0.6rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Feed Card ───────────────────────────────────────────────────────────── */
.feed-card {
  display: block;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: background 0.1s, padding 0.1s, margin 0.1s;
  touch-action: manipulation;
}
.feed-card:hover {
  background: var(--summary-bg);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}
.feed-card:last-child { border-bottom: none; }

.feed-card:active,
.cluster-card:active {
  transform: scale(0.985);
  transition: transform 100ms ease-out;
}

.card-headline {
  font-size: 0.97rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-card:hover .card-headline { color: var(--primary); }

.card-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.45rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-insight {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-content-wrapper {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-text {
  flex: 1;
  min-width: 0; /* allow flex child to shrink below content size */
}

.card-image-box {
  width: 100px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--summary-bg);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-hero-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
  width: 100%;
}

.article-hero-image {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 12px;
  background: var(--summary-bg);
  border: 1px solid var(--border);
  display: block;
}

.image-attribution {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  padding: 0.3rem 0.6rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.68rem;
  border-radius: 6px;
  line-height: 1;
  pointer-events: auto;
  z-index: 10;
  transition: opacity 0.2s ease;
}

.image-attribution a {
  color: #FFFFFF;
  font-weight: 600;
  text-decoration: none;
  opacity: 0.9;
}

.image-attribution a:hover {
  opacity: 1;
  text-decoration: underline;
}

@media (hover: hover) {
  .image-attribution { opacity: 0; }
  .article-hero-wrapper:hover .image-attribution { opacity: 1; }
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-time {
  font-size: 0.72rem;
  color: var(--text-xs);
}

.card-confidence {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Signal Group Specific Styles ────────────────────────────────────────── */
.sig-group-market-moves { border-left: 3px solid var(--sig-ma-border); }
.sig-group-triggers     { border-left: 3px solid var(--sig-earnings-border); }
.sig-group-payouts      { border-left: 3px solid var(--sig-dividend-border); }
.sig-group-insights     { border-left: 3px solid var(--sig-management-border); }

.feed-card.sig-group-market-moves, 
.feed-card.sig-group-triggers, 
.feed-card.sig-group-payouts, 
.feed-card.sig-group-insights {
  padding-left: 1rem;
}

/* ── Search Overlay ──────────────────────────────────────────────────────── */
.search-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(12px);
  z-index: 2000; display: none; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
}
.search-overlay.active { display: flex; }
.search-modal {
  width: 90%; max-width: 600px; background: var(--card-bg, #fff);
  border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  overflow: hidden; border: 1px solid var(--border);
  animation: modal-pop 0.2s ease-out;
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.search-input-wrapper {
  display: flex; align-items: center; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border); gap: 1rem;
}
.search-icon { color: var(--primary); opacity: 0.8; }
#search-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 1.1rem; font-weight: 500; color: var(--text);
  font-family: inherit; padding: 0.5rem 0;
}
#search-input::placeholder { color: var(--text-xs); }
#search-close {
  background: var(--border-subtle); border: none; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; cursor: pointer;
  font-size: 1.2rem; transition: all 0.2s;
}
#search-close:hover { background: var(--border); color: var(--text); transform: rotate(90deg); }
.search-results { max-height: 65vh; overflow-y: auto; padding: 0.5rem 0; }
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.search-hint { padding: 3rem 2rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.search-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 1.25rem; text-decoration: none; color: inherit;
  transition: background 0.2s; border-bottom: 1px solid var(--border-subtle);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--summary-bg); }
.search-item-name { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.search-item-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.search-item-scrip { font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
body.dark-mode .search-item-scrip { background: rgba(52, 211, 153, 0.1); color: #34D399; }

/* Signal badge base style - pill-shaped tags matching header tabs */
.signal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.signal-badge.sig-earnings     { color: var(--sig-earnings-text);     background: var(--sig-earnings-bg);     border-color: var(--sig-earnings-border); }
.signal-badge.sig-contract     { color: var(--sig-contract-text);     background: var(--sig-contract-bg);     border-color: var(--sig-contract-border); }
.signal-badge.sig-blockdeal    { color: var(--sig-blockdeal-text);    background: var(--sig-blockdeal-bg);    border-color: var(--sig-blockdeal-border); }
.signal-badge.sig-insider      { color: var(--sig-insider-text);      background: var(--sig-insider-bg);      border-color: var(--sig-insider-border); }
.signal-badge.sig-regulatory,
.signal-badge.sig-rating,
.signal-badge.sig-litigation   { color: var(--sig-negative-text);     background: var(--sig-negative-bg);     border-color: var(--sig-negative-border); }
.signal-badge.sig-ma           { color: var(--sig-ma-text);           background: var(--sig-ma-bg);           border-color: var(--sig-ma-border); }
.signal-badge.sig-dividend     { color: var(--sig-dividend-text);     background: var(--sig-dividend-bg);     border-color: var(--sig-dividend-border); }
.signal-badge.sig-institutional{ color: var(--sig-institutional-text);background: var(--sig-institutional-bg);border-color: var(--sig-institutional-border); }
.signal-badge.sig-management   { color: var(--sig-management-text);   background: var(--sig-management-bg);   border-color: var(--sig-management-border); }
.signal-badge.sig-default,
.signal-badge.sig-fundraise    { color: var(--sig-default-text);      background: var(--sig-default-bg);      border-color: var(--sig-default-border); }

/* Backward-compat urgency classes */
.signal-badge.high    { color: var(--high-text);    background: var(--high-bg); }
.signal-badge.medium  { color: var(--medium-text);  background: var(--medium-bg); }
.signal-badge.routine { color: var(--routine-text); background: var(--routine-bg); }

/* ── Cluster Card ────────────────────────────────────────────────────────── */
.cluster-card {
  display: block;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.9rem 0;
  color: inherit;
  text-decoration: none;
  transition: background 0.1s, padding 0.1s, margin 0.1s;
  touch-action: manipulation;
}
.cluster-card:hover {
  background: var(--summary-bg);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin: 0 -0.5rem;
}
.cluster-card:hover .card-headline { color: var(--primary); }
.cluster-card:last-child { border-bottom: none; }


/* ── Feed Break ──────────────────────────────────────────────────────────── */
.feed-break {
  text-align: center;
  color: var(--text-xs);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 1.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.feed-break::before,
.feed-break::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Floating Back to Top ────────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: calc(3.5rem + env(safe-area-inset-bottom));
  right: 1.5rem;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(6,95,70,0.35);
  z-index: 999;
  transition: opacity 0.2s, transform 0.2s;
  touch-action: manipulation;
}
.back-to-top.visible { display: flex; }
.back-to-top:hover { transform: translateY(-2px); }

/* ── Update Banner ───────────────────────────────────────────────────────── */
.update-banner {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #FFFFFF;
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 998;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  white-space: nowrap;
}
.update-banner.visible { display: block; }

/* ── Empty Feed State ────────────────────────────────────────────────────── */
.empty-feed {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 3rem 0;
}

/* ── Article Page ────────────────────────────────────────────────────────── */
.news-article {
  padding: 1.5rem 1.25rem 4rem;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.article-back:hover { color: var(--primary); }

.article-header {
  margin-bottom: 1.25rem;
}

.metadata-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.company-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.company-link:hover { text-decoration: underline; }

.article-header h1 {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
}

.article-separator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.article-separator::before,
.article-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.share-wrapper {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.share-btn:hover {
  background: var(--primary-light, #f0f4ff);
  color: var(--primary);
  border-color: var(--primary);
}
.share-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 152px;
  z-index: 200;
  overflow: hidden;
}
.share-dropdown.open {
  display: block;
}
.share-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
}
.share-option:last-child {
  border-bottom: none;
}
.share-option:hover {
  background: var(--surface, #f5f5f5);
}

.article-byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.55rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin: 0.5rem 0 0.75rem;
}
.byline-author,
.byline-source,
.byline-date {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.byline-icon {
  opacity: 0.6;
  flex-shrink: 0;
}
.byline-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.byline-link:hover { text-decoration: underline; }
.byline-sep {
  color: var(--border);
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}

.header-disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--border-subtle);
  border-left: 3px solid var(--border);
  border-radius: 0 4px 4px 0;
  opacity: 0.85;
}

.article-summary {
  background: var(--summary-bg);
  padding: 1.1rem 1.25rem;
  border-radius: 10px;
  border-left: 4px solid var(--primary);
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--text);
  margin: 1.25rem 0 1.75rem;
}

.why-it-matters {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.key-figures {
  margin: 1.5rem 0;
}
.key-figures h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-xs);
  margin-bottom: 0.75rem;
}
.key-figures ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}
.key-figures li {
  background: var(--summary-bg);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.key-figures li strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.15rem;
}

.article-body {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--text);
}
.article-body h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
  color: var(--text);
}
.article-body h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.25rem 0 0.4rem;
}
.article-body p { margin: 0.75rem 0; }
.article-body ul, .article-body ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}
.article-body li { margin: 0.25rem 0; }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.88rem;
}
.article-body th, .article-body td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.article-body th {
  font-weight: 700;
  background: var(--summary-bg);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Article Blocks ────────────────────────────────────────────────────────── */
.block-summary {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 1rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  border-left: 4px solid var(--primary);
}

.block-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.metric-item {
  background: var(--summary-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.metric-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.metric-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.block-impact, .block-risks, .block-analyst, .block-watch, .block-about {
  margin: 2rem 0;
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.block-impact h3, .block-risks h3, .block-analyst h3, .block-watch h3, .block-about h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.block-impact { border-left: 4px solid #10B981; }
.block-risks { border-left: 4px solid #EF4444; }
.block-analyst { border-left: 4px solid #3B82F6; background: #F0F9FF; }
body.dark-mode .block-analyst { background: #0C4A6E33; }
.block-watch { border-left: 4px solid #F59E0B; }
.block-about { border-left: 4px solid var(--text-muted); background: var(--summary-bg); }

.block-timeline {
  margin: 1.5rem 0;
}

.block-timeline ul {
  list-style: none;
  padding: 0;
}

.block-timeline li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.9rem;
}

.block-timeline li:last-child { border-bottom: none; }

/* ── AI Disclosure ───────────────────────────────────────────────────────── */
.ai-disclosure {
  background: var(--summary-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 998;
  background: var(--bg);
  border-top: 1px solid var(--border-subtle);
  padding: 0.5rem 1.25rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  text-align: center;
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.site-footer .footer-links a {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

.site-footer .footer-links a:hover {
  color: var(--text);
}

.footer-copyright {
  margin: 0.3rem 0 0;
  font-size: 0.65rem;
  color: var(--text-xs);
}

/* Static pages: full non-fixed footer */
.site-footer--static {
  position: static;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.site-footer--static .footer-links {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 2rem;
}

.site-footer--static .footer-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 0.5rem;
}

.site-footer--static .footer-copyright {
  font-size: 0.72rem;
}

/* ── Bottom Navigation Bar (mobile only) ────────────────────────────────── */
.bottom-nav {
  display: none;
}

@media (max-width: 639px) {
  /* Hide the legacy fixed footer on mobile — replaced by bottom-nav */
  .site-footer {
    display: none;
  }

  /* Show bottom nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 998;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    box-shadow: 0 -1px 8px rgba(0,0,0,0.06);
  }

  body.dark-mode .bottom-nav {
    box-shadow: 0 -1px 8px rgba(0,0,0,0.3);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0.6rem 0.25rem;
    min-height: 56px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: inherit;
    transition: color 150ms ease-out;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item:active {
    opacity: 0.7;
    transform: scale(0.94);
    transition: transform 80ms ease-out, opacity 80ms ease-out;
  }

  .bottom-nav-item.active {
    color: var(--primary);
  }

  .bottom-nav-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-width 150ms ease-out;
  }

  .bottom-nav-item.active .bottom-nav-icon {
    stroke-width: 2.25;
  }

  .bottom-nav-label {
    line-height: 1;
  }

  body.dark-mode .bottom-nav-item       { color: var(--text-muted); }
  body.dark-mode .bottom-nav-item.active { color: #34D399; }

  /* Ensure last card isn't clipped by bottom-nav */
  .content-wrapper,
  .feed-container,
  .article-page-container,
  .news-article {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  }

  .profile-container {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  }
}

/* ── Company / Stock page ────────────────────────────────────────────────── */
.profile-container { width: 100%; max-width: 840px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.profile-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; gap: 1.5rem; flex-wrap: wrap; }
.profile-main { flex: 1; min-width: 300px; }
.profile-name { font-size: 2.25rem; font-weight: 800; color: var(--text); margin-bottom: 0.5rem; letter-spacing: -0.02em; }
.profile-meta { display: flex; gap: 0.75rem; align-items: center; }
.profile-stats { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.stat-item { display: flex; flex-direction: column; gap: 0.1rem; }
.stat-label { font-size: 0.65rem; color: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.profile-about h2, .profile-news h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 1.25rem; color: var(--text); display: flex; align-items: center; gap: 0.75rem; }
.profile-about h2::before, .profile-news h2::before { content: ""; display: block; width: 4px; height: 1.25rem; background: var(--primary); border-radius: 4px; }
.profile-about { margin-bottom: 3.5rem; line-height: 1.75; color: var(--text); font-size: 1.05rem; }
.mini-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.mini-card { padding: 1.25rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; transition: all 0.2s; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.75rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); touch-action: manipulation; }
.mini-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.mini-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); line-height: 1.4; margin: 0; }
.mini-card-footer { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; margin-top: auto; }

.scrip-tag, .sector-tag { font-size: 0.75rem; font-weight: 700; padding: 0.25rem 0.6rem; background: var(--summary-bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.scrip-tag { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
body.dark-mode .scrip-tag { background: rgba(52, 211, 153, 0.1); color: #34D399; border-color: rgba(52, 211, 153, 0.2); }


/* ── Mobile-only overrides (max 639px) ───────────────────────────────────── */
@media (max-width: 639px) {
  /* Profile page: prevent overflow on 375px phones */
  .profile-main  { min-width: 0; width: 100%; }
  .profile-name  { font-size: 1.6rem; letter-spacing: -0.01em; }
  .profile-stats { gap: 1rem; }
  .stat-value    { font-size: 1.2rem; }

  /* Article headline: scale down for narrow viewports */
  .article-header h1 { font-size: 1.35rem; line-height: 1.3; }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
/* Tablet and Desktop (640px and up) */
@media (min-width: 640px) {
  .topbar-today {
    display: inline-flex;
  }

  .market-page {
    padding: 24px 16px 60px 16px;
  }

  .market-title {
    font-size: 28px;
  }

  .market-subtitle {
    font-size: 14px;
  }

  .market-section-title {
    font-size: 18px;
  }

  .market-table {
    font-size: 14px;
  }

  .market-table th,
  .market-table td {
    padding: 10px;
  }

  .intraday-title {
    font-size: 15px;
  }

  .intraday-summary {
    font-size: 14px;
  }
}

/* ── Static Pages ────────────────────────────────────────────────────────── */
.static-page {
  padding: 4rem 1.25rem 6rem;
  max-width: 800px;
  margin: 0 auto;
}
.static-page h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.static-page h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text);
}
.static-page p {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.7;
}
.static-page ul {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}
.static-page li {
  margin-bottom: 0.5rem;
}
.static-page section {
  margin-bottom: 3rem;
}
.static-page a {
  color: var(--primary);
  text-decoration: underline;
}
body.dark-mode .static-page a {
  color: #34D399;
}

/* ── Market Page Styles (Mobile-First) ───────────────────────────────────── */

.market-page {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 16px 12px 60px 12px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.market-header {
  margin-bottom: 16px;
}

.market-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}

.market-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.5;
}

.market-disclaimer {
  font-size: 11px;
  color: var(--text-xs);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.4;
}

.market-fetched {
  font-size: 12px;
  color: var(--text-xs);
  margin: 6px 0 8px 0;
}

/* Market Navigation (Category Pills - Horizontal Scroll) */
.market-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.market-nav::-webkit-scrollbar {
  display: none;
}

.market-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  transition: all 150ms ease-out;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.market-tab:hover,
.market-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Dropdown for category tabs on mobile */
.market-dropdown {
  position: relative;
}

.market-dropdown-btn {
  display: none;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border-subtle);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.2s;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.market-dropdown-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Intraday Categories (Collapsible) */
.market-categories {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.market-categories-header {
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}

.market-categories-header:hover {
  background: var(--border-subtle);
}

.market-categories-toggle {
  display: inline-block;
  font-size: 10px;
  margin-left: 8px;
  transition: transform 150ms ease-out;
  flex-shrink: 0;
}

.market-categories.open .market-categories-toggle {
  transform: rotateX(180deg);
}

.market-categories-list {
  display: none;
  flex-direction: row;
  gap: 8px;
  padding: 12px;
  flex-wrap: wrap;
}

.market-categories.open .market-categories-list {
  display: flex;
}

.market-category-item {
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 150ms ease-out;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  touch-action: manipulation;
  white-space: nowrap;
}

.market-category-item:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.market-category-item.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

.market-category-checkbox {
  display: none;
}


.market-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.market-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.market-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.market-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.market-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card-bg);
}

.market-table thead {
  background: var(--surface);
  position: sticky;
  top: 0;
}

.market-table th {
  padding: 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.market-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  height: 48px;
  vertical-align: middle;
}

.market-table tbody tr:hover {
  background: var(--surface);
}

.mkt-symbol {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.mkt-company {
  display: block;
  font-size: 11px;
  color: var(--text-xs);
  font-weight: 400;
  margin-top: 2px;
}

.mkt-pct {
  font-weight: 600;
  font-size: 13px;
}

.mkt-pos {
  color: #16A34A;
}

.mkt-neg {
  color: #DC2626;
}

.mkt-article-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
  transition: opacity 150ms ease-out;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
}

.mkt-article-link:hover {
  opacity: 0.8;
  background: var(--primary-light);
}

.mkt-no-article {
  color: var(--text-xs);
  font-size: 12px;
}

.empty-market {
  padding: 24px 16px;
  text-align: center;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.empty-market p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Intraday Articles */
.intraday-section {
  margin-bottom: 16px;
}

.intraday-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.intraday-item {
  display: block;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--card-bg);
  min-height: 64px;
  transition: all 150ms ease-out;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  color: inherit;
}

.intraday-item:hover {
  border-color: var(--primary);
  background: var(--surface);
}

.intraday-item:active {
  transform: scale(0.98);
  transition: transform 100ms ease-out;
}

.intraday-article-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.intraday-content {
  margin-bottom: 8px;
}

.intraday-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.intraday-summary {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.intraday-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.intraday-time {
  color: var(--text-xs);
  font-weight: 500;
}

/* Mobile optimizations for market and intraday pages */
@media (max-width: 640px) {
  .market-page {
    padding: 1.25rem 0.875rem;
  }

  /* Hide regular tabs on mobile, show dropdown */
  .market-nav {
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    justify-content: flex-start;
  }

  .market-tabs-container {
    display: none !important;
  }

  .market-dropdown-btn {
    display: inline-flex !important;
  }

  .market-nav-links {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
  }

  .market-dropdown {
    position: relative;
  }

  .market-header {
    margin-bottom: 1.75rem;
  }

  .market-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .market-subtitle {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
  }

  .market-disclaimer {
    font-size: 0.8rem;
    margin-top: 0.75rem;
  }

  .market-fetched {
    font-size: 0.8rem;
    margin: 0.5rem 0 0.75rem 0;
  }

  .market-nav {
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .market-tab {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
  }

  .market-section {
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .market-section-title {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
  }

  .market-count {
    font-size: 0.85rem;
  }

  .market-table {
    font-size: 0.8rem;
  }

  .market-table th,
  .market-table td {
    padding: 0.6rem 0.5rem;
  }

  .mkt-symbol {
    font-size: 0.95rem;
  }

  .mkt-company {
    font-size: 0.75rem;
    margin-top: 0.2rem;
  }

  .mkt-article-link {
    font-size: 0.8rem;
  }

  .empty-market {
    padding: 1.5rem 1rem;
  }

  .empty-market p {
    font-size: 0.95rem;
    margin: 0.4rem 0;
  }

  /* Intraday mobile optimizations */
  .intraday-list {
    gap: 0.75rem;
  }

  .intraday-item {
    padding: 0.9rem;
    border-radius: 0.5rem;
  }

  .intraday-title {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
  }

  .intraday-summary {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }

  .intraday-meta {
    font-size: 0.75rem;
  }

  .intraday-time {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .market-page {
    padding: 1rem 0.75rem;
  }

  .market-title {
    font-size: 1.35rem;
  }

  .market-subtitle {
    font-size: 0.9rem;
  }

  .market-section-title {
    font-size: 1rem;
  }

  .market-table {
    font-size: 0.75rem;
  }

  .market-table th,
  .market-table td {
    padding: 0.5rem 0.4rem;
  }

  .market-table-wrapper {
    border-radius: 0.375rem;
  }

  .intraday-item {
    padding: 0.8rem;
  }

  .intraday-title {
    font-size: 0.9rem;
  }

  .intraday-summary {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .market-title {
    font-size: 1.2rem;
  }

  .market-section-title {
    font-size: 0.95rem;
  }

  .market-table {
    font-size: 0.7rem;
  }

  .market-table th,
  .market-table td {
    padding: 0.4rem 0.3rem;
  }

  .intraday-title {
    font-size: 0.85rem;
  }

  .intraday-summary {
    font-size: 0.75rem;
  }
}
