/* ============================================================
   MarketBubbles — Multi-Asset Portfolio Visualizer
   style.css — Design system, layout, components, responsive
   ============================================================ */

/* ─── CSS Custom Properties ─── */
:root {
  --bg:            #0b1120;
  --surface:       #1e293b;
  --surface-2:     #334155;
  --border:        #475569;
  --accent:        #ea580c;
  --accent-hover:  #f97316;
  --accent-subtle: rgba(234, 88, 12, 0.15);
  --accent-glow:   rgba(234, 88, 12, 0.3);
  --green:         #22c55e;
  --red:           #ef4444;
  --amber:         #eab308;
  --blue:          #3b82f6;
  --text:          #f0f0f0;
  --text-secondary:#cccccc;
  --muted:         #94a3b8;
  --dim:           #64748b;

  --font-display:  'Bricolage Grotesque', sans-serif;
  --font-mono:     'DM Mono', monospace;

  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  48px;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  16px;

  --shadow-card:  0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow:  0 0 20px rgba(234, 88, 12, 0.15);

  --glass-bg:      rgba(30, 41, 59, 0.6);
  --glass-blur:    blur(14px);
  --glass-border:  rgba(71, 85, 105, 0.4);

  --header-height: 60px;
  --ticker-height: 32px;
  --mobile-pills-height: 80px;
}


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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection {
  background: var(--accent-subtle);
  color: var(--text);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }


/* ─── Loading Screen ─── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: var(--space-md);
  transition: opacity 0.4s, visibility 0.4s;
}
.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loading-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.loading-icon {
  color: var(--accent);
  font-size: 2.5rem;
  animation: pulse 2s ease-in-out infinite;
}
.loading-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.5px;
}


/* ─── Header ─── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}

.header-left { display: flex; align-items: center; }
.header-center { display: flex; align-items: center; gap: var(--space-lg); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.header-center::-webkit-scrollbar { display: none; }
.header-right { display: flex; align-items: center; gap: var(--space-sm); }

/* Refresh progress bar */
.refresh-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}
.refresh-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), rgba(234, 88, 12, 0.6));
  border-radius: 0 1px 1px 0;
  box-shadow: 0 0 6px rgba(234, 88, 12, 0.4);
  transform-origin: left;
  transform: scaleX(0);
  will-change: transform;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.15rem;
  white-space: nowrap;
}
.logo-icon {
  color: var(--accent);
  font-size: 1.4rem;
}
.logo-img {
  border-radius: 4px;
  flex-shrink: 0;
}
.logo-accent { color: var(--accent); }


/* ─── Ticker Banner ─── */
.ticker-banner {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 95;
  height: var(--ticker-height);
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.12) 0%, rgba(15, 23, 42, 0.95) 8%, rgba(15, 23, 42, 0.95) 92%, rgba(234, 88, 12, 0.12) 100%);
  border-bottom: 1px solid rgba(234, 88, 12, 0.15);
  overflow: hidden;
}

.ticker-label {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  padding: 0 12px;
  opacity: 0.7;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
}

.ticker-content {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  animation: tickerSlide var(--ticker-duration, 30s) linear infinite;
  width: max-content;
}

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

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

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
  padding: 2px 0;
}
.ticker-item:hover {
  color: var(--accent-hover);
}

.ticker-item .ticker-badge {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.ticker-badge.new-drop {
  background: rgba(234, 88, 12, 0.2);
  color: var(--accent-hover);
  border: 1px solid rgba(234, 88, 12, 0.3);
}
.ticker-badge.ipo {
  background: rgba(59, 130, 246, 0.2);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.ticker-badge.presale {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.ticker-badge.promo {
  background: rgba(34, 197, 94, 0.2);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.ticker-ad-logo {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.ticker-item .ticker-name {
  font-weight: 600;
  color: var(--text);
}

.ticker-item .ticker-sep {
  color: var(--dim);
  font-size: 0.6rem;
}


/* ─── Pill Buttons ─── */
.pill-group {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 2px;
  flex-shrink: 0;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 12px;
  min-height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.pill:hover {
  color: var(--text);
  background: var(--surface-2);
}
.pill.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}


/* ─── Search Box ─── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 7px 12px 7px 32px;
  width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, width 0.3s;
}
.search-box input:focus {
  border-color: var(--accent);
  width: 240px;
}
.search-box input::placeholder { color: var(--dim); }


/* ─── Icon Button ─── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
}


/* ─── Dropdown ─── */
.dropdown {
  position: relative;
}
.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
  white-space: nowrap;
}
.dropdown-btn:hover { border-color: var(--accent); }
.chevron { transition: transform 0.2s; }
.dropdown.open .chevron { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-xs);
  display: none;
  z-index: 200;
}
.dropdown.open .dropdown-menu { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.active { color: var(--accent); }
.dropdown-action { color: var(--accent); }

.dropdown-ad-cta {
  background: linear-gradient(135deg, #16a34a, #22c55e) !important;
  color: white !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  margin: 4px;
  transition: all 0.2s !important;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.dropdown-ad-cta:hover {
  background: linear-gradient(135deg, #15803d, #16a34a) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

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


/* ─── Hamburger (mobile only) ─── */
.hamburger { display: none; }


/* ─── Mobile Menu Overlay ─── */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.mobile-menu.open { transform: translateX(0); }

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.mobile-menu-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  overflow-y: auto;
}

.mobile-search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.mobile-search-box .search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.mobile-search-box input {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 12px 16px 12px 40px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  outline: none;
}
.mobile-search-box input:focus { border-color: var(--accent); }

.mobile-section { display: flex; flex-direction: column; gap: var(--space-sm); }
.mobile-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.mobile-portfolio-list { display: flex; flex-direction: column; gap: 2px; }

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  font-family: var(--font-display);
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
}
.mobile-menu-item:hover { background: var(--surface); }


/* ─── Mobile Pill Bar ─── */
.mobile-pills {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 90;
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  flex-direction: column;
  gap: var(--space-xs);
}
.pill-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pill-scroll::-webkit-scrollbar { display: none; }


/* ─── Canvas Container ─── */
.canvas-container {
  position: fixed;
  top: calc(var(--header-height) + var(--ticker-height));
  left: 0;
  right: 0;
  bottom: 28px;
  overflow: hidden;
}

#bubble-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

.hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.2;
  filter: blur(80px);
}


/* ─── Sample Data Badge ─── */
.sample-badge {
  position: absolute;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 4px 12px;
  background: var(--amber);
  color: #000;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 10;
}


/* ─── Empty State ─── */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
}
.empty-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.empty-subtitle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}


/* ─── API Prompt ─── */
.api-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  max-width: 360px;
}
.api-prompt-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.api-prompt-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}


/* ─── Buttons ─── */
.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}
.btn-danger {
  background: transparent;
  color: var(--red);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}


/* ─── Detail Panel ─── */
.detail-panel {
  position: fixed;
  top: calc(var(--header-height) + var(--ticker-height));
  right: 0;
  bottom: 0;
  width: 340px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--glass-border);
  z-index: 80;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}
.detail-panel.open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.detail-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
}
.detail-image-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.detail-name {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}
.detail-symbol {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
}

.detail-body {
  padding: var(--space-lg);
  padding-bottom: 80px; /* extra space so content doesn't hide behind FAB */
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  flex: 1;
  overflow-y: auto;
}

.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
}
.detail-price {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
}
.detail-change {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}
.detail-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.detail-stat-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.detail-portfolio-add { position: relative; }

.portfolio-popover {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-xs);
  z-index: 200;
}


/* ─── Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  transition: opacity 0.2s;
}
.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal {
  width: 90%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}


/* ─── Form Elements ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.form-label {
  font-size: 0.9rem;
  font-weight: 600;
}
.form-help {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.form-input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--dim); }


/* ─── Portfolio Manager ─── */
.portfolio-manager-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.portfolio-manager-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.portfolio-manager-item .portfolio-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.portfolio-manager-item .portfolio-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: 10px;
}

.portfolio-new-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.portfolio-new-row .form-input { flex: 1; }


/* ─── Toast ─── */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.toast.error { border-color: var(--red); }
.toast.success { border-color: var(--green); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ─── View Toggle ─── */
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.view-btn:hover { color: var(--text); }
.view-btn.active {
  background: var(--accent);
  color: white;
}


/* ─── Table View ─── */
.table-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 5;
  background: var(--bg);
}

.table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.asset-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.asset-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.asset-table th {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  white-space: nowrap;
  cursor: default;
  user-select: none;
  position: relative;
}

.asset-table th.sortable {
  cursor: pointer;
  transition: color 0.2s;
}
.asset-table th.sortable:hover { color: var(--text); }
.asset-table th.sorted { color: var(--accent); }

.asset-table th.sorted::after {
  content: '';
  display: inline-block;
  margin-left: 4px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}
.asset-table th.sorted.asc::after {
  border-bottom: 5px solid var(--accent);
}
.asset-table th.sorted.desc::after {
  border-top: 5px solid var(--accent);
}

.asset-table th.col-rank,
.asset-table td.col-rank {
  text-align: center;
  width: 40px;
  color: var(--dim);
}

.asset-table th.col-name,
.asset-table td.col-name {
  text-align: left;
  min-width: 180px;
}

.asset-table td {
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid rgba(71, 85, 105, 0.15);
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.asset-table tbody tr {
  transition: background 0.15s;
  cursor: pointer;
}
.asset-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.4);
}

/* Name cell with logo */
.table-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.table-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  flex-shrink: 0;
  object-fit: cover;
}
.table-name-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.table-fullname {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}
.table-symbol {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* Star / favourite */
.table-star {
  width: 28px;
  text-align: center;
  cursor: pointer;
  color: var(--dim);
  font-size: 0.85rem;
  transition: color 0.2s;
}
.table-star:hover { color: var(--amber); }
.table-star.active { color: var(--amber); }

/* Price column */
.table-price {
  font-weight: 600;
  color: var(--text);
}

/* Change columns — green/red with arrows */
.table-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
}
.table-change-pos { color: #16c784; }
.table-change-neg { color: #ea3943; }
.table-change-neutral { color: var(--muted); }

.table-arrow {
  font-size: 0.55rem;
  line-height: 1;
}

/* Active period column highlight */
.asset-table th.col-active {
  color: var(--accent);
  background: rgba(234, 88, 12, 0.08);
}
.col-active-cell {
  background: rgba(234, 88, 12, 0.06);
}

/* Market cap / volume */
.table-mcap,
.table-volume {
  color: var(--text-secondary);
}

/* Responsive: hide columns on mobile */
@media (max-width: 768px) {
  .col-hide-mobile { display: none; }
  .asset-table { min-width: 600px; }
  .view-toggle { display: none; }
}


/* ─── Sign In Button ─── */
.btn-signin {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-signin:hover {
  background: var(--accent);
  color: white;
}


/* ─── User Avatar & Menu ─── */
.user-menu { position: relative; }
.user-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  transition: box-shadow 0.2s;
}
.user-avatar-btn:hover .user-avatar {
  box-shadow: 0 0 0 2px var(--accent-hover);
}

.user-menu-header {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-menu-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}
.user-menu-email {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}


/* ─── Auth Modal ─── */
.modal-auth { max-width: 400px; }

.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: var(--space-lg);
}
.auth-tab {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active {
  background: var(--surface-2);
  color: var(--text);
}

.btn-google {
  width: 100%;
  padding: 10px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s;
}
.btn-google:hover { background: #f5f5f5; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }
.auth-submit { width: 100%; padding: 10px; font-size: 0.85rem; }

.auth-error {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red);
  text-align: center;
  padding: var(--space-sm);
  margin-top: var(--space-sm);
}


/* ─── Ad Placement Modal ─── */
.modal-ad { max-width: 480px; }

.ad-steps {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}
.ad-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--dim);
  padding: 6px 0;
  border-bottom: 2px solid var(--border);
  transition: all 0.2s;
}
.ad-step.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.ad-step.done {
  color: var(--green);
  border-bottom-color: var(--green);
}
.ad-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 0.65rem;
  font-weight: 700;
}
.ad-step.active span { background: var(--accent); color: white; }
.ad-step.done span { background: var(--green); color: white; }

.ad-step-content { display: flex; flex-direction: column; gap: var(--space-md); }

.ad-duration-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}
.ad-duration-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.ad-duration-card:hover { border-color: var(--accent); }
.ad-duration-card.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.ad-duration-card .duration-days {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.ad-duration-card .duration-price {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.ad-step-buttons {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}
.ad-step-buttons .btn { flex: 1; justify-content: center; }

.ad-preview-strip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  overflow: hidden;
  margin: var(--space-sm) 0;
}

.ad-summary {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
  text-align: center;
}

/* Ad logo upload */
.ad-logo-upload { cursor: pointer; }
.ad-logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 64px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  transition: all 0.2s;
  overflow: hidden;
}
.ad-logo-preview:hover {
  border-color: var(--accent);
  color: var(--text);
}
.ad-logo-preview.has-image {
  border-style: solid;
  border-color: var(--green);
  padding: 4px;
}
.ad-logo-preview.has-image img {
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.btn-pay {
  background: var(--green);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.btn-pay:hover { background: #16a34a; }

.form-input select,
select.form-input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  appearance: none;
  cursor: pointer;
}
select.form-input:focus { border-color: var(--accent); }
select.form-input option { background: var(--surface); color: var(--text); }


/* ─── Custom Asset Modal ─── */
.modal-custom-asset { max-width: 520px; }

.pill-group-wrap { flex-wrap: wrap; }

.pill-add {
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(234, 88, 12, 0.15);
  color: var(--accent);
  border: 1px dashed var(--accent);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.pill-add:hover {
  background: rgba(234, 88, 12, 0.3);
  border-style: solid;
}

.ca-postcode-row {
  display: flex;
  gap: 8px;
}
.ca-postcode-row .form-input { flex: 1; }
.ca-postcode-row .btn { white-space: nowrap; }

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group { flex: 1; }

.form-help {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}
.form-help.success { color: var(--green); }
.form-help.error { color: var(--red); }

textarea.form-input {
  resize: vertical;
  font-family: var(--font-mono);
  min-height: 48px;
}

.btn-portfolio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(55, 55, 70, 0.5);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-portfolio:hover { color: var(--accent); border-color: var(--accent); }
.btn-portfolio-active { color: var(--accent); border-color: var(--accent); background: rgba(234, 88, 12, 0.1); }
.btn-portfolio-active svg { fill: var(--accent); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
}

/* Custom asset badge in table */
.ca-badge {
  display: inline-block;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  background: rgba(234, 88, 12, 0.2);
  color: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

#ca-property-fields.hidden { display: none; }
#ca-pension-fields.hidden { display: none; }

.pension-projection {
  background: rgba(234, 88, 12, 0.08);
  border: 1px solid rgba(234, 88, 12, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.6;
}
.pension-projection:empty { display: none; }
.pension-projection .proj-label { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; }
.pension-projection .proj-value { color: var(--accent); font-weight: 700; font-size: 1rem; }
.pension-projection .proj-row { display: flex; justify-content: space-between; align-items: baseline; }

/* ─── Property Sub-Filter Bar ─── */
.property-filter-bar {
  position: fixed;
  top: calc(var(--header-height) + var(--ticker-height));
  left: 0;
  right: 0;
  z-index: 500;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  transition: opacity 0.2s, transform 0.2s;
}
.property-filter-bar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
}

.property-filter-inner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.property-filter-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pill-group-sm {
  gap: 1px;
  padding: 1px;
}
.pill-group-sm .pill {
  font-size: 0.7rem;
  padding: 4px 10px;
}

.property-filter-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: var(--space-xs);
}

/* Shift canvas/table down when filter bar is showing */
.property-filter-active #canvas-container,
.property-filter-active #table-view,
.property-filter-active #empty-state,
.property-filter-active #api-prompt,
.property-filter-active #sample-badge {
  margin-top: 38px;
}


/* ─── New Launches pill ─── */
.pill-launch.active { background: rgba(212, 160, 23, 0.25); color: #d4a017; }

/* ─── Sponsored Launches Strip (removed — now a tab) ─── */
.sponsored-strip {
  position: fixed;
  top: calc(var(--header-height) + var(--ticker-height));
  left: 0;
  right: 0;
  z-index: 55;
  height: 44px;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, rgba(234, 155, 12, 0.06), rgba(15, 23, 42, 0.95) 15%, rgba(15, 23, 42, 0.95) 85%, rgba(234, 155, 12, 0.06));
  border-bottom: 1px solid rgba(234, 155, 12, 0.15);
  overflow: hidden;
}
.sponsored-strip.hidden { display: none; }

.sponsored-strip-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 800;
  color: #d4a017;
  letter-spacing: 1px;
  padding: 0 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sponsored-strip-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-right: 16px;
  flex: 1;
}
.sponsored-strip-scroll::-webkit-scrollbar { display: none; }

.sponsored-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
  flex-shrink: 0;
}
.sponsored-item:hover { background: rgba(255, 255, 255, 0.05); }

.sponsored-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sponsored-logo-placeholder {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(234, 155, 12, 0.2);
  color: #d4a017;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sponsored-badge {
  font-size: 0.5rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}
.sponsored-badge.new-drop { background: rgba(234, 155, 12, 0.2); color: #d4a017; }
.sponsored-badge.ipo { background: rgba(59, 130, 246, 0.2); color: var(--blue, #3b82f6); }
.sponsored-badge.presale { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.sponsored-badge.promo { background: rgba(34, 197, 94, 0.2); color: var(--green); }

.sponsored-name { font-weight: 700; color: #d4a017; }
.sponsored-desc { color: var(--muted); font-size: 0.65rem; }
.sponsored-change-pos { color: var(--green); font-weight: 600; }
.sponsored-change-neg { color: var(--red); font-weight: 600; }

/* Shift canvas down when strip is visible */
.sponsored-strip-active .canvas-container {
  top: calc(var(--header-height) + var(--ticker-height) + 44px);
}

/* ─── Sponsored Modal ─── */
.modal-sponsored { max-width: 520px; }

.sponsored-duration-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-xs);
}
@media (max-width: 768px) {
  .sponsored-duration-grid { grid-template-columns: repeat(3, 1fr); }
}

.sp-duration-card {
  padding: 14px 8px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-mono);
}
.sp-duration-card:hover { border-color: var(--accent); }
.sp-duration-card.selected { border-color: #d4a017; background: rgba(234, 155, 12, 0.08); }
.sp-duration-days { font-size: 0.75rem; font-weight: 700; display: block; color: var(--text); }
.sp-duration-price { font-size: 0.9rem; font-weight: 800; display: block; margin-top: 4px; color: #d4a017; }

.sp-step-content.hidden { display: none; }

/* Sponsored preview bubble */
.sp-preview-bubble {
  height: 120px;
  background: var(--bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.sp-preview-strip {
  background: rgba(234, 155, 12, 0.05);
  border: 1px solid rgba(234, 155, 12, 0.2);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
}

/* Dropdown CTA for sponsored */
.dropdown-sponsored-cta {
  color: #d4a017 !important;
  font-weight: 600;
}

/* ─── Block / Treemap View ─── */
.block-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 3px;
  z-index: 5;
  background: var(--bg);
}

.block-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  height: 100%;
  align-content: stretch;
}

.block-item {
  position: relative;
  min-width: 50px;
  min-height: 44px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.15s;
  padding: 6px 4px;
  flex-grow: 1;
}
.block-item:hover { filter: brightness(1.2); }
.block-item:active { filter: brightness(0.9); }

.block-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.block-logo-fallback {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.block-symbol {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.block-name {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.block-change {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Large blocks get bigger text */
.block-item.block-lg .block-logo, .block-item.block-lg .block-logo-fallback { width: 32px; height: 32px; font-size: 0.8rem; }
.block-item.block-lg .block-symbol { font-size: 1rem; }
.block-item.block-lg .block-name { font-size: 0.65rem; }
.block-item.block-lg .block-change { font-size: 0.8rem; }

.block-item.block-md .block-logo, .block-item.block-md .block-logo-fallback { width: 26px; height: 26px; }
.block-item.block-md .block-symbol { font-size: 0.8rem; }
.block-item.block-md .block-change { font-size: 0.7rem; }

@media (max-width: 768px) {
  .block-item { min-width: 44px; min-height: 44px; }
}


/* ─── Detail Holdings Section ─── */
.detail-holdings-section {
  background: rgba(234, 88, 12, 0.06);
  border: 1px solid rgba(234, 88, 12, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow: hidden;
}
.detail-holdings-header {
  margin-bottom: 8px;
}
.detail-holdings-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
}
.detail-holdings-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.detail-holdings-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.detail-holdings-val {
  font-weight: 700;
  color: var(--text);
}
.detail-holdings-lots {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(234, 88, 12, 0.15);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.detail-holding-lot {
  display: flex;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}
.lot-qty { font-weight: 600; color: var(--text); }
.lot-pl { margin-left: auto; font-weight: 600; }


/* ─── Detail Chart ─── */
.detail-chart {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  position: relative;
  min-height: 180px;
}
.detail-chart-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
.detail-chart-wrap {
  height: 150px;
  position: relative;
}
.detail-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.detail-chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.detail-chart-loading.hidden { display: none; }


/* ─── Holdings Form Popover ─── */
.holdings-form-popover {
  position: fixed;
  z-index: 650;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  padding: 14px;
  transition: opacity 0.15s, transform 0.15s;
}
.holdings-form-popover.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.95);
}

.holdings-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.holdings-form-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.holdings-form-asset {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.holdings-form-asset:empty { display: none; }
.holdings-form-select {
  margin-bottom: 10px;
  font-size: 0.78rem;
}
.holdings-form-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.holdings-form-row {
  display: flex;
  gap: 8px;
}
.holdings-form-row .holdings-field { flex: 1; }
.holdings-field span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
}
.holdings-field .form-input {
  font-size: 0.8rem;
  padding: 7px 10px;
}
.holdings-form-actions {
  display: flex;
  gap: 6px;
}
.holdings-form-actions .btn { flex: 1; text-align: center; }

@media (max-width: 768px) {
  .holdings-form-popover {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(0);
  }
  .holdings-form-popover.hidden { transform: translateY(100%); }
}

/* ─── Holdings Table Columns ─── */
.col-holdings { display: none; }
.asset-table.portfolio-active .col-holdings { display: table-cell; }
th.col-holdings { font-size: 0.7rem; }
td.col-holdings { font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
td.col-holdings-pl { font-weight: 600; }


/* ─── Net Worth FAB + Panel ─── */
.networth-fab {
  position: fixed;
  bottom: 44px;
  right: 16px;
  z-index: 90;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.networth-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(234, 88, 12, 0.5); }
.networth-fab:active { transform: scale(0.95); }
.detail-open .networth-fab { opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.detail-open .networth-panel { opacity: 0; pointer-events: none; }

.networth-panel {
  position: fixed;
  bottom: 100px;
  right: 16px;
  z-index: 91;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s, transform 0.2s;
  overflow: hidden;
}
.networth-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.95);
}

.networth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}
.networth-header h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0;
}

.networth-total {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  padding: 0 16px;
  line-height: 1.2;
}

.networth-change {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 2px 16px 12px;
}

.networth-breakdown {
  padding: 0 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.nw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.nw-row-label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.nw-row-icon { font-size: 0.9rem; }
.nw-row-value { font-weight: 700; color: var(--text); }
.nw-row-change { font-size: 0.65rem; margin-left: 4px; }
.nw-row-change.pos { color: var(--green); }
.nw-row-change.neg { color: var(--red); }

.networth-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  padding: 6px 16px 12px;
  margin: 0;
  text-align: center;
}

@media (max-width: 768px) {
  .networth-panel { left: 16px; right: 16px; width: auto; bottom: 90px; }
  .networth-fab { bottom: 36px; right: 12px; width: 42px; height: 42px; }
}


/* ─── Sponsored Detail Panel Section ─── */
.detail-sponsored-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.detail-sponsored-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-sponsored-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: #d4a017;
  letter-spacing: 1px;
}
.detail-sponsored-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.detail-visit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
  background: #d4a017;
  color: #0b1120;
  font-weight: 700;
}
.detail-visit-btn:hover { background: #b8891a; }


@keyframes sp-glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(212,160,23,0.5), 0 0 40px rgba(212,160,23,0.2); }
  50% { box-shadow: 0 0 30px rgba(212,160,23,0.7), 0 0 60px rgba(212,160,23,0.3); }
}


/* ─── PWA Install Banner ─── */
.pwa-install-banner {
  position: fixed;
  bottom: 36px;
  left: 12px;
  right: 12px;
  z-index: 700;
  transition: opacity 0.3s, transform 0.3s;
}
.pwa-install-banner.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}
.pwa-install-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(234, 88, 12, 0.2);
}
.pwa-install-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex-shrink: 0;
}
.pwa-install-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
}
.pwa-install-text strong { color: var(--text); }
.pwa-install-ios { color: var(--muted); display: block; font-size: 0.72rem; margin-top: 4px; line-height: 1.7; }
.pwa-install-btn-wrap { display: block; margin-top: 6px; }
.pwa-install-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 4px 4px 8px;
  line-height: 1;
  flex-shrink: 0;
}
.pwa-install-close:hover { color: var(--text); }

/* Animated arrow pointing down to Safari share button */
.pwa-install-arrow {
  text-align: center;
  padding-top: 4px;
  animation: pwa-bounce 1.2s ease-in-out infinite;
}
@keyframes pwa-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}


/* ─── Theme Switcher UI ─── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-sm);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-swatch:hover { border-color: var(--muted); }
.theme-swatch.active { border-color: var(--accent); }
.swatch-preview {
  width: 40px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid;
}
.swatch-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
}
.theme-swatch.active .swatch-label { color: var(--accent); }


/* ─── Theme: Dark (pure black) ─── */
body.theme-dark {
  --bg:            #111111;
  --surface:       #1a1a1a;
  --surface-2:     #262626;
  --border:        #333333;
  --text:          #e8e8e8;
  --text-secondary:#bbbbbb;
  --muted:         #888888;
  --dim:           #555555;
  --glass-bg:      rgba(26, 26, 26, 0.7);
  --glass-border:  rgba(51, 51, 51, 0.5);
  --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.5);
}

/* ─── Theme: Slate (grey-purple) ─── */
body.theme-slate {
  --bg:            #1e1e2e;
  --surface:       #2a2a3d;
  --surface-2:     #363650;
  --border:        #4a4a65;
  --text:          #e8e8f0;
  --text-secondary:#c0c0d0;
  --muted:         #8888a0;
  --dim:           #606078;
  --glass-bg:      rgba(42, 42, 61, 0.7);
  --glass-border:  rgba(74, 74, 101, 0.5);
  --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.4);
}

/* ─── Theme: Light ─── */
body.theme-light {
  --bg:            #f0f2f5;
  --surface:       #ffffff;
  --surface-2:     #e8eaed;
  --border:        #d1d5db;
  --text:          #111827;
  --text-secondary:#374151;
  --muted:         #6b7280;
  --dim:           #9ca3af;
  --accent-subtle: rgba(234, 88, 12, 0.1);
  --accent-glow:   rgba(234, 88, 12, 0.15);
  --glass-bg:      rgba(255, 255, 255, 0.8);
  --glass-border:  rgba(209, 213, 219, 0.6);
  --shadow-card:   0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow:   0 0 20px rgba(234, 88, 12, 0.08);
}
body.theme-light .hero-glow { opacity: 0.08; }
body.theme-light .loading-screen { background: var(--bg); }
body.theme-light .sample-badge { color: #333; }
body.theme-light .btn-google { border-color: var(--border); background: #fff; }
body.theme-light .table-change-pos { color: #15803d; }
body.theme-light .table-change-neg { color: #b91c1c; }
body.theme-light .color-green { color: #15803d; }
body.theme-light .color-red { color: #b91c1c; }
body.theme-light .asset-table th { background: var(--surface); }
body.theme-light .asset-table tbody tr:hover { background: rgba(0, 0, 0, 0.03); }
body.theme-light .ticker-banner {
  background: linear-gradient(90deg, rgba(234, 88, 12, 0.06) 0%, rgba(255,255,255,0.95) 8%, rgba(255,255,255,0.95) 92%, rgba(234, 88, 12, 0.06) 100%);
  border-bottom-color: rgba(209, 213, 219, 0.5);
}


/* ─── Footer Stats Bar ─── */
.stats-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}
.stats-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stats-label { color: var(--dim); }
.stats-value { color: var(--text); font-weight: 600; }

@media (max-width: 768px) {
  .stats-footer { gap: var(--space-md); font-size: 0.6rem; }
  .stats-footer .stats-label { display: none; }
}


/* ─── Utility ─── */
.hidden { display: none !important; }

.color-green { color: var(--green); }
.color-red { color: var(--red); }


/* ─── Responsive: Tablet ─── */
@media (max-width: 1024px) {
  .header-center { gap: var(--space-md); }
  .search-box input { width: 140px; }
  .search-box input:focus { width: 180px; }
  .detail-panel { width: 300px; }
}


/* ─── Responsive: Mobile ─── */
@media (max-width: 768px) {
  .header-center { display: none; }
  .search-box { display: none; }
  .dropdown { display: none; }
  #settings-btn { display: none; }
  .hamburger { display: flex; }

  .mobile-pills { display: flex; }

  .ticker-banner {
    top: calc(var(--header-height) + var(--mobile-pills-height));
  }

  .canvas-container {
    top: calc(var(--header-height) + var(--mobile-pills-height) + var(--ticker-height));
  }

  /* Detail panel becomes bottom sheet */
  .detail-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 60vh;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }
  .detail-panel.open { transform: translateY(0); }

  .detail-price { font-size: 1.3rem; }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
  }
  .toast { max-width: none; }
}
