/* ============================================================
   MarketPulse — Premium Financial Platform
   Market Data via MarketStack API
   ============================================================ */

:root {
  --bg:          #060d1a;
  --bg-2:        #0b1425;
  --bg-3:        #0f1c34;
  --card:        #101e35;
  --card-hover:  #162540;
  --border:      #1b2d4a;
  --border-2:    #243a5e;
  --text:        #e2eaf6;
  --text-2:      #8ca0bf;
  --text-muted:  #4a6180;
  --accent:      #4f72fa;
  --accent-2:    #7c3aed;
  --accent-glow: rgba(79,114,250,.18);
  --pos:         #22c55e;
  --pos-bg:      rgba(34,197,94,.10);
  --neg:         #ef4444;
  --neg-bg:      rgba(239,68,68,.10);
  --gold:        #f59e0b;
  --gold-bg:     rgba(245,158,11,.1);
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'Roboto Mono', 'Courier New', monospace;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-2xl: 22px; --r-full: 9999px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 36px rgba(0,0,0,.5);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.65);
  --shadow-glow: 0 0 40px rgba(79,114,250,.08);
  --t-fast: 150ms ease; --t-base: 250ms cubic-bezier(.4,0,.2,1);
  --header-h: 64px; --ticker-h: 40px; --max-w: 1440px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans); color: var(--text); background: var(--bg);
  min-height: 100vh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(79,114,250,.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(124,58,237,.04) 0%, transparent 70%);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: #7b9aff; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.positive { color: var(--pos); }
.negative { color: var(--neg); }
.text-muted { color: var(--text-muted) !important; }
.full-width { width: 100%; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 22px; border-radius: var(--r-md);
  font-size: .875rem; font-weight: 600;
  transition: all var(--t-base); white-space: nowrap; line-height: 1;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 2px 16px rgba(79,114,250,.30);
}
.btn-primary:hover { box-shadow: 0 4px 24px rgba(79,114,250,.45); filter: brightness(1.12); color:#fff; transform: translateY(-1px); }
.btn-ghost { background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-outline { background: none; border: 1px solid var(--border-2); color: var(--text-2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn-danger:hover  { color: var(--neg) !important; }
.btn-sm { padding: 5px 14px; font-size: .75rem; }
.btn-icon { width: 36px; height: 36px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: .875rem; transition: all var(--t-base); }
.btn-icon:hover { color: var(--text); background: var(--border); }
.btn-wl-active { color: var(--gold) !important; border-color: var(--gold) !important; background: var(--gold-bg) !important; }

/* ============================================================
   TICKER TAPE
   ============================================================ */
.ticker-tape {
  height: var(--ticker-h); background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; overflow: hidden;
  position: sticky; top: 0; z-index: 90;
}
.ticker-label {
  flex-shrink: 0; padding: 0 16px; height: 100%;
  font-size: .65rem; font-weight: 800; color: var(--pos);
  text-transform: uppercase; letter-spacing: .14em;
  border-right: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-2);
}
.ticker-scroll-outer { flex: 1; overflow: hidden; }
.ticker-track {
  display: flex; white-space: nowrap; align-items: center; gap: 28px;
  animation: ticker-scroll 70s linear infinite;
  padding: 0 14px;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes ticker-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ticker-item { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; cursor: pointer; padding: 3px 12px; border-radius: var(--r-sm); transition: background var(--t-fast); flex-shrink: 0; }
.ticker-item:hover { background: var(--border); }
.ticker-symbol { font-family: var(--font-mono); font-weight: 700; color: var(--text); }
.ticker-price  { font-family: var(--font-mono); color: var(--text-2); }
.ticker-change { font-family: var(--font-mono); font-weight: 600; font-size: .75rem; }
.ticker-change.up   { color: var(--pos); }
.ticker-change.down { color: var(--neg); }
.ticker-loading { color: var(--text-muted); font-size: .8rem; display: flex; align-items: center; gap: 8px; padding: 0 16px; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  height: var(--header-h); background: rgba(11,20,37,.92);
  border-bottom: 1px solid var(--border);
  position: sticky; top: var(--ticker-h); z-index: 80;
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-text { font-size: 1.15rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.logo-badge { font-size: 9px; font-weight: 800; letter-spacing: .08em; color: var(--pos); background: var(--pos-bg); padding: 2px 7px; border-radius: var(--r-full); border: 1px solid rgba(34,197,94,.20); animation: blink 2s ease infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:.45;} }
.main-nav { display: flex; align-items: center; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-md); font-size: .875rem; font-weight: 500; color: var(--text-2); transition: all var(--t-base); position: relative; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-link.active { color: var(--accent); background: var(--accent-glow); }
.header-right { display: flex; align-items: center; gap: 12px; }

/* Search */
.search-wrapper { position: relative; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--r-full); padding: 0 16px; height: 38px; transition: border-color var(--t-fast), box-shadow var(--t-fast); min-width: 240px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box.compact { min-width: 200px; border-radius: var(--r-md); }
.search-icon { color: var(--text-muted); font-size: .875rem; flex-shrink: 0; }
.search-input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: .875rem; min-width: 0; }
.search-input::placeholder { color: var(--text-muted); }
.search-kbd { background: var(--border); color: var(--text-muted); font-size: .7rem; padding: 1px 6px; border-radius: var(--r-sm); font-family: var(--font-mono); flex-shrink: 0; }
.search-dropdown { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden; max-height: 380px; overflow-y: auto; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; transition: background var(--t-fast); border-bottom: 1px solid var(--border); }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.focused { background: var(--card-hover); }
.sr-symbol { font-family: var(--font-mono); font-weight: 700; color: var(--text); width: 64px; flex-shrink: 0; }
.sr-name   { font-size: .875rem; color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-type   { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; padding: 2px 6px; background: var(--bg-3); border-radius: var(--r-sm); }
.sr-no-results { padding: 20px 16px; text-align: center; color: var(--text-2); font-size: .875rem; }

/* Market Status */
.market-status-pill { display: flex; align-items: center; gap: 7px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); padding: 4px 12px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-full); white-space: nowrap; }
.market-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.market-dot.open   { background: var(--pos); box-shadow: 0 0 6px var(--pos); animation: blink 2s ease infinite; }
.market-dot.closed { background: var(--neg); }
.market-dot.pre    { background: var(--gold); animation: blink 2s ease infinite; }

/* ============================================================
   MAIN & VIEWS
   ============================================================ */
.main-content { padding-bottom: 80px; }
.view { display: none; }
.view.active { display: block; animation: view-in .35s cubic-bezier(.4,0,.2,1); }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { transform: translateY(24px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.section-header { display: flex; align-items: center; justify-content: space-between; padding: 36px 0 22px; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 1.3rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title i { color: var(--accent); }
.last-updated { font-size: .75rem; color: var(--text-muted); }

/* ============================================================
   INDICES
   ============================================================ */
.indices-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 28px; }
.index-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 22px; cursor: pointer; transition: all var(--t-base);
  display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.index-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--border-2); transition: height var(--t-base); }
.index-card.up::before   { background: linear-gradient(90deg, var(--pos), rgba(34,197,94,.4)); }
.index-card.down::before { background: linear-gradient(90deg, var(--neg), rgba(239,68,68,.4)); }
.index-card:hover { background: var(--card-hover); border-color: var(--border-2); transform: translateY(-3px); box-shadow: var(--shadow-md), var(--shadow-glow); }
.index-card:hover::before { height: 3px; }
.index-name  { font-size: .7rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.index-value { font-size: 1.5rem; font-weight: 800; font-family: var(--font-mono); letter-spacing: -.02em; }
.index-change-row { display: flex; align-items: center; gap: 8px; }
.index-change { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; }
.index-pct    { font-family: var(--font-mono); font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: var(--r-full); }
.index-pct.up   { color: var(--pos); background: var(--pos-bg); }
.index-pct.down { color: var(--neg); background: var(--neg-bg); }
.index-loading { display: flex; align-items: center; justify-content: center; padding: 24px; color: var(--text-muted); gap: 8px; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard-layout { display: grid; grid-template-columns: 320px 1fr; gap: 22px; }
.dash-left  { display: flex; flex-direction: column; gap: 22px; }
.dash-main  { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow var(--t-base); }
.card:hover { box-shadow: var(--shadow-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.card-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--accent); }
.card-body { padding: 16px 22px; }
.card-body.no-pad { padding: 0; }

/* ============================================================
   PILL TABS
   ============================================================ */
.pill-tabs { display: flex; background: var(--bg-3); border-radius: var(--r-full); padding: 3px; gap: 2px; }
.pill-tab { padding: 4px 12px; border-radius: var(--r-full); font-size: .75rem; font-weight: 600; color: var(--text-2); transition: all var(--t-fast); }
.pill-tab.active { background: var(--accent); color: white; box-shadow: 0 1px 8px rgba(79,114,250,.35); }
.pill-tab:hover:not(.active) { color: var(--text); }

/* ============================================================
   MARKET MOVERS
   ============================================================ */
.movers-list { display: flex; flex-direction: column; }
.mover-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--t-fast); gap: 10px; }
.mover-item:last-child { border-bottom: none; }
.mover-item:hover { background: var(--card-hover); margin: 0 -20px; padding-left: 20px; padding-right: 20px; border-radius: var(--r-md); }
.mover-rank { font-size: .7rem; color: var(--text-muted); width: 14px; flex-shrink: 0; font-weight: 700; }
.mover-info { flex: 1; min-width: 0; }
.mover-symbol { font-family: var(--font-mono); font-weight: 700; font-size: .875rem; }
.mover-name   { font-size: .7rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-price  { font-family: var(--font-mono); font-size: .875rem; font-weight: 600; }
.mover-change { font-family: var(--font-mono); font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: var(--r-full); min-width: 64px; text-align: center; }
.mover-change.up   { color: var(--pos); background: var(--pos-bg); }
.mover-change.down { color: var(--neg); background: var(--neg-bg); }

/* ============================================================
   WATCHLIST
   ============================================================ */
.wl-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: all var(--t-fast); gap: 10px; }
.wl-item:last-child { border-bottom: none; }
.wl-item:hover { background: var(--card-hover); margin: 0 -20px; padding-left: 20px; padding-right: 20px; border-radius: var(--r-md); }
.wl-symbol { font-family: var(--font-mono); font-weight: 700; font-size: .875rem; }
.wl-name   { font-size: .7rem; color: var(--text-2); }
.wl-price  { font-family: var(--font-mono); font-size: .875rem; font-weight: 600; }
.wl-change { font-family: var(--font-mono); font-size: .75rem; font-weight: 700; padding: 2px 6px; border-radius: var(--r-full); }
.wl-change.up { color: var(--pos); background: var(--pos-bg); }
.wl-change.down { color: var(--neg); background: var(--neg-bg); }
.wl-remove { color: var(--text-muted); font-size: .75rem; transition: color var(--t-fast); }
.wl-remove:hover { color: var(--neg); }

/* Full watchlist view */
.wl-full-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.wl-full-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; cursor: pointer; transition: all var(--t-base); display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.wl-full-card:hover { border-color: var(--border-2); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.wlfc-header { display: flex; justify-content: space-between; align-items: center; }
.wlfc-symbol { font-family: var(--font-mono); font-weight: 800; font-size: 1.125rem; }
.wlfc-remove { color: var(--text-muted); transition: color var(--t-fast); }
.wlfc-remove:hover { color: var(--neg); }
.wlfc-name   { font-size: .875rem; color: var(--text-2); }
.wlfc-price  { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; }
.wlfc-change { display: flex; gap: 8px; font-family: var(--font-mono); font-size: .875rem; font-weight: 600; }
.wlfc-change.up   { color: var(--pos); }
.wlfc-change.down { color: var(--neg); }
.wlfc-stats  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wlfc-stat   { background: var(--bg-3); border-radius: var(--r-md); padding: 8px 10px; }
.wlfc-stat-label { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.wlfc-stat-val   { font-family: var(--font-mono); font-size: .875rem; font-weight: 600; }

/* ============================================================
   COMPACT TABLE (Popular Stocks)
   ============================================================ */
.compact-table-wrap { overflow-x: auto; }
.compact-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.compact-table thead tr { border-bottom: 1px solid var(--border-2); }
.compact-table th { padding: 10px 16px; text-align: left; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); background: var(--bg-3); white-space: nowrap; }
.compact-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.compact-table tbody tr { cursor: pointer; transition: background var(--t-fast); }
.compact-table tbody tr:hover { background: var(--card-hover); }
.compact-table tbody tr:last-child td { border-bottom: none; }
.t-symbol { font-family: var(--font-mono); font-weight: 700; color: var(--text); }
.t-name   { color: var(--text-2); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.t-price  { font-family: var(--font-mono); font-weight: 600; }
.t-change { font-family: var(--font-mono); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.t-change.up { color: var(--pos); }
.t-change.down { color: var(--neg); }
.t-pct    { font-family: var(--font-mono); font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: var(--r-full); display: inline-block; }
.t-pct.up   { color: var(--pos); background: var(--pos-bg); }
.t-pct.down { color: var(--neg); background: var(--neg-bg); }
.loading-cell { text-align: center; padding: 40px !important; color: var(--text-2); }

/* ============================================================
   MARKETS TABLE
   ============================================================ */
.markets-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.table-container { overflow-x: auto; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table thead tr { border-bottom: 1px solid var(--border-2); }
.data-table th { padding: 12px 16px; text-align: left; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); background: var(--bg-3); white-space: nowrap; cursor: default; user-select: none; }
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text); }
.data-table th i { font-size: .65rem; margin-left: 4px; opacity: .5; }
.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.sector-badge { font-size: .65rem; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); text-transform: capitalize; }

/* ============================================================
   NEWS — Dashboard compact list
   ============================================================ */
.news-dash-list { display: flex; flex-direction: column; }
.news-dash-item {
  display: flex; gap: 14px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background var(--t-fast); text-decoration: none; color: inherit;
}
.news-dash-item:last-child { border-bottom: none; }
.news-dash-item:hover { background: var(--card-hover); }
.ndi-img { width: 64px; height: 52px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; background: var(--bg-3); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1.25rem; overflow: hidden; }
.ndi-img img { width: 100%; height: 100%; object-fit: cover; }
.ndi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ndi-headline { font-size: .875rem; font-weight: 600; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ndi-meta { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--text-muted); }
.ndi-source { color: var(--accent); font-weight: 600; }

/* ============================================================
   NEWS — Full view grid cards
   ============================================================ */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.news-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden; cursor: pointer; transition: all var(--t-base);
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
}
.news-card:hover { border-color: var(--border-2); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.news-card-img { width: 100%; height: 160px; object-fit: cover; }
.news-card-img.favicon-img { object-fit: contain; background: var(--bg-3); padding: 20px; }
.news-card-placeholder { width: 100%; height: 160px; background: var(--bg-3); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 2rem; }
.news-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.news-card-cat { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); background: var(--accent-glow); padding: 2px 8px; border-radius: var(--r-full); align-self: flex-start; }
.news-card-headline { font-size: .9375rem; font-weight: 600; line-height: 1.5; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.news-card-summary { font-size: .8125rem; color: var(--text-2); line-height: 1.6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.news-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border); }
.news-card-source { font-size: .75rem; font-weight: 600; color: var(--accent); }
.news-card-time   { font-size: .75rem; color: var(--text-muted); }

/* ============================================================
   NEWS — Compact list (stock modal)
   ============================================================ */
.news-list-compact { display: flex; flex-direction: column; gap: 10px; }
.news-compact-item { display: flex; gap: 12px; padding: 12px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; transition: all var(--t-fast); text-decoration: none; color: inherit; }
.news-compact-item:hover { background: var(--card-hover); border-color: var(--border-2); }
.nci-img { width: 70px; height: 54px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; background: var(--bg-2); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 1rem; overflow: hidden; }
.nci-img img { width: 100%; height: 100%; object-fit: cover; }
.nci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.nci-headline { font-size: .8125rem; font-weight: 500; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nci-meta { display: flex; gap: 8px; font-size: .7rem; color: var(--text-muted); }
.nci-source { color: var(--accent); font-weight: 600; }
.smd-news-section { margin-top: 24px; }

/* ============================================================
   HISTORY VIEW — price history cards with sparklines
   ============================================================ */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.history-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 22px; cursor: pointer; transition: all var(--t-base);
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.history-card:hover { border-color: var(--border-2); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.history-card-header { display: flex; align-items: baseline; gap: 10px; }
.history-card-symbol { font-family: var(--font-mono); font-weight: 800; font-size: 1rem; color: var(--accent); }
.history-card-name { font-size: .8125rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-card-price { font-size: 1.5rem; font-weight: 800; font-family: var(--font-mono); letter-spacing: -.01em; }
.history-card-change { display: flex; align-items: center; gap: 8px; font-size: .8125rem; font-family: var(--font-mono); font-weight: 600; }
.history-card-change.up { color: var(--pos); }
.history-card-change.down { color: var(--neg); }
.history-card-chart { margin-top: 8px; }
.history-card-chart svg { width: 100%; height: auto; }
.section-subtitle-text { font-size: .9375rem; color: var(--text-2); margin: 0; }

/* ============================================================
   STOCK DETAIL MODAL
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fade-in .25s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,10,22,.90); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.modal-dialog { position: relative; z-index: 1; background: var(--card); border: 1px solid var(--border-2); border-radius: var(--r-2xl); width: min(520px, 95vw); box-shadow: var(--shadow-xl), 0 0 80px rgba(79,114,250,.06); animation: dialog-in .35s cubic-bezier(.4,0,.2,1); }
.modal-dialog-lg { width: min(780px, 96vw); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 12px; }
.modal-header h2 { font-size: 1.125rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-header h2 i { color: var(--accent); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }
.modal-intro { color: var(--text-2); margin-bottom: 20px; line-height: 1.7; font-size: .9375rem; }
.modal-close { color: var(--text-muted); font-size: 1rem; }
.modal-close:hover { color: var(--text); }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: .875rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.form-label i { color: var(--accent); }
.form-input { background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--r-md); color: var(--text); padding: 10px 14px; font-size: .875rem; font-family: var(--font-mono); transition: border-color var(--t-fast), box-shadow var(--t-fast); width: 100%; }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); font-family: var(--font-sans); }
.api-status { margin-top: 8px; font-size: .875rem; min-height: 20px; }
.api-status.success { color: var(--pos); }
.api-status.error   { color: var(--neg); }

/* Stock Modal */
.stock-modal-id { display: flex; align-items: center; gap: 14px; }
.stock-symbol-badge { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; font-weight: 800; font-size: 1rem; padding: 6px 14px; border-radius: var(--r-md); font-family: var(--font-mono); }
.smd-name     { font-size: 1rem; font-weight: 600; }
.smd-exchange { font-size: .75rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .08em; }
.smd-actions  { display: flex; align-items: center; gap: 10px; }
.smd-price-hero { margin-bottom: 20px; }
.smd-price    { font-size: 2.5rem; font-weight: 800; font-family: var(--font-mono); letter-spacing: -.02em; display: block; line-height: 1.1; }
.smd-change-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; font-size: 1.1rem; }
.smd-change-row span { font-family: var(--font-mono); font-weight: 600; }
.smd-change-row.up { color: var(--pos); }
.smd-change-row.down { color: var(--neg); }
.smd-currency { font-size: .75rem; color: var(--text-muted); }
.smd-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 24px; }
.smd-stat { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; }
.smd-stat-label { font-size: .65rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.smd-stat-val   { font-family: var(--font-mono); font-size: .875rem; font-weight: 600; }
.smd-stat-val.up { color: var(--pos); }
.smd-stat-val.down { color: var(--neg); }

.smd-profile-section { margin-bottom: 24px; }
.section-subtitle { font-size: .875rem; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text-2); border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.section-subtitle i { color: var(--accent); }
.smd-profile { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.smd-profile-item { display: flex; flex-direction: column; gap: 3px; }
.smd-profile-label { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.smd-profile-val   { font-size: .875rem; font-weight: 500; }

/* Chart in modal */
.smd-chart-section { margin-bottom: 24px; }
.smd-chart { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; overflow: hidden; }
.smd-chart svg { display: block; width: 100%; height: auto; }

/* ============================================================
   EMPTY STATES & SPINNER
   ============================================================ */
.empty-state { text-align: center; padding: 32px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state.large { padding: 80px 20px; }
.empty-icon { font-size: 2.25rem; color: var(--text-muted); margin-bottom: 8px; }
.empty-state h2 { font-size: 1.125rem; font-weight: 600; }
.empty-state p  { font-size: .875rem; color: var(--text-2); max-width: 300px; }
.empty-state small { color: var(--text-muted); font-size: .75rem; }
.spinner-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--text-muted); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { background: var(--bg-2); border-top: 1px solid var(--border); padding: 52px 0 36px; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 44px; }
.footer-logo    { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 14px; background: linear-gradient(135deg, var(--text), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.footer-tagline { color: var(--text-2); font-size: .875rem; line-height: 1.7; margin-bottom: 20px; max-width: 280px; }
.footer-social  { display: flex; gap: 10px; }
.social-btn { width: 34px; height: 34px; border-radius: var(--r-md); background: var(--bg-3); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: .875rem; transition: all var(--t-fast); }
.social-btn:hover { background: var(--border); color: var(--text); }
.footer-col h4  { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); margin-bottom: 14px; }
.footer-col ul  { display: flex; flex-direction: column; gap: 10px; }
.footer-col li a { font-size: .875rem; color: var(--text-muted); transition: color var(--t-fast); }
.footer-col li a:hover { color: var(--text); }
.footer-bottom  { border-top: 1px solid var(--border); padding-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.footer-disclaimer { font-size: .75rem; color: var(--text-muted); line-height: 1.7; max-width: 900px; }
.footer-copy    { font-size: .75rem; color: var(--text-muted); }
.footer-copy a  { color: var(--text-muted); }
.footer-copy a:hover { color: var(--text); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: all; min-width: 280px; max-width: 360px; background: var(--card); border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 14px 18px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px; animation: toast-in .3s ease; font-size: .875rem; }
.toast.toast-out { animation: toast-out .3s ease forwards; }
@keyframes toast-in  { from { transform: translateX(110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to   { transform: translateX(110%); opacity: 0; } }
.toast-icon { font-size: .9375rem; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--pos); }
.toast-error   .toast-icon { color: var(--neg); }
.toast-info    .toast-icon { color: var(--accent); }
.toast-msg  { flex: 1; color: var(--text); line-height: 1.4; }
.toast-close { color: var(--text-muted); cursor: pointer; }
.toast-close:hover { color: var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .dashboard-layout { grid-template-columns: 280px 1fr; }
  .history-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .dash-left { display: grid; grid-template-columns: 1fr 1fr; }
  .main-nav .nav-link span { display: none; }
  .main-nav .nav-link { padding: 8px; }
  .search-box { min-width: 160px; }
  .market-status-pill { display: none; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  :root { --header-h: 56px; --ticker-h: 36px; }
  .logo-badge { display: none; }
  .main-nav { gap: 0; }
  .search-box { min-width: 120px; }
  .search-kbd { display: none; }
  .indices-row { grid-template-columns: 1fr 1fr; }
  .dash-left { grid-template-columns: 1fr; }
  .modal-dialog-lg { width: 100%; max-height: 100vh; border-radius: var(--r-xl) var(--r-xl) 0 0; margin-top: auto; align-self: flex-end; }
  .footer-grid { grid-template-columns: 1fr; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
}

/* Scrollbar */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection    { background: rgba(79,114,250,.25); color: var(--text); }
