/* ============================================================
   Market Pulse — Styles
   ============================================================ */

/* ---- FONTS ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ---- RESET & BASE ---- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:16px; -webkit-text-size-adjust:100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0F1119;
  color: #FFFFFF;
  line-height: 1.5;
  overflow: hidden;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
input, select, button, textarea { font-family: inherit; }
a { color: #4DC0F2; text-decoration: none; }

/* ---- CSS VARIABLES ---- */
:root {
  --bg: #0F1119;
  --card: #1A1C26;
  --elevated: #222431;
  --green: #33D98C;
  --red: #F24D57;
  --yellow: #FFD147;
  --cyan: #4DC0F2;
  --purple: #9A66F2;
  --gold: #FFC833;
  --text: #FFFFFF;
  --text-secondary: rgba(255,255,255,0.65);
  --text-muted: rgba(255,255,255,0.40);
  --border: rgba(255,255,255,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- APP SHELL ---- */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
@media (min-width: 768px) {
  #app { max-width: 100%; }
  .app-main { max-width: 680px; margin: 0 auto; width: 100%; }
}
@media (min-width: 1200px) {
  .app-main { max-width: 800px; }
}

/* ---- HEADER ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.logo { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.logo-icon { font-size: 20px; color: var(--green); }
.logo-text { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.data-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  letter-spacing: 0.5px;
}
.pro-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--gold), #FF9800);
  color: #000;
  letter-spacing: 0.5px;
}
.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); }

/* ---- MAIN CONTENT ---- */
.app-main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 16px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.app-main::-webkit-scrollbar { width: 0; }

/* ---- TAB BAR ---- */
.tab-bar {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 4px 0;
  padding-bottom: calc(4px + var(--safe-bottom));
  flex-shrink: 0;
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  font-size: 10px;
  font-weight: 500;
}
.tab-item.active { color: var(--green); }
.tab-item svg { stroke: currentColor; }
.tab-item span { letter-spacing: 0.2px; }

/* ---- INDICES BAR ---- */
.indices-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.indices-bar::-webkit-scrollbar { display: none; }
.index-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.index-name { font-size: 11px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.3px; }
.index-price { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 600; }
.index-change { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; }

/* ---- FILTER TABS ---- */
.filter-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 0 12px;
  overflow-x: auto;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn.active {
  background: var(--green);
  color: #000;
  border-color: var(--green);
  font-weight: 600;
}

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-header-row .card-title { margin-bottom: 0; }

/* ---- SECTION ---- */
.market-section { margin-bottom: 8px; }
.section-title {
  font-size: 15px;
  font-weight: 600;
  padding: 12px 0 8px;
  color: var(--text);
}

/* ---- ASSET CARD ---- */
.asset-list { display: flex; flex-direction: column; gap: 2px; }
.asset-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  overflow: hidden;
}
.asset-card:active { background: var(--elevated); transform: scale(0.99); }
.asset-card.swiped { opacity: 0; transform: translateX(-100%); transition: all 0.3s; }
.asset-card-left { flex: 1; min-width: 0; }
.asset-symbol { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px; }
.asset-name { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.asset-card-right { text-align: right; flex-shrink: 0; }
.asset-price { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 14px; }
.asset-change { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 3px; justify-content: flex-end; }
.change-arrow { font-size: 9px; }

/* ---- COLORS ---- */
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral-sent { color: var(--yellow); }


/* ---- DETAIL PAGE ---- */
.detail-page { padding-bottom: 20px; }
.detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}
.back-btn {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 0;
  font-weight: 500;
}
.detail-actions { display: flex; gap: 8px; }
.icon-btn-sm {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
.icon-btn-sm.active { color: var(--gold); border-color: var(--gold); }
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.detail-symbol { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 24px; }
.detail-name { font-size: 13px; color: var(--text-muted); }
.detail-price-block { text-align: right; }
.detail-price { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 26px; }
.detail-change { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500; }

/* ---- CHART ---- */
.chart-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.chart-container canvas { width: 100%; display: block; }
.period-selector {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  overflow-x: auto;
}
.period-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
}
.period-btn.active { background: var(--green); color: #000; border-color: var(--green); font-weight: 600; }

/* ---- STAT GRID ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 500px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-item {
  background: var(--elevated);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; letter-spacing: 0.3px; }
.stat-value { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; }

/* ---- TECHNICAL INDICATORS ---- */
.tech-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 400px) { .tech-row { grid-template-columns: repeat(2, 1fr); } }
.tech-item {
  background: var(--elevated);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.tech-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.tech-value { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 600; }
.tech-sub { font-size: 11px; margin-top: 2px; }

/* ---- PROGRESS BAR ---- */
.progress-bar-container { margin: 8px 0; }
.progress-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: flex; justify-content: space-between; }
.progress-track {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.progress-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 2px;
}

/* ---- BADGE ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge-bullish, .badge-buy, .badge-outperform, .badge-overweight { background: rgba(51,217,140,0.15); color: var(--green); }
.badge-bearish, .badge-underperform, .badge-underweight, .badge-sell { background: rgba(242,77,87,0.15); color: var(--red); }
.badge-neutral, .badge-hold, .badge-equalweight { background: rgba(255,209,71,0.15); color: var(--yellow); }

/* ---- NEWS ---- */
.news-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.news-card:last-child { border-bottom: none; }
.news-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.news-source { font-size: 11px; color: var(--cyan); font-weight: 600; }
.news-time { font-size: 11px; color: var(--text-muted); }
.news-ticker { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--gold); background: rgba(255,200,51,0.1); padding: 1px 6px; border-radius: 4px; }
.news-sentiment { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.news-title { font-size: 14px; font-weight: 500; line-height: 1.4; }

/* ---- SCENARIOS ---- */
.scenario-cards { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.scenario-card {
  background: var(--elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
  border-left: 3px solid;
}
.scenario-bull { border-left-color: var(--green); }
.scenario-base { border-left-color: var(--yellow); }
.scenario-bear { border-left-color: var(--red); }
.scenario-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.scenario-label { font-weight: 600; font-size: 13px; }
.scenario-prob { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; color: var(--text-secondary); }
.scenario-target { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.scenario-drivers { padding-left: 16px; margin-top: 8px; }
.scenario-drivers li { font-size: 12px; color: var(--text-secondary); margin-bottom: 3px; }

/* ---- ANALYST ---- */
.analyst-section { margin-top: 16px; }
.analyst-section h4 { font-size: 14px; margin-bottom: 10px; }
.analyst-range { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.analyst-low, .analyst-high { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.analyst-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; position: relative; }
.analyst-marker {
  position: absolute;
  top: -18px;
  transform: translateX(-50%);
}
.analyst-avg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  white-space: nowrap;
}
.analyst-marker::after {
  content: '';
  display: block;
  width: 2px;
  height: 18px;
  background: var(--cyan);
  margin: 2px auto 0;
  border-radius: 1px;
}
.analyst-firms { display: flex; flex-direction: column; gap: 6px; }
.analyst-firm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--elevated);
  border-radius: 6px;
}
.firm-name { flex: 1; font-size: 13px; }
.firm-target { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; }


/* ---- PATTERNS ---- */
.pattern-item {
  padding: 12px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.pattern-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.pattern-name { font-weight: 600; font-size: 13px; }
.pattern-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

/* ---- GAUGE ---- */
.gauge-card { text-align: center; padding: 20px; }
.gauge-card canvas { margin: 0 auto; display: block; }
.gauge-label { font-size: 20px; font-weight: 700; margin-top: 8px; }
.gauge-compare {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.gauge-compare strong { color: var(--text); }

/* ---- FORECAST ---- */
.forecast-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.forecast-confidence { font-size: 13px; color: var(--text-secondary); }
.forecast-confidence strong { color: var(--cyan); }
.forecast-sentiment { font-size: 13px; margin-bottom: 8px; }

/* ---- SCENARIO BUILDER ---- */
.scenario-builder { margin-top: 8px; }
.slider-group { margin-bottom: 14px; }
.slider-group label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.slider-group strong { color: var(--text); font-family: 'JetBrains Mono', monospace; }
.slider {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  border: 2px solid var(--bg);
}
.scenario-result-box { text-align: center; }
.scenario-projected { margin-bottom: 8px; }
.scenario-price { font-family: 'JetBrains Mono', monospace; font-size: 32px; font-weight: 700; }
.scenario-impact { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 600; }

/* ---- PORTFOLIO ---- */
.portfolio-summary { text-align: center; padding: 20px; }
.portfolio-value { font-family: 'JetBrains Mono', monospace; font-size: 32px; font-weight: 700; }
.portfolio-gain { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 500; margin-top: 4px; }
.allocation-container { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.allocation-container canvas { flex-shrink: 0; }
.allocation-legend { display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.holding-card {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  position: relative;
}
.holding-left { flex: 1; cursor: pointer; }
.holding-symbol { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px; }
.holding-shares { font-size: 12px; color: var(--text-muted); }
.holding-right { text-align: right; margin-right: 8px; }
.holding-value { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 14px; }
.holding-gain { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.holding-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: color 0.2s;
}
.holding-delete:hover { color: var(--red); }
.optimizer-score { font-size: 14px; margin: 8px 0; }
.optimizer-score strong { color: var(--green); font-family: 'JetBrains Mono', monospace; }
.optimizer-suggestions { margin-top: 12px; }
.suggestion-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: var(--elevated);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.suggestion-high { border-left: 3px solid var(--red); }
.suggestion-medium { border-left: 3px solid var(--yellow); }
.suggestion-low { border-left: 3px solid var(--cyan); }
.suggestion-none { border-left: 3px solid var(--green); }

/* ---- EARNINGS ---- */
.earnings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.earnings-qtr { font-weight: 600; font-size: 14px; }
.earnings-surprise { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; }
.earnings-summary { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-top: 10px; }

/* ---- WATCHLIST ---- */
.page-section { padding-top: 12px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.page-header-row { display: flex; justify-content: space-between; align-items: center; }
.upgrade-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.upgrade-icon { font-size: 28px; }
.upgrade-text p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; color: var(--text); }
.empty-state p { margin-bottom: 16px; }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-container {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.active .modal-container { transform: translateY(0); }
.modal-full {
  max-height: 95vh;
  border-radius: 20px 20px 0 0;
}
.modal-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.modal-close {
  background: var(--elevated);
  border: none;
  color: var(--text);
  font-size: 22px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}
.modal-title { font-size: 18px; font-weight: 700; }

/* ---- PAYWALL ---- */
.paywall-content { text-align: center; }
.paywall-hero { margin-bottom: 20px; }
.paywall-crown { font-size: 48px; margin-bottom: 8px; }
.paywall-hero h2 { font-size: 22px; font-weight: 700; }
.paywall-features { text-align: left; margin-bottom: 24px; }
.paywall-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.pf-icon { font-size: 18px; }
.paywall-plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.plan-btn {
  background: var(--elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  cursor: pointer;
  text-align: center;
  color: var(--text);
  transition: all 0.2s;
  position: relative;
}
.plan-btn:hover { border-color: var(--green); }
.plan-popular { border-color: var(--green); }
.plan-tag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.plan-price { font-family: 'JetBrains Mono', monospace; font-size: 20px; font-weight: 700; }
.plan-price span { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.plan-name { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.paywall-footer { margin-top: 12px; }
.restore-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- PRO LOCK ---- */
.pro-lock {
  font-size: 10px;
  background: linear-gradient(135deg, var(--gold), #FF9800);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 6px;
}
.pro-gate-msg {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}
.pro-gate-msg:hover { border-color: var(--gold); }
.pro-card { position: relative; }


/* ---- SEARCH MODAL ---- */
.search-modal-content { min-height: 40vh; }
.search-input-wrap {
  position: relative;
  margin-bottom: 12px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}
.search-input {
  width: 100%;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 14px 42px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--green); }
.search-input::placeholder { color: var(--text-muted); }
.search-hints { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.search-hint {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.search-hint:hover { background: var(--green); color: #000; border-color: var(--green); }
.search-results { max-height: 50vh; overflow-y: auto; }
.search-bar-inline { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar-inline .form-input { flex: 1; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.form-input, .form-select {
  width: 100%;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus { border-color: var(--green); }
.form-input::placeholder { color: var(--text-muted); }
.form-select { appearance: none; cursor: pointer; }
.form-select option { background: var(--card); }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--green);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { opacity: 0.9; }
.btn-accent {
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }
.toast-info { border-color: var(--cyan); }

/* ---- SKELETON ---- */
.skeleton-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 8px;
}
.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--elevated) 25%, rgba(255,255,255,0.06) 50%, var(--elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}
.skeleton-line:last-child { margin-bottom: 0; }
.w60 { width: 60%; }
.w40 { width: 40%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- ONBOARDING ---- */
.onboarding {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 24px;
  text-align: center;
  position: relative;
}
.onboarding-skip {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.onboarding-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.onboarding-icon { font-size: 72px; margin-bottom: 24px; }
.onboarding-title { font-size: 26px; font-weight: 700; margin-bottom: 12px; line-height: 1.2; }
.onboarding-desc { font-size: 15px; color: var(--text-secondary); max-width: 300px; line-height: 1.5; }
.onboarding-dots { display: flex; gap: 8px; margin: 32px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.2); transition: all 0.3s; }
.dot.active { background: var(--green); width: 24px; border-radius: 4px; }
.onboarding-btn { max-width: 280px; }

/* ---- ADMIN ---- */
.admin-panel { max-height: 70vh; }
.admin-section { margin-bottom: 20px; }
.admin-section h3 { font-size: 15px; margin-bottom: 10px; }
.source-list { display: flex; flex-direction: column; gap: 6px; }
.source-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--elevated);
  border-radius: 6px;
  font-size: 13px;
}
.source-item span:last-child { margin-left: auto; }
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.source-dot.demo { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.flag-list { display: flex; flex-direction: column; gap: 8px; }
.flag-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.flag-item input[type="checkbox"] { accent-color: var(--green); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-footer { text-align: center; padding-top: 12px; border-top: 1px solid var(--border); }

/* ---- ALERT FORM ---- */
.alert-form p { margin-bottom: 16px; }

/* ---- UTILITIES ---- */
.text-muted { color: var(--text-muted); }
.mt16 { margin-top: 16px; }
.loading-center { padding: 20px 0; }

/* ---- RESPONSIVE DESKTOP ---- */
@media (min-width: 768px) {
  .tab-bar {
    max-width: 480px;
    margin: 0 auto;
    border-radius: 16px 16px 0 0;
  }
  .app-header {
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
  }
  .modal-container {
    max-width: 520px;
    border-radius: 20px;
    margin-bottom: 40px;
  }
  .modal-overlay { align-items: center; }
  .asset-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
}
@media (min-width: 1200px) {
  .asset-list { grid-template-columns: repeat(3, 1fr); }
}


/* ============================================================
   v2.1 ADDITIONS — Admin Dashboard, Settings, Polish
   ============================================================ */

/* ---- LOGO IMAGE ---- */
.logo-img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

/* ---- MAINTENANCE SCREEN ---- */
.maintenance-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  text-align: center;
  padding: 40px;
}
.maintenance-icon { font-size: 64px; margin-bottom: 20px; }
.maintenance-screen h1 { font-size: 24px; margin-bottom: 12px; }
.maintenance-screen p { color: var(--text-secondary); max-width: 340px; line-height: 1.5; }

/* ---- SETTINGS ---- */
.settings-content { max-height: 70vh; }
.settings-section { margin-bottom: 24px; }
.settings-section h3 { font-size: 15px; margin-bottom: 10px; }
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.settings-item:last-child { border-bottom: none; }
.settings-value { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ---- ALERT ITEMS ---- */
.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--elevated);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.btn-remove-alert {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}
.btn-remove-alert:hover { color: var(--red); }
.existing-alerts { margin-top: 12px; }

/* ---- DANGER BUTTONS ---- */
.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  width: auto;
}
.btn-danger:hover { opacity: 0.9; }
.btn-danger-outline {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  width: auto;
}
.btn-danger-outline:hover { background: rgba(242,77,87,0.1); }

/* ---- FORM TEXTAREA ---- */
.form-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

/* ================================================================
   ADMIN DASHBOARD
   ================================================================ */
.admin-dashboard { max-height: 75vh; overflow-y: auto; }
.admin-dashboard::-webkit-scrollbar { width: 0; }

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.admin-tab.active {
  background: var(--green);
  color: #000;
  border-color: var(--green);
  font-weight: 600;
}

#admin-content { max-height: 60vh; overflow-y: auto; }
#admin-content::-webkit-scrollbar { width: 0; }

/* KPI Grid */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
@media (min-width: 500px) { .admin-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
.admin-kpi {
  background: var(--elevated);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}
.admin-kpi.kpi-highlight {
  grid-column: span 1;
  background: linear-gradient(135deg, rgba(51,217,140,0.08), rgba(77,192,242,0.08));
  border-color: rgba(51,217,140,0.2);
}
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.kpi-value { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; }
.kpi-value.kpi-large { font-size: 28px; }
.kpi-change { font-size: 11px; font-weight: 500; margin-top: 2px; }

/* Admin Section */
.admin-section { margin-bottom: 24px; }
.admin-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* Platform Rows */
.platform-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.platform-name { width: 70px; font-size: 13px; font-weight: 500; }
.platform-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.platform-bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s; }
.platform-pct { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-secondary); width: 120px; text-align: right; }

/* Retention Grid */
.retention-grid { display: flex; flex-direction: column; gap: 8px; }
.retention-item { display: flex; align-items: center; gap: 10px; }
.retention-period { width: 60px; font-size: 12px; color: var(--text-secondary); }
.retention-bar-track { flex: 1; height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.retention-bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s; }
.retention-rate { font-family: 'JetBrains Mono', monospace; font-size: 13px; width: 50px; text-align: right; }

/* Admin Table */
.admin-table { overflow-x: auto; }
.table-header {
  display: grid;
  grid-template-columns: 60px 1fr 80px 100px;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.table-row {
  display: grid;
  grid-template-columns: 60px 1fr 80px 100px;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.table-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Admin Legend */
.admin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

/* Revenue Breakdown */
.revenue-breakdown { display: flex; flex-direction: column; gap: 12px; }
.revenue-plan {
  background: var(--elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.revenue-plan-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}
.revenue-plan-amount { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--green); }

/* Feature Flags */
.flag-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.flag-toggle:hover { background: var(--card); }
.flag-toggle input[type="checkbox"] { accent-color: var(--green); width: 18px; height: 18px; }
.flag-danger { border-left: 3px solid var(--red); }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Admin Actions Grid */
.admin-actions-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Featured List */
.featured-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.featured-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--elevated);
  border-radius: 6px;
}
.featured-drag { color: var(--text-muted); cursor: grab; font-size: 16px; }
.featured-symbol { font-family: 'JetBrains Mono', monospace; font-weight: 600; flex: 1; }
.featured-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.featured-remove:hover { color: var(--red); }
.admin-add-row { display: flex; gap: 8px; }

/* Curated List */
.curated-list { display: flex; flex-direction: column; gap: 6px; }
.curated-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
}
.curated-name { font-weight: 600; font-size: 14px; }
.curated-symbols { font-size: 12px; margin-top: 2px; }

/* News Highlights */
.news-highlight-list { display: flex; flex-direction: column; gap: 6px; }
.news-highlight-item { display: flex; gap: 8px; align-items: center; }
.news-highlight-item .form-input { flex: 1; }

/* API Grid */
.api-grid { display: flex; flex-direction: column; gap: 10px; }
.api-card {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.api-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.api-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.api-status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.api-status-dot.demo { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.api-status-dot.error { background: var(--red); box-shadow: 0 0 8px var(--red); }
.api-name { font-weight: 600; font-size: 14px; flex: 1; }
.api-status-label { font-size: 12px; color: var(--text-muted); }
.api-details { display: flex; flex-direction: column; gap: 4px; }
.api-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 2px 0;
}

/* Notification History */
.notif-history { display: flex; flex-direction: column; gap: 8px; }
.notif-history-item {
  padding: 12px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
}
.notif-history-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.notif-history-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }

/* Feedback */
.feedback-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.feedback-list { display: flex; flex-direction: column; gap: 6px; }
.feedback-item {
  padding: 12px;
  background: var(--elevated);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
}
.feedback-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feedback-type { font-size: 16px; }
.feedback-title { flex: 1; font-weight: 500; font-size: 14px; }
.feedback-priority { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.feedback-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; flex-wrap: wrap; }

/* ---- ADMIN FOOTER ---- */
.admin-footer {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
