:root {
  --bg-primary: #0a0b0d;
  --bg-secondary: #13151a;
  --bg-panel: rgba(22, 25, 33, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-hint: #6b7280;
  --text-muted: #4b5563;
  
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.15);
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.15);
  --color-accent: #2563eb;
  --color-accent-hover: #3b82f6;
  
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --transition-fast: 0.2s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
  
  --box-shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #272a30;
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: #3e424b;
}

/* Container & Header */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  max-width: 1680px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.75rem;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-glow);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-logo svg {
  color: var(--color-green);
}
.header-logo h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}
.header-logo h1 span {
  font-weight: 300;
  color: var(--text-secondary);
}

.preset-group {
  display: flex;
  gap: 0.5rem;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-preset:hover, .btn-preset.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ===== TICKER SWITCHER BAR (v6) ===== */
.ticker-switcher-bar {
  background: rgba(22, 25, 33, 0.85);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 1.25rem;
  margin-bottom: 0.5rem;
}
.ticker-switcher-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ticker-switcher-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  min-width: 28px;
}
.ticker-quick-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ticker-btn {
  padding: 3px 10px;
  font-size: 0.73rem;
  font-weight: 700;
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.ticker-btn:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}
.ticker-btn.active {
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.5);
  color: #f97316;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.15);
}
.ticker-util-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ticker-custom-input {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-left: 4px;
}
.ticker-custom-input input {
  width: 72px;
  padding: 3px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ticker-custom-input input::placeholder {
  color: var(--text-hint);
  font-size: 0.66rem;
}
.ticker-custom-input input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 4px rgba(56, 189, 248, 0.15);
}
.ticker-btn-custom {
  font-size: 0.68rem;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}
.ticker-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding-left: 8px;
  border-left: 1px solid var(--border-color);
}
.ticker-current-label {
  font-size: 0.88rem;
  font-weight: 800;
  color: #f97316;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}
.ticker-leverage-badge {
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid;
  letter-spacing: 0.05em;
}
.ticker-records-count {
  font-size: 0.62rem;
  color: var(--text-hint);
  font-family: monospace;
}

/* Layout Main */
/* Layout Main: Independent Sticky Sidebar & Natural Main Content Scrolling */
.app-main {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Config Form (Compact & Sticky) */
.config-sidebar {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.85rem 0.95rem;
  box-shadow: var(--box-shadow-glow);
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.config-sidebar::-webkit-scrollbar {
  width: 4px;
}
.config-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.form-group-set {
  border: none;
  margin-bottom: 0.55rem;
}
.form-group-set legend {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.25rem;
}
.input-field label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.input-field input, .input-field select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  padding: 0.25rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  height: 30px;
  min-height: 30px;
  max-height: 30px;
  box-sizing: border-box;
  line-height: normal;
  transition: var(--transition-fast);
}
.input-field input[type="date"] {
  height: 30px;
  min-height: 30px;
  max-height: 30px;
  padding: 2px 6px;
  box-sizing: border-box;
}
.input-field input:focus-visible, .input-field select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.06);
}

select option {
  background-color: #1a1d26 !important;
  color: #f3f4f6 !important;
}

/* Optional / Collapsible Drawer Accordion Cards */
.optional-card {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  padding: 6px 8px;
  margin-bottom: 0.35rem;
  transition: var(--transition-fast);
}
.optional-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}
.optional-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.optional-drawer {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

/* Toggle Option */
.toggle-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}
.toggle-field input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: var(--color-accent);
  cursor: pointer;
  margin: 0;
}
.toggle-field label {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.hint {
  font-size: 0.68rem;
  color: var(--text-hint);
  line-height: 1.3;
}

.btn-submit {
  width: 100%;
  background: var(--color-accent);
  color: white;
  border: none;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-top: 0.35rem;
  height: 36px;
}
.btn-submit:hover {
  background: var(--color-accent-hover);
}

/* Dashboard Panel */
.dashboard-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 0.5rem 0.8rem;
  box-shadow: var(--box-shadow-glow);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.metric-card h3 {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}
.metric-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.metric-sub {
  font-size: 0.7rem;
  color: var(--text-hint);
}

.card-glow-green {
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow: 0 4px 20px 0 var(--color-green-glow), var(--box-shadow-glow);
}
.card-glow-green .metric-value {
  color: var(--color-green);
}
.card-glow-red {
  border-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 4px 20px 0 var(--color-red-glow), var(--box-shadow-glow);
}
.card-glow-red .metric-value {
  color: var(--color-red);
}

/* Tab Container */
.tab-container {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-glow);
  display: flex;
  flex-direction: column;
}

.tab-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.tab-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 0.3rem;
  align-self: center;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}
.tab-btn.active {
  color: #ffffff;
  background: var(--color-accent);
  border-color: var(--color-accent);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.btn-jump-trades:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3) !important;
}

.tab-content {
  padding: 1.5rem;
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* Chart Canvas Wrapper */
.chart-wrapper {
  position: relative;
  width: 100%;
  height: 480px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-md);
  padding: 1rem;
}

/* Action Bar */
.panel-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.panel-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

/* Data Table Styling */
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
  max-height: 600px;
  position: relative;
}

/* Custom Scrollbar for Table Wrappers */
.table-wrapper::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}
.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #181c24;
  color: var(--text-secondary);
  font-weight: 600;
  box-shadow: 0 1px 0 var(--border-color);
}
.data-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

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

/* Daily Table Compact Layout (No Horizontal Scroll on PC) */
#daily-table {
  table-layout: auto;
  width: 100%;
}
#daily-table th, #daily-table td {
  padding: 5px 6px;
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
}
#daily-table th {
  line-height: 1.2;
  padding-top: 5px;
  padding-bottom: 5px;
  vertical-align: middle;
}

/* Duration Stepper & Quick Chips */
.btn-duration-step {
  transition: var(--transition-fast);
}
.btn-duration-step:hover {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}
.btn-duration-chip {
  transition: var(--transition-fast);
}
.btn-duration-chip:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #ffffff !important;
}
.btn-duration-chip.active {
  background: var(--color-accent) !important;
  color: #ffffff !important;
  border-color: var(--color-accent) !important;
}

/* Table Quick Controller Bar */
.table-quick-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-quick-scroll {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-fast);
}
.btn-quick-scroll:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* Trades Sort Pill Group */
.trades-sort-pill-group {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 2px;
  gap: 2px;
}
.btn-sort-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}
.btn-sort-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
.btn-sort-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 700;
}

/* Sortable Table Headers */
th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
th.sortable-th:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}
th.sortable-th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.68rem;
  color: var(--text-hint);
}
th.sortable-th.active-sort {
  color: #38bdf8;
}
th.sortable-th.active-sort .sort-indicator {
  color: #38bdf8;
  font-weight: bold;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
}
.pagination-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition-fast);
}
.pagination-btn:hover, .pagination-btn.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}
.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Update Button styling */
.btn-update {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-green);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  outline: none;
}
.btn-update:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}
.btn-update:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-update .update-icon {
  transition: transform 0.3s ease;
}

/* Spin Animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin-animation {
  animation: spin 1s linear infinite;
}

/* Premium Action Button styling (CSV Export) */
.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  background: rgba(37, 99, 235, 0.12); /* 투명 푸른색 */
  border: 1px solid rgba(37, 99, 235, 0.35);
  color: #60a5fa; /* 고대비 블루 */
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  outline: none;
}
.btn-action:hover {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(37, 99, 235, 0.6);
  color: #93c5fd;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.3);
}
.btn-action:active {
  transform: scale(0.98);
}
.btn-action .action-icon {
  transition: transform 0.2s ease;
}
.btn-action:hover .action-icon {
  transform: translateY(1px); /* 호버 시 다운로드 방향으로 미세 유도 */
}

/* Heatmap Analysis Styling */
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  margin-top: 10px;
  font-size: 0.85rem;
}

.heatmap-table th {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
}

.heatmap-table td.heatmap-axis-label {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
}

.heatmap-cell {
  padding: 10px 8px;
  text-align: center;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  position: relative;
}

.heatmap-cell:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.heatmap-cell .heatmap-val {
  font-size: 0.85rem;
  display: block;
}

.heatmap-cell .heatmap-count {
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: normal;
}

/* Preset Standard Button & Toast Notification Styling */
.btn-preset-standard:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(14, 165, 233, 0.25) 100%) !important;
  border-color: #34d399 !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.3) !important;
  transform: translateY(-1px);
}
.btn-preset-standard:active {
  transform: translateY(0);
}

.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(24, 28, 36, 0.95);
  border: 1px solid rgba(52, 211, 153, 0.6);
  color: #34d399;
  padding: 12px 20px;
  border-radius: var(--border-radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastFadeIn 0.3s ease, toastFadeOut 0.3s ease 2.7s forwards;
}
@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}

/* Joint Optimizer (N x p%) 2D Matrix Styling */
.joint-heatmap-section {
  position: relative;
  width: 100%;
  height: auto;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px;
  margin-bottom: 25px;
  clear: both;
  box-sizing: border-box;
}

.joint-matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 5px;
  margin-top: 4px;
}

.joint-matrix-table th {
  padding: 8px 6px;
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
}

.joint-cell {
  user-select: none;
  min-width: 68px;
}

.joint-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  filter: brightness(1.2);
  z-index: 5;
}

.joint-view-btn {
  transition: all 0.2s ease;
}

.joint-view-btn:hover {
  filter: brightness(1.15);
}

/* Input Flash / Blinking Highlight Animation on Apply */
@keyframes inputHighlightPulse {
  0% {
    background-color: rgba(56, 189, 248, 0.45) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.9) !important;
    transform: scale(1.04);
  }
  30% {
    background-color: rgba(52, 211, 153, 0.4) !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.9) !important;
    transform: scale(1.04);
  }
  70% {
    background-color: rgba(56, 189, 248, 0.3) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.7) !important;
    transform: scale(1.02);
  }
  100% {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: none;
    transform: scale(1);
  }
}

.input-flash-highlight {
  animation: inputHighlightPulse 1.2s ease-in-out 3 !important;
  transition: all 0.25s ease;
  z-index: 10;
  position: relative;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Mobile-Optimized Ultra-Compact Responsive Design (max-width: 768px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Prevent horizontal overflow across the entire page */
  html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* 1. App Container & Ultra-Compact Header */
  .app-container {
    padding: 0.35rem 0.45rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    min-height: 100vh;
  }

  /* 1.1 Ticker Switcher Bar (Mobile Compact - Exactly 3 Rows) */
  .ticker-switcher-bar {
    padding: 3px 0.35rem;
    margin-bottom: 0.25rem;
  }
  .ticker-switcher-inner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
  }
  .ticker-switcher-label {
    display: none;
  }
  .ticker-quick-buttons {
    display: grid;
    grid-template-rows: repeat(2, 23px);
    grid-auto-flow: column;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 3px;
    width: 100%;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
  .ticker-btn {
    padding: 2px 7px;
    font-size: 0.68rem;
    height: 23px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .ticker-util-row {
    display: flex;
    align-items: center;
    gap: 3px;
    width: 100%;
  }
  .ticker-screener-link {
    padding: 2px 5px !important;
    font-size: 0.65rem !important;
    height: 23px;
    white-space: nowrap;
  }
  .ticker-custom-input {
    margin-left: 0;
    flex: 1;
    display: flex;
    gap: 2px;
    min-width: 0;
  }
  .ticker-custom-input input {
    width: 45px;
    flex: 1;
    font-size: 0.68rem;
    padding: 1px 4px;
    height: 23px;
    min-width: 0;
  }
  .ticker-custom-input button {
    padding: 2px 6px;
    font-size: 0.65rem;
    height: 23px;
    white-space: nowrap;
  }
  .ticker-status {
    margin-left: auto;
    border-left: none;
    padding-left: 0;
    gap: 2px;
    white-space: nowrap;
  }
  .ticker-current-label {
    font-size: 0.72rem;
  }
  .ticker-records-count {
    display: none;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.45rem;
    gap: 0.35rem;
    border-radius: var(--border-radius-sm);
  }

  .header-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
  }
  .header-logo svg {
    width: 16px;
    height: 16px;
  }
  .header-logo h1 {
    font-size: 0.86rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-logo h1 span {
    font-size: 0.75rem;
  }

  .preset-group {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.25rem;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .preset-group::-webkit-scrollbar {
    display: none;
  }

  #mobile-sidebar-toggle {
    display: flex !important;
  }

  .btn-preset {
    padding: 0.22rem 0.48rem;
    font-size: 0.7rem;
    border-radius: 4px;
  }

  /* 2. Compact Sidebar Form (Dense, no stretching) */
  .app-main {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .config-sidebar {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.55rem;
    border-radius: var(--border-radius-sm);
    max-height: none;
    position: static;
    margin-bottom: 0.2rem;
  }

  .form-group-set {
    margin-bottom: 0.35rem;
    padding: 0;
  }
  .form-group-set legend {
    font-size: 0.72rem;
    margin-bottom: 0.18rem;
    font-weight: 700;
  }

  .input-field {
    gap: 0.05rem;
    margin-bottom: 0.15rem;
  }

  .input-field label {
    font-size: 0.65rem;
    line-height: 1.1;
  }

  .input-field input, .input-field select {
    height: 26px;
    min-height: 26px;
    max-height: 26px;
    font-size: 0.75rem;
    padding: 0.15rem 0.35rem;
    box-sizing: border-box;
  }

  .btn-preset-standard {
    padding: 4px 8px !important;
    font-size: 0.72rem !important;
  }

  .btn-submit {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    height: 34px;
  }

  /* 3. Ultra-Compact 5 Simulation Metric Cards */
  .dashboard-content {
    gap: 0.45rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .metrics-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.3rem !important;
    margin-bottom: 0.25rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Row 1: 3 cards (Final Asset, CAGR, MDD) */
  /* Row 2: 2 cards (Calmar, Winrate) */
  .metrics-grid .metric-card:nth-child(1) { grid-column: span 1; }
  .metrics-grid .metric-card:nth-child(2) { grid-column: span 1; }
  .metrics-grid .metric-card:nth-child(3) { grid-column: span 1; }
  .metrics-grid .metric-card:nth-child(4) { grid-column: span 1; }
  .metrics-grid .metric-card:nth-child(5) { grid-column: span 2; }

  .metric-card {
    padding: 0.25rem 0.4rem !important;
    border-radius: 6px !important;
    gap: 0.02rem !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
  }

  .metric-card h3 {
    font-size: 0.58rem !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .metric-value {
    font-size: 0.86rem !important;
    line-height: 1.1 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .metric-sub {
    font-size: 0.54rem !important;
    line-height: 1 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 4. Tab Header & Content: Flat Wrap Grid on Mobile */
  .tab-header {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    white-space: normal !important;
    padding: 6px 6px !important;
    gap: 4px !important;
    background: rgba(0, 0, 0, 0.25) !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .tab-divider {
    display: none !important;
  }

  .tab-btn {
    flex: 1 1 calc(33.333% - 4px) !important;
    min-width: 55px !important;
    padding: 6px 3px !important;
    font-size: 0.68rem !important;
    font-weight: 500 !important;
    text-align: center !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-secondary) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.1 !important;
  }

  .tab-btn.active {
    background: var(--color-accent) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3) !important;
  }

  .tab-content {
    padding: 0.45rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .chart-wrapper {
    height: 260px;
    padding: 0.25rem;
  }

  .panel-action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-bottom: 0.45rem;
    padding: 6px 8px;
  }

  /* 5. Heatmap & Tables on Mobile (Smooth isolated scrolling) */
  .table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .joint-heatmap-section {
    padding: 6px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .joint-matrix-table {
    min-width: 580px;
  }

  .joint-matrix-table th {
    padding: 3px 2px;
    font-size: 0.68rem;
  }

  .joint-cell {
    min-width: 48px;
    padding: 3px 2px !important;
  }

  .joint-cell .heatmap-val {
    font-size: 0.7rem;
  }

  .joint-cell .heatmap-count {
    font-size: 0.58rem;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   6. 3D Surface Terrain & Web Worker Progress & OOS Validation Styles
   ══════════════════════════════════════════════════════════════════════════════ */

/* Worker Progress Bar */
.worker-progress-container {
  display: none;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}

.worker-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.worker-progress-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.worker-progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.worker-progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #a78bfa);
  border-radius: 4px;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.worker-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: monospace;
}

/* 2D / 3D View Toggle Group */
.view-toggle-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.btn-view-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view-toggle.active {
  background: #38bdf8;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.btn-view-toggle:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* 3D Surface Container */
#joint-surface-3d-container {
  width: 100%;
  height: 520px;
  border-radius: var(--border-radius-sm);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 12px;
}

/* OOS Validation Panel */
.oos-panel-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.oos-split-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 14px;
}

.oos-split-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.oos-bar-is {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.9));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: width 0.3s ease;
}

.oos-bar-oos {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.8), rgba(124, 58, 237, 0.9));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: width 0.3s ease;
}

.oos-grid-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.oos-compare-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.oos-compare-card h4 {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.oos-compare-values {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.oos-val-is {
  font-size: 1.1rem;
  font-weight: 700;
  color: #34d399;
}

.oos-val-oos {
  font-size: 1.1rem;
  font-weight: 700;
  color: #a78bfa;
}

.oos-wfe-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.oos-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.oos-badge-robust {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #34d399;
}

.oos-badge-moderate {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid #f59e0b;
  color: #fbbf24;
}

.oos-badge-weak {
  background: rgba(249, 115, 22, 0.2);
  border: 1px solid #f97316;
  color: #fb923c;
}

.oos-badge-overfitted {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #f87171;
}

.oos-badge-na {
  background: rgba(156, 163, 175, 0.2);
  border: 1px solid #9ca3af;
  color: #d1d5db;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Synthetic Market Data Generator Panel Styles
   ══════════════════════════════════════════════════════════════════════════════ */
.synthetic-panel-container {
  animation: fadeIn 0.25s ease-in-out;
}

.synthetic-panel-container input[type="date"],
.synthetic-panel-container input[type="number"],
.synthetic-panel-container select {
  font-family: 'Inter', sans-serif;
  transition: var(--transition-fast);
}

.synthetic-panel-container input:focus,
.synthetic-panel-container select:focus {
  outline: none;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.25);
}

#synth-preview-badge {
  background: rgba(251, 191, 36, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}



