@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --primary: #4361ee;
  --accent-blue: #4361ee;
  --bg-page: #ffffff;
  --bg-sidebar: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f8fafc;
  --border-default: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --sidebar-active-bg: #eef2ff;
  --status-win: #10b981;
  --status-win-bg: #10b981;
  --status-lose: #ef4444;
  --status-lose-bg: #ef4444;
  --status-tracking: #f59e0b;
  --status-tracking-bg: #f59e0b;
  --status-active-bg: #10b981;
  --chart-line-1: #4361ee;
  --chart-line-2: #8b5cf6;
  --chart-line-3: #ef4444;
  --chart-line-4: #10b981;
  --chart-grid: #f1f5f9;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --sidebar-width: 260px;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

body.detail-panel-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

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

.hidden {
  display: none !important;
}

/* Layout shell */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  width: 100%;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 150;
}

.sidebar-backdrop.visible {
  display: block;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 4px;
}

.sidebar-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-mark svg {
  width: 20px;
  height: 20px;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-gap {
  height: 20px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--primary);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 52px;
  padding: 10px 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.sidebar-user-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
}

.sidebar-logout svg {
  width: 18px;
  height: 18px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
  height: 100vh;
  overflow: hidden;
  background: var(--bg-page);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
}

/* Top bars */
.topbar-daily {
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg-page);
  border-bottom: 1px solid transparent;
  transition: height 0.15s ease;
}

.app-shell.detail-open .topbar-daily.topbar-dimmed {
  height: 64px;
  background: var(--bg-surface);
  border-bottom-color: var(--border-default);
}

.app-shell.detail-open .topbar-controls.controls-hidden {
  visibility: hidden;
  pointer-events: none;
}

.app-shell.detail-open .content-dimmed {
  opacity: 0.45;
  pointer-events: none;
}

.topbar-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.topbar-title {
  font-size: 24px;
  font-weight: 700;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-simple {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}

.topbar-simple-title {
  font-size: 18px;
  font-weight: 600;
}

.topbar-screener {
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}

.topbar-screener-title {
  font-size: 18px;
  font-weight: 600;
}

.topbar-screener-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.control-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
}

.control-chip .label-muted {
  color: var(--text-muted);
}

.control-chip .label-value {
  color: var(--text-primary);
  font-weight: 500;
}

.control-chip svg {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
}

.control-icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
}

.control-icon-btn.disabled {
  background: var(--bg-muted);
  opacity: 0.4;
  cursor: not-allowed;
}

.control-icon-btn svg {
  width: 16px;
  height: 16px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.content {
  flex: 1;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: auto;
}

.content-settings {
  padding: 24px;
}

/* Stat cards */
.stats-row {
  display: flex;
  gap: 12px;
}

.stat-card {
  flex: 1;
  height: 88px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.stat-card-value.win {
  color: var(--status-win);
}

.stat-card-value.lose {
  color: var(--status-lose);
}

.stat-card-value.tracking {
  color: var(--status-tracking);
}

.stat-card-value.accent {
  color: var(--accent-blue);
}

/* Chart card */
.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 18px;
}

.chart-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-subtitle-right {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.chart-legend {
  display: flex;
  gap: 20px;
  height: 16px;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
  white-space: nowrap;
}

.chart-tooltip-date {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.2;
}

.chart-tooltip-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-tooltip-symbol {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.chart-tooltip-delta {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
}

.chart-tooltip-delta.positive {
  color: var(--status-win);
}

.chart-tooltip-delta.negative {
  color: var(--status-lose);
}

/* Table */
.table-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.table-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 0 4px;
}

.table-top-title {
  font-size: 12px;
  font-weight: 600;
}

.table-search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 180px;
  height: 28px;
  padding: 0 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}

.table-search svg {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.table-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 11px;
  width: 100%;
  color: var(--text-primary);
}

.table-search input::placeholder {
  color: var(--text-muted);
}

.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll-wrap .data-table {
  min-width: 720px;
}

.data-table {
  width: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.table-header,
.table-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.table-header {
  height: 32px;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-default);
}

.table-row {
  height: 36px;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
}

.table-row:last-child {
  border-bottom: none;
}

.table-row:hover {
  background: var(--bg-muted);
}

.th,
.td {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.td {
  font-size: 11px;
  font-weight: 400;
}

.th.center,
.td.center {
  justify-content: center;
  padding: 0 8px;
}

.th.end,
.td.end {
  justify-content: flex-end;
}

.td.symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.td.mono {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.td.positive {
  color: var(--status-win);
}

.td.negative {
  color: var(--status-lose);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 500;
  color: #fff;
}

.badge.win {
  background: var(--status-win-bg);
}

.badge.lose {
  background: var(--status-lose-bg);
}

.badge.tracking {
  background: var(--status-tracking-bg);
}

/* Settings card */
.settings-card {
  width: 480px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.section-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.field-row.mono {
  font-family: var(--font-mono);
}

.field-row .copy-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--primary);
  display: flex;
}

.field-row .copy-btn.copy-btn-muted {
  color: var(--text-muted);
}

.field-row .copy-btn.copy-btn-muted:hover {
  color: var(--text-secondary);
}

.field-row .copy-btn svg {
  width: 16px;
  height: 16px;
}

.divider {
  height: 1px;
  background: var(--border-default);
  width: 100%;
}

.field-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
}

.field-input-row input {
  border: none;
  outline: none;
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  background: transparent;
}

.field-input-row .suffix {
  font-size: 12px;
  color: var(--text-muted);
}

.field-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.preview-box {
  padding: 12px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-box-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-box-value {
  font-size: 11px;
  font-family: var(--font-mono);
}

/* B6 Screener compare */
.best-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 72px;
  padding: 0 20px;
  background: var(--status-win-bg);
  border: 1px solid var(--status-win-bg);
  border-radius: var(--radius-lg);
  color: #fff;
}

.best-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.best-banner-icon svg {
  width: 20px;
  height: 20px;
}

.best-banner-title {
  font-size: 14px;
  font-weight: 700;
}

.best-banner-sub {
  font-size: 12px;
  opacity: 0.8;
}

.compare-header {
  height: 24px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}

.compare-row {
  display: flex;
  gap: 20px;
}

.compare-panel {
  flex: 1;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screener-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 12px;
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.screener-picker-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.screener-dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: var(--primary);
}

.metrics-row {
  display: flex;
  gap: 12px;
}

.metric-card {
  flex: 1;
  height: 74px;
  padding: 12px 14px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.metric-value.win {
  color: var(--status-win);
}

.metric-value.tracking {
  color: var(--status-tracking);
}

.breakdown-row {
  display: flex;
  gap: 12px;
}

.breakdown-item {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.breakdown-item .count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.breakdown-item .count.win {
  color: var(--status-win);
}

.breakdown-item .count.lose {
  color: var(--status-lose);
}

.breakdown-item .count.tracking {
  color: var(--status-tracking);
}

.subsection-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.top-stocks {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.top-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-default);
  font-size: 12px;
}

.top-stock-row:last-child {
  border-bottom: none;
}

.top-stock-row .symbol {
  font-family: var(--font-mono);
  font-weight: 600;
}

.top-stock-row .return {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--status-win);
}

.recommendation {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(67, 97, 238, 0.2);
  background: rgba(67, 97, 238, 0.07);
}

.recommendation.amber {
  border-color: rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.07);
}

.recommendation svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--primary);
}

.recommendation.amber svg {
  color: #d97706;
}

.recommendation-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}

.recommendation.amber .recommendation-title {
  color: #d97706;
}

.recommendation-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.period-chip-wrap {
  position: relative;
}

.period-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
}

.period-chip svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
}

.login-card {
  width: 360px;
  padding: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.login-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-mark svg {
  width: 24px;
  height: 24px;
}

.login-brand {
  font-size: 18px;
  font-weight: 600;
}

.login-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  outline: none;
  font-size: 13px;
}

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

.password-wrap {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
}

.password-wrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
}

.password-wrap button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
}

.password-wrap svg {
  width: 14px;
  height: 14px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.remember-row input {
  width: 14px;
  height: 14px;
}

.login-error {
  font-size: 12px;
  color: var(--status-lose);
}

/* Detail overlay B3 */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.2);
  display: flex;
  justify-content: flex-end;
  z-index: 100;
}

.detail-panel {
  width: 414px;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.detail-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-default);
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-symbol {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}

.detail-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
}

.detail-close svg {
  width: 16px;
  height: 16px;
}

.detail-summary {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid transparent;
}

.summary-box {
  flex: 1;
  padding: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.summary-box-label {
  font-size: 9px;
  color: var(--text-muted);
}

.summary-box-value {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.detail-returns {
  display: flex;
  gap: 16px;
  padding: 0 16px;
  height: 48px;
  align-items: center;
  border-bottom: 1px solid var(--border-default);
}

.return-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.return-block-label {
  font-size: 10px;
  color: var(--text-muted);
}

.return-block-value {
  font-size: 14px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.detail-sparkline {
  padding: 16px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-sparkline-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sparkline-wrap {
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.detail-timeline {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-timeline-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.detail-table {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.detail-table .table-header,
.detail-table .table-row {
  height: 32px;
}

.detail-table .th,
.detail-table .td {
  justify-content: center;
  font-size: 10px;
}

.detail-table .th:first-child,
.detail-table .td:first-child {
  width: 80px;
  flex: none;
}

.detail-table .th:nth-child(2),
.detail-table .td:nth-child(2) {
  width: 80px;
  flex: none;
}

.detail-table .th:nth-child(3),
.detail-table .td:nth-child(3) {
  flex: 1;
}

.detail-table .th:nth-child(4),
.detail-table .td:nth-child(4) {
  width: 80px;
  flex: none;
}

.source-screener {
  color: var(--text-secondary);
}

.source-symbol {
  color: var(--status-tracking);
  font-weight: 500;
}

/* Dropdown menus */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 50;
  overflow: hidden;
}

.dropdown-item {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-muted);
}

.dropdown-item.active {
  background: var(--sidebar-active-bg);
  color: var(--primary);
}

.control-chip-wrap,
.screener-picker-wrap {
  position: relative;
}

/* Loading / empty */
.loading-state,
.empty-state {
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Mobile bottom nav */
.mobile-bottom-nav {
  display: none;
}

/* Responsive */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .content {
    padding: 20px 24px;
  }

  .topbar-daily,
  .topbar-screener {
    padding: 0 24px;
  }

  .stats-row {
    flex-wrap: wrap;
  }

  .stat-card {
    flex: 1 1 calc(33.333% - 8px);
    min-width: 140px;
  }

  .compare-row {
    flex-direction: column;
  }

  .metrics-row {
    flex-wrap: wrap;
  }

  .metric-card {
    flex: 1 1 calc(33.333% - 8px);
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .main {
    margin-left: 0;
  }

  .topbar-daily,
  .topbar-screener {
    height: auto;
    min-height: 64px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-title {
    font-size: 18px;
  }

  .topbar-controls {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  .content {
    padding: 16px;
    gap: 16px;
  }

  .stats-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stat-card {
    flex: 1 1 calc(50% - 4px);
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
  }

  .stat-card-value {
    font-size: 22px;
  }

  .chart-card {
    padding: 16px;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .chart-subtitle-right {
    text-align: left;
  }

  .chart-wrap {
    height: 180px;
  }

  .table-top {
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
  }

  .table-search {
    width: 100%;
    max-width: 180px;
  }

  .settings-card {
    width: 100%;
    max-width: 480px;
  }

  .detail-panel {
    width: 100%;
    max-width: 100%;
  }

  .detail-summary {
    flex-wrap: wrap;
  }

  .summary-box {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }

  .compare-row {
    flex-direction: column;
  }

  .breakdown-row {
    flex-wrap: wrap;
  }

  .breakdown-item {
    flex: 1 1 calc(33.333% - 8px);
    min-width: 100px;
  }

  .best-banner {
    height: auto;
    min-height: 72px;
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-default);
    z-index: 120;
    padding: 0 8px;
    justify-content: space-around;
    align-items: center;
  }

  .mobile-bottom-nav .nav-item {
    flex-direction: column;
    height: auto;
    gap: 4px;
    padding: 6px 12px;
    font-size: 10px;
    width: auto;
  }

  .mobile-bottom-nav .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .main {
    padding-bottom: 56px;
  }

  .sidebar-user {
    margin-bottom: 56px;
  }
}
