* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #010101; --card: #0F1218; --card-hover: #151b24;
  --teal: #0DECA5; --green: #26A69A; --red: #EF5350;
  --text: #E6EDF3; --text2: #8B949E; --indigo: #3D5AFE;
}
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif; overflow: hidden; }
body { display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }

/* Header */
.app-header { padding: 12px 16px 8px; flex-shrink: 0; }
.app-header h1 { font-size: 22px; font-weight: 700; }
.app-header p { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* Tabs */
.tab-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 80px; }
.tab-page { display: none; } .tab-page.active { display: block; }

/* Bottom Nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; padding: 8px 24px calc(env(safe-area-inset-bottom, 0px) + 4px); background: linear-gradient(transparent, rgba(1,1,1,0.95) 30%); z-index: 100; }
.nav-pill { display: flex; background: rgba(30,35,45,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 32px; padding: 6px; gap: 4px; border: 1px solid rgba(255,255,255,0.06); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 20px; border-radius: 26px; cursor: pointer; transition: all 0.25s ease; color: rgba(255,255,255,0.4); font-size: 10px; font-weight: 500; }
.nav-item.active { color: var(--teal); background: rgba(13,236,165,0.1); }
.nav-item svg { width: 22px; height: 22px; }

/* Cards */
.card { background: var(--card); border-radius: 12px; padding: 14px; margin: 0 12px 10px; }
.card:active { background: var(--card-hover); }

/* Story Carousel */
.carousel { position: relative; margin: 8px 12px 12px; border-radius: 16px; overflow: hidden; background: var(--card); }
.carousel .progress-bar { display: flex; gap: 4px; padding: 12px 14px 0; position: relative; z-index: 4; }
.carousel .progress-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.15); overflow: hidden; }
.carousel .progress-seg .fill { height: 100%; background: var(--teal); border-radius: 2px; width: 0%; }
.carousel .progress-seg.done .fill { width: 100% !important; }
.carousel .story { padding: 14px 14px 16px; position: relative; z-index: 1; min-height: 180px; }
.carousel .story .badge { display: inline-block; background: rgba(13,236,165,0.15); color: var(--teal); font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.5px; margin-bottom: 10px; }
.carousel .story h2 { font-size: 16px; font-weight: 700; line-height: 1.35; margin-bottom: 8px; }
.carousel .story .summary { font-size: 13px; color: var(--text2); line-height: 1.45; margin-bottom: 12px; }
.carousel .story .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.carousel .story .chip { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.chip.bull { background: rgba(38,166,154,0.15); color: var(--green); }
.chip.bear { background: rgba(239,83,80,0.15); color: var(--red); }
.carousel .tap-zones { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; z-index: 5; }
.carousel .tap-left { width: 30%; }
.carousel .tap-right { width: 70%; }

/* Section headers */
.section-hdr { font-size: 15px; font-weight: 700; padding: 14px 16px 8px; }

/* Stock row */
.stock-row { display: flex; align-items: center; padding: 12px 14px; cursor: pointer; }
.stock-row:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.04); }
.stock-info { flex: 1; }
.stock-symbol { font-size: 14px; font-weight: 700; }
.stock-company { font-size: 11px; color: var(--text2); margin-top: 1px; }
.stock-reason { font-size: 11px; color: var(--teal); opacity: 0.85; margin-top: 4px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stock-change { font-family: 'SF Mono', 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; margin-left: 12px; white-space: nowrap; }
.stock-change.up { color: var(--green); } .stock-change.down { color: var(--red); }

/* Sector card */
.sector-card { background: var(--card); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.sector-header { display: flex; align-items: center; justify-content: space-between; }
.sector-name { font-size: 14px; font-weight: 700; }
.sector-badge { font-size: 11px; color: var(--teal); font-weight: 700; background: rgba(13,236,165,0.12); padding: 2px 7px; border-radius: 8px; margin-left: 8px; }
.sector-indicators { display: flex; gap: 6px; align-items: center; }
.mini-pill { font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 6px; }
.mini-pill.bull { background: rgba(38,166,154,0.1); color: var(--green); }
.mini-pill.bear { background: rgba(239,83,80,0.1); color: var(--red); }
.sector-chevron { color: var(--text2); transition: transform 0.3s; font-size: 18px; }
.sector-chevron.open { transform: rotate(180deg); }
.sector-stocks { overflow: hidden; max-height: 0; transition: max-height 0.35s ease; }
.sector-stocks.open { max-height: 600px; }

/* Heatmap grid */
.heatmap { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 12px; }
.heat-card { background: var(--card); border-radius: 10px; padding: 12px; }
.heat-name { font-size: 13px; font-weight: 600; }
.heat-count { font-size: 11px; color: var(--text2); margin-top: 2px; }
.heat-bar { display: flex; height: 4px; border-radius: 2px; overflow: hidden; margin-top: 8px; background: rgba(255,255,255,0.05); }
.heat-bar .bull-fill { background: var(--green); } .heat-bar .bear-fill { background: var(--red); }

/* News list */
.news-card { display: flex; gap: 12px; padding: 12px 14px; }
.news-accent { width: 3px; border-radius: 2px; background: var(--teal); flex-shrink: 0; }
.news-body h3 { font-size: 13px; font-weight: 600; line-height: 1.35; }
.news-meta { font-size: 11px; color: var(--text2); margin-top: 4px; }
.news-stocks-count { font-size: 10px; color: var(--teal); background: rgba(13,236,165,0.1); padding: 2px 7px; border-radius: 8px; margin-top: 6px; display: inline-block; }

/* Stock Detail Modal */
.modal-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: none; flex-direction: column; overflow: hidden; }
.modal-overlay.open { display: flex; }
.modal-header { display: flex; align-items: center; padding: 16px; gap: 12px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.modal-header .back-btn { background: none; border: none; color: var(--text); font-size: 24px; cursor: pointer; padding: 4px; }
.modal-header h2 { font-size: 20px; font-weight: 700; }
.price-section { padding: 0 16px 12px; }
.price-big { font-size: 28px; font-weight: 700; font-family: 'SF Mono', monospace; }
.price-change { font-size: 14px; font-family: 'SF Mono', monospace; font-weight: 500; margin-left: 10px; }
.exchange-label { font-size: 11px; color: var(--text2); margin-top: 4px; }
.detail-tabs { display: flex; border-bottom: 1px solid var(--card); position: sticky; top: 56px; background: var(--bg); z-index: 1; }
.detail-tab { flex: 1; text-align: center; padding: 12px; font-size: 12px; font-weight: 500; color: var(--text2); cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; }
.detail-tab.active { color: var(--indigo); border-color: var(--indigo); }
.detail-panel { display: none; padding: 16px; flex: 1; overflow-y: auto; } .detail-panel.active { display: flex; flex-direction: column; }
.detail-panel:first-of-type { overflow: hidden; }
.chart-container { width: 100%; flex: 1; border-radius: 8px; overflow: hidden; }
.chart-container iframe { width: 100%; height: 100%; border: none; }
.period-selector { display: flex; gap: 8px; padding: 12px 0; flex-wrap: wrap; }
.period-btn { background: var(--card); color: var(--text2); border: none; padding: 6px 14px; border-radius: 20px; font-size: 12px; cursor: pointer; }
.period-btn.active { background: rgba(13,236,165,0.2); color: var(--teal); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.stat-card { background: var(--card); border-radius: 10px; padding: 10px; }
.stat-label { font-size: 11px; color: var(--text2); } .stat-value { font-size: 14px; font-weight: 600; font-family: 'SF Mono', monospace; margin-top: 4px; }
.ai-card { background: var(--card); border-radius: 12px; margin-bottom: 12px; display: flex; overflow: hidden; }
.ai-accent { width: 4px; background: var(--teal); flex-shrink: 0; }
.ai-text { padding: 14px; font-size: 13px; line-height: 1.5; color: var(--text); }
.disclaimer { font-size: 11px; color: var(--text2); margin-top: 20px; }
.analyze-btn { width: 100%; padding: 14px; margin-top: 16px; background: var(--indigo); color: #fff; border: none; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.detail-tab { font-size: 12px; }

/* Profile */
.profile-section { padding: 12px 16px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.profile-row label { font-size: 14px; } .profile-row span { font-size: 13px; color: var(--text2); }

/* Pill badges */
.summary-row { display: flex; align-items: center; gap: 8px; padding: 4px 16px 8px; }
.summary-count { font-size: 12px; color: var(--text2); }
.summary-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.summary-pill.bull { background: rgba(38,166,154,0.12); color: var(--green); }
.summary-pill.bear { background: rgba(239,83,80,0.12); color: var(--red); }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--text2); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--card); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty { text-align: center; padding: 48px 24px; color: var(--text2); font-size: 14px; }

/* Commodity cards */
.commodity-row { display: flex; gap: 10px; padding: 0 12px; margin-bottom: 14px; }
.commodity-card { flex: 1; background: var(--card); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.commodity-icon { font-size: 24px; }
.commodity-info { flex: 1; }
.commodity-name { font-size: 14px; font-weight: 700; }
.commodity-unit { font-size: 10px; color: var(--text2); margin-top: 2px; }
.commodity-price-section { text-align: right; }
.commodity-price { font-size: 14px; font-weight: 700; font-family: 'SF Mono', 'JetBrains Mono', monospace; }
.commodity-change { font-size: 11px; font-weight: 600; margin-top: 2px; }
.commodity-change.up { color: var(--green); }
.commodity-change.down { color: var(--red); }

/* Commodity expand/collapse */
.commodity-details { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 14px; }
.commodity-details.open { max-height: 300px; padding: 8px 14px 12px; }
.commodity-details-header { font-size: 10px; font-weight: 600; color: var(--text2); letter-spacing: 0.5px; margin-bottom: 8px; text-transform: uppercase; }
.commodity-detail-item { font-size: 11px; color: var(--teal); opacity: 0.85; line-height: 1.45; margin-bottom: 6px; }

.detailed-analysis { margin-top: 16px; }
.detailed-analysis h4 { color: #0DECA5; font-size: 14px; margin: 16px 0 8px 0; }
.detailed-analysis p { color: #E6EDF3; font-size: 12px; line-height: 1.6; margin: 4px 0; }
.detailed-analysis ul { padding-left: 16px; margin: 4px 0; }
.detailed-analysis li { color: #E6EDF3; font-size: 12px; line-height: 1.6; margin: 2px 0; }
.detailed-analysis table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11px; }
.detailed-analysis th, .detailed-analysis td { padding: 6px 8px; border: 1px solid rgba(255,255,255,0.1); color: #E6EDF3; text-align: left; }
.detailed-analysis th { color: #0DECA5; font-weight: 600; }
.detailed-analysis strong { color: #0DECA5; }

/* Upgrade / Subscription */
.upgrade-modal { padding: 20px; }
.plan-card { background: var(--card); border-radius: 16px; padding: 20px; margin-bottom: 12px; }
.plan-card.recommended { border: 1.5px solid #3D5AFE; }
.plan-name { font-size: 20px; font-weight: 700; }
.plan-badge { background: #EF5350; color: white; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 6px; display: inline-block; margin-top: 4px; }
.plan-original-price { font-size: 14px; color: var(--text2); text-decoration: line-through; }
.plan-price { font-size: 28px; font-weight: 700; color: var(--text1); }
.plan-period { font-size: 12px; color: var(--text2); }
.plan-annual { font-size: 11px; color: #0DECA5; margin-top: 4px; }
.plan-features { margin-top: 16px; }
.plan-feature { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 13px; }
.plan-feature.included { color: var(--text1, var(--text)); }
.plan-feature.excluded { color: rgba(139,148,158,0.4); }
.plan-feature svg { width: 16px; height: 16px; flex-shrink: 0; }
.plan-cta { width: 100%; padding: 12px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 16px; }
.plan-cta.primary { background: #3D5AFE; color: white; }
.plan-cta.premium { background: #FFA726; color: white; }
.plan-cta.disabled { background: transparent; border: 1px solid var(--text2); color: var(--text2); cursor: default; }
.recommended-badge { background: #3D5AFE; color: white; font-size: 9px; font-weight: 700; padding: 3px 10px; border-radius: 12px; letter-spacing: 1px; display: inline-block; margin-bottom: 12px; }
.sub-card { background: var(--card); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.upgrade-footer { font-size: 11px; color: var(--text2); text-align: center; line-height: 1.5; margin-top: 24px; }

/* Watchlist Sub-Tabs */
.wl-tabs { display: flex; gap: 6px; padding: 8px 12px 4px; }
.wl-tab { padding: 7px 18px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; background: rgba(30,35,45,0.7); color: var(--text2); border: 1px solid rgba(255,255,255,0.06); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.wl-tab.active { background: rgba(13,236,165,0.12); color: var(--teal); border-color: rgba(13,236,165,0.2); }

/* My Watchlists */
.mywl-list { padding: 0 12px; }
.mywl-card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.mywl-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mywl-card-name { font-size: 15px; font-weight: 700; }
.mywl-card-count { font-size: 11px; color: var(--text2); }
.mywl-card-actions { display: flex; gap: 8px; align-items: center; }
.mywl-action-btn { background: none; border: none; color: var(--text2); font-size: 16px; cursor: pointer; padding: 4px; }
.mywl-action-btn:hover { color: var(--text); }
.mywl-action-btn.delete:hover { color: var(--red); }
.mywl-analyze-btn { background: rgba(61,90,254,0.15); color: var(--indigo); border: none; padding: 6px 14px; border-radius: 8px; font-size: 11px; font-weight: 600; cursor: pointer; }
.mywl-analyze-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mywl-stock-row { display: flex; align-items: center; padding: 10px 0; }
.mywl-stock-row:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.04); }
.mywl-stock-info { flex: 1; cursor: pointer; }
.mywl-stock-symbol { font-size: 13px; font-weight: 700; }
.mywl-stock-company { font-size: 11px; color: var(--text2); margin-top: 1px; }
.mywl-stock-delete { background: none; border: none; color: var(--text2); font-size: 14px; cursor: pointer; padding: 6px; margin-left: 8px; }
.mywl-stock-delete:hover { color: var(--red); }
.mywl-add-stock-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; color: var(--teal); font-size: 12px; font-weight: 600; cursor: pointer; border-top: 1px solid rgba(255,255,255,0.04); margin-top: 4px; }
.mywl-empty { text-align: center; padding: 32px 24px; color: var(--text2); font-size: 13px; line-height: 1.5; }

/* FAB */
.mywl-fab { position: fixed; bottom: 90px; right: 16px; width: 52px; height: 52px; border-radius: 50%; background: var(--indigo); color: white; border: none; font-size: 26px; font-weight: 300; cursor: pointer; z-index: 50; display: none; box-shadow: 0 4px 16px rgba(61,90,254,0.4); }
.mywl-fab.visible { display: flex; align-items: center; justify-content: center; }

/* Search Modal */
.search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 300; display: none; flex-direction: column; padding: env(safe-area-inset-top, 20px) 0 0; }
.search-overlay.open { display: flex; }
.search-bar { display: flex; align-items: center; padding: 12px 16px; gap: 10px; }
.search-input { flex: 1; background: var(--card); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--text); outline: none; }
.search-input:focus { border-color: var(--teal); }
.search-cancel { background: none; border: none; color: var(--teal); font-size: 14px; font-weight: 600; cursor: pointer; }
.search-results { flex: 1; overflow-y: auto; padding: 0 12px; }
.search-result-item { display: flex; align-items: center; padding: 12px; background: var(--card); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.search-result-item:active { background: var(--card-hover); }
.search-result-symbol { font-size: 14px; font-weight: 700; }
.search-result-name { font-size: 11px; color: var(--text2); margin-top: 1px; }
.search-result-add { margin-left: auto; color: var(--teal); font-size: 20px; font-weight: 300; }
.search-manual-add { padding: 12px; text-align: center; }
.search-manual-btn { background: rgba(13,236,165,0.1); color: var(--teal); border: none; padding: 10px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; }

/* Watchlist Analysis Result */
.wl-analysis-card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.wl-analysis-stock { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.wl-analysis-stock:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.04); }
.wl-analysis-verdict { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.wl-analysis-verdict.hold { background: rgba(255,167,38,0.15); color: #FFA726; }
.wl-analysis-verdict.add { background: rgba(38,166,154,0.15); color: var(--green); }
.wl-analysis-verdict.sell { background: rgba(239,83,80,0.15); color: var(--red); }
.wl-analysis-verdict.reduce { background: rgba(239,83,80,0.15); color: var(--red); }
.wl-analysis-score { font-size: 11px; font-weight: 700; font-family: 'SF Mono', monospace; }
.wl-analysis-reason { font-size: 11px; color: var(--text2); line-height: 1.4; margin-top: 4px; }

