/* ============================================
   CETFA Canadian ETF Screener — Styles
   ============================================ */

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

:root {
  --primary: #003366;
  --primary-light: #004a99;
  --primary-dark: #002244;
  --accent: #D4A843;
  --accent-light: #e6c36a;
  --accent-dark: #b8922e;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f1f3;
  --positive: #10b981;
  --positive-bg: #ecfdf5;
  --negative: #ef4444;
  --negative-bg: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: #c1c5cc;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a0a5ae;
}

/* --- Layout --- */
.layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  gap: 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  cursor: pointer;
}

.header-brand-bar {
  width: 4px;
  height: 32px;
  background: var(--accent);
  border-radius: 2px;
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.header-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 1.5px;
}

.header-brand-tagline {
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}

.header-nav a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.1);
}

.header-nav a.active {
  color: #ffffff;
  background: rgba(255,255,255,0.15);
}

.header-search {
  position: relative;
  flex-shrink: 0;
}

.header-search input {
  width: 240px;
  padding: 7px 14px 7px 36px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  font-size: 13px;
  transition: all var(--transition);
  outline: none;
}

.header-search input::placeholder {
  color: rgba(255,255,255,0.5);
}

.header-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.35);
  width: 280px;
}

.header-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  pointer-events: none;
}

.mobile-menu-toggle {
  display: none;
  color: #ffffff;
  font-size: 20px;
  padding: 8px;
}

/* --- Footer --- */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.6);
  padding: 32px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-brand {
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
}

.footer-brand span {
  color: var(--accent);
}

.footer-disclaimer {
  font-size: 11px;
  line-height: 1.6;
  max-width: 680px;
  color: rgba(255,255,255,0.45);
}

.footer-powered {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.footer-powered a {
  color: var(--accent);
  text-decoration: underline;
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  padding: 20px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-accent {
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--accent-light);
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--card-bg);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-icon {
  padding: 6px 10px;
}

/* --- Pill Buttons / Presets --- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.pill.active {
  background: var(--accent);
  color: var(--primary-dark);
  border-color: var(--accent);
  font-weight: 600;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-equity { background: #dbeafe; color: #1e40af; }
.badge-fixed-income { background: #fef3c7; color: #92400e; }
.badge-balanced { background: #d1fae5; color: #065f46; }
.badge-dividend { background: #ede9fe; color: #5b21b6; }
.badge-sector { background: #fce7f3; color: #9d174d; }
.badge-commodity { background: #ffedd5; color: #9a3412; }
.badge-crypto { background: #e0e7ff; color: #3730a3; }
.badge-default { background: #f3f4f6; color: #374151; }

.badge-positive {
  background: var(--positive-bg);
  color: var(--positive);
}

.badge-negative {
  background: var(--negative-bg);
  color: var(--negative);
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  text-align: left;
  padding: 10px 10px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 1;
}

.data-table th:hover {
  background: var(--primary-light);
}

.data-table th .th-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  margin-left: 2px;
  position: relative;
}

.data-table th .th-help:hover {
  background: var(--accent);
  color: var(--primary);
}

.data-table th .th-help:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  width: auto;
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 100;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: none;
}

.data-table th .th-help:hover::before {
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #1a1a2e;
  z-index: 101;
  pointer-events: none;
}

.data-table th .sort-arrow {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.5;
}

.data-table th .sort-arrow.active {
  opacity: 1;
  color: var(--accent);
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.data-table tbody tr:hover {
  background: #eef2ff;
  cursor: pointer;
}

.data-table .ticker-cell {
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--primary);
  font-size: 13px;
}

.data-table .name-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-weight: 500;
}

.data-table .number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }
.text-muted { color: var(--text-muted); }

/* --- Filter Sidebar --- */
.screener-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.filter-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
}

.filter-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.filter-section:last-child {
  border-bottom: none;
}

.filter-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-show-more {
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.filter-show-more:hover {
  text-decoration: underline;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  padding: 3px 0;
}

.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-checkbox span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-checkbox .count {
  color: var(--text-light);
  font-size: 11px;
  flex-shrink: 0;
}

.filter-range {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-range input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: var(--card-bg);
  transition: border-color var(--transition);
}

.filter-range input:focus {
  border-color: var(--primary);
}

.filter-range span {
  color: var(--text-light);
  font-size: 12px;
  flex-shrink: 0;
}

.filter-active-count {
  background: var(--accent);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
}

.filter-clear-btn {
  width: 100%;
  padding: 8px;
  text-align: center;
  color: var(--negative);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.filter-clear-btn:hover {
  background: var(--negative-bg);
}

.screener-results {
  flex: 1;
  min-width: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 0;
}

.pagination .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  transition: all var(--transition);
}

.pagination .btn-sm:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination .btn-sm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 8px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

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

.results-count strong {
  color: var(--text);
}

/* --- Dashboard --- */
.dashboard-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  color: #ffffff;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 200px;
  height: 200px;
  background: rgba(212, 168, 67, 0.08);
  border-radius: 50%;
}

.dashboard-hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.dashboard-hero p {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  max-width: 540px;
  line-height: 1.6;
}

.dashboard-hero .hero-cta {
  margin-top: 20px;
}

.stats-bar {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.stats-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.stats-bar-value {
  font-weight: 700;
  color: var(--text);
  font-size: 16px;
}

.stats-bar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.market-card {
  padding: 16px 20px;
  cursor: pointer;
}

.market-card-ticker {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
}

.market-card-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-card-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.market-card-change {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

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

.section-title .title-accent {
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.preset-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.preset-card {
  padding: 16px 20px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  border: 2px solid transparent;
}

.preset-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.preset-card-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.preset-card-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}

.preset-card-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Mini Tables --- */
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mini-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.mini-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
}

.mini-table tbody tr {
  transition: background var(--transition);
  cursor: pointer;
}

.mini-table tbody tr:hover {
  background: #f0f4ff;
}

.mini-table .rank {
  font-weight: 700;
  color: var(--text-light);
  font-size: 11px;
  width: 24px;
}

/* --- ETF Detail --- */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 6px 0;
  transition: color var(--transition);
  cursor: pointer;
}

.detail-back:hover {
  color: var(--primary);
}

.detail-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  color: #ffffff;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.detail-hero-left h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 4px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.detail-hero-left .detail-name {
  font-size: 16px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 16px;
}

.detail-hero-price {
  font-size: 32px;
  font-weight: 700;
}

.detail-hero-change {
  font-size: 18px;
  font-weight: 600;
  margin-left: 12px;
}

.detail-hero-right {
  display: flex;
  gap: 10px;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-card {
  padding: 16px 20px;
}

.info-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.info-card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.info-card-value.small {
  font-size: 14px;
}

.range-bar {
  margin-top: 8px;
}

.range-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  position: relative;
  margin: 4px 0;
}

.range-bar-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.range-bar-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 50%;
  top: -3px;
  transform: translateX(-50%);
  box-shadow: var(--shadow-sm);
}

.range-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.perf-card {
  text-align: center;
  padding: 14px 12px;
}

.perf-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.perf-card-value {
  font-size: 18px;
  font-weight: 700;
}

.chart-section {
  margin-bottom: 24px;
}

.chart-controls {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.chart-controls .pill {
  min-width: 48px;
  justify-content: center;
}

.chart-container {
  position: relative;
  height: 320px;
  padding: 16px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* --- Compare --- */
.compare-selector {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.compare-selector select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 13px;
  min-width: 260px;
  outline: none;
  color: var(--text);
}

.compare-selector select:focus {
  border-color: var(--primary);
}

.compare-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.compare-chip button {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

.compare-chip button:hover {
  color: #ffffff;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
}

.compare-table th {
  background: var(--bg);
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
}

.compare-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.compare-table .metric-label {
  font-weight: 600;
  color: var(--text);
  background: #f9fafb;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* --- Loading --- */
.spinner-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Error --- */
.error-box {
  background: var(--negative-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.error-box-icon {
  color: var(--negative);
  font-size: 18px;
  flex-shrink: 0;
}

.error-box-text {
  font-size: 13px;
  color: #991b1b;
  flex: 1;
}

/* --- Page Transitions --- */
.page-enter {
  animation: fadeInUp 0.25s ease forwards;
}

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

/* --- Responsive --- */
@media (max-width: 1200px) {
  .filter-sidebar {
    width: 240px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
    height: 56px;
  }

  .header-search {
    display: none;
  }

  .header-nav {
    display: none;
  }

  .header-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--primary);
    padding: 8px;
    box-shadow: var(--shadow-md);
  }

  .mobile-menu-toggle {
    display: block;
  }

  .main-content {
    padding: 16px;
  }

  .screener-layout {
    flex-direction: column;
  }

  .filter-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }

  .filter-sidebar.collapsed .filter-section:not(.filter-section-presets) {
    display: none;
  }

  .dashboard-hero {
    padding: 28px 24px;
  }

  .dashboard-hero h1 {
    font-size: 22px;
  }

  .detail-hero {
    padding: 24px;
  }

  .detail-hero-left h1 {
    font-size: 28px;
  }

  .detail-hero-price {
    font-size: 24px;
  }

  .market-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .preset-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .compare-selector select {
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .market-cards {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    flex-direction: column;
    gap: 12px;
  }

  .stats-bar-divider {
    display: none;
  }

  .detail-info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .performance-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
