/* ==========================================================================
   Korean Stock Technical Analyzer - Web Frontend Stylesheet
   Phase 12: Responsive Financial Dark Dashboard
   ========================================================================== */

:root {
  --bg-primary: #0f172a;       /* Slate 900 */
  --bg-secondary: #1e293b;     /* Slate 800 */
  --bg-tertiary: #334155;      /* Slate 700 */
  --bg-card: #182234;          /* Deep Card Background */
  --border-color: #2e3d53;     /* Subtle Card Border */
  --border-highlight: #3b82f6;

  --text-primary: #f8fafc;     /* Slate 50 */
  --text-secondary: #94a3b8;   /* Slate 400 */
  --text-muted: #64748b;       /* Slate 500 */

  /* Korean Market Candlestick & Indicator Colors */
  --korea-up: #e11d48;         /* Red for Bullish / Up Close */
  --korea-down: #2563eb;       /* Blue for Bearish / Down Close */
  --korea-support: #10b981;    /* Mint / Emerald */
  --korea-resistance: #f43f5e; /* Rose / Red */
  --accent-amber: #f59e0b;     /* Warning / Retest */
  --accent-cyan: #06b6d4;      /* Channel */
  --accent-purple: #8b5cf6;    /* Pivot High */

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition-fast: 0.15s ease;
  --border-radius: 8px;
  --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.25);
}

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

[v-cloak] {
  display: none !important;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Card Component */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: #2563eb;
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background-color: #475569;
}
.btn-secondary.active {
  background-color: #f59e0b;
  color: #0f172a;
  border-color: #f59e0b;
}

.btn-outline {
  background: transparent;
  color: #38bdf8;
  border-color: #0284c7;
}
.btn-outline:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-danger {
  background-color: #dc2626;
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

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

.btn-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.btn-toggle {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-toggle:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

.btn-toggle.active {
  background: #3b82f6;
  color: #ffffff;
  font-weight: 700;
}

/* Inputs */
.text-input {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}
.text-input:focus {
  border-color: var(--border-highlight);
}

/* Header */
.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 24px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

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

.nav-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #ffffff;
  background: #2563eb;
  border-color: #1d4ed8;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #64748b;
}

.status-dot.online {
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.status-dot.offline {
  background-color: #ef4444;
}

/* Main Content Area */
.main-content {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.tab-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Control & Search Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

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

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

.input-with-button {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.symbol-search-wrapper {
  position: relative;
  width: 200px;
}

.symbol-search-wrapper .text-input {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Real-time Symbol Autocomplete Dropdown */
.symbol-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 230px;
  max-height: 320px;
  overflow-y: auto;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: #334155;
}

.ac-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.ac-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item-symbol {
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono, monospace);
}

.ac-market-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.ac-market-badge.kospi {
  background-color: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.ac-market-badge.kosdaq {
  background-color: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.ac-market-badge.index {
  background-color: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.ac-market-badge.etf {
  background-color: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.ac-market-badge.etn {
  background-color: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

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

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

.chip-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip-btn:hover {
  background: var(--bg-tertiary);
  color: #ffffff;
}

.chip-btn.selected {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #60a5fa;
  font-weight: 600;
}

/* Alert */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius);
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.alert-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-size: 16px;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-msg {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Welcome Guide Card (Initial State) */
.welcome-guide {
  text-align: center;
  padding: 60px 24px;
  background: linear-gradient(135deg, #182234 0%, #1e293b 100%);
  border: 1px dashed #334155;
  border-radius: 12px;
  margin-top: 16px;
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.welcome-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.welcome-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Hero Overview Card */
.hero-card {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.3fr 1.3fr auto;
  gap: 16px;
  align-items: center;
  background: linear-gradient(135deg, #182234 0%, #1e293b 100%);
  border: 1px solid #334155;
}

.rec-hero-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
}

.rec-hero-badge.eligible {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.rec-hero-badge.watch {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.rec-hero-badge.rejected {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.hero-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stock-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.stock-badge {
  background-color: var(--bg-tertiary);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

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

.stock-price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.price-val {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
}

.price-change-badge {
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: -0.2px;
}

.price-change-badge.change-up {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.price-change-badge.change-down {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.price-change-badge.change-flat {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.trend-state-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

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

.trend-state-badge.neutral {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid #94a3b8;
}

.score-label, .rr-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.score-number {
  font-size: 28px;
  font-weight: 800;
}

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

.score-high { color: #10b981; }
.score-mid { color: #f59e0b; }
.score-low { color: #ef4444; }

.score-bar-bg {
  width: 100%;
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.score-bar-fill.score-high { background-color: #10b981; }
.score-bar-fill.score-mid { background-color: #f59e0b; }
.score-bar-fill.score-low { background-color: #ef4444; }

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

.rr-ratio {
  font-size: 22px;
  font-weight: 800;
  color: #38bdf8;
}
.rr-ratio.invalid {
  color: var(--text-muted);
}

.rr-favorable-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
}
.rr-favorable-badge.favorable {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.rr-details {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Chart Section & Candidate Toggles */
.chart-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.chart-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

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

/* Candidate Toggles (Core UX Requirement) */
.candidate-toggles-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toggle-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 2px;
}

.reset-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reset-view-btn:hover {
  background-color: var(--bg-hover);
  border-color: #3b82f6;
  color: #60a5fa;
}

.focused-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.toggle-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.toggle-checkbox input[type="checkbox"] {
  display: none;
}

.toggle-chip {
  display: inline-block;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.toggle-checkbox input[type="checkbox"]:checked + .toggle-chip {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #60a5fa;
}

.toggle-checkbox input[type="checkbox"]:checked + .main-line-chip {
  background-color: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

.toggle-checkbox input[type="checkbox"]:checked + .cand2-chip {
  background-color: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
}

.toggle-checkbox input[type="checkbox"]:checked + .cand3-chip {
  background-color: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
  color: #c084fc;
}

.toggle-checkbox input[type="checkbox"]:checked + .vp-chip {
  background-color: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #818cf8;
}

.text-poc {
  color: #f59e0b;
}

.chart-canvas {
  width: 100%;
  height: 620px;
  min-height: 480px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #ffffff;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Trendline Detail Blocks */
.trendline-detail-block {
  padding: 10px;
  border-radius: 6px;
  background: var(--bg-secondary);
  border-left: 4px solid #64748b;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trendline-detail-block.support {
  border-left-color: #10b981;
}

.trendline-detail-block.resistance {
  border-left-color: #ef4444;
}

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

.tl-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.tl-badge.sup { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.tl-badge.res { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.tl-score {
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
}

.tl-status {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
}

.tl-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 12px;
}

.stat-item .lbl {
  color: var(--text-muted);
  margin-right: 4px;
}

.stat-item .val {
  font-weight: 600;
  color: var(--text-primary);
}

/* Target & Stop Flex Box */
.target-stop-flex {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ts-box {
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.target-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.stop-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.ts-price {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.ts-gain {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
}

.ts-loss {
  font-size: 12px;
  font-weight: 700;
  color: #f87171;
}

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

.rr-summary-box {
  padding: 10px;
  border-radius: 6px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rr-ratio-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

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

/* Channel & S/R */
.channel-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.channel-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.ch-badge {
  font-weight: 700;
  color: #38bdf8;
}

.ch-progress-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.ch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #3b82f6 50%, #ef4444 100%);
  border-radius: 3px;
}

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

.sr-zones-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sub-title {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.zone-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
}

.zone-row.support { border-left: 3px solid #10b981; }
.zone-row.resistance { border-left: 3px solid #ef4444; }

.zone-kind { font-weight: 700; }
.zone-range { color: var(--text-primary); }
.zone-touches { color: var(--text-muted); font-size: 11px; }

/* Volume & Breakout */
.volume-box, .breakout-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.vol-row {
  display: flex;
  justify-content: space-between;
}

.text-confirmed { color: #34d399; }

.bo-item, .retest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.bo-badge, .retest-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

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

/* Component Score Bars */
.component-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comp-bar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.comp-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.comp-val {
  font-weight: 700;
  color: #ffffff;
}

.comp-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
}

.comp-bar-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 2px;
}

/* ==========================================================================
   Watchlist Tab Styles
   ========================================================================== */

.watchlist-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.view-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

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

.add-watchlist-form {
  display: flex;
  gap: 8px;
}

.add-watchlist-form .text-input {
  width: 110px;
}

.add-watchlist-form .note-input {
  width: 180px;
}

.watchlist-table-card {
  padding: 0;
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.data-table th, .data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table th {
  background-color: var(--bg-secondary);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.symbol-link-btn {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
}

.symbol-link-btn:hover {
  color: #60a5fa;
}

.table-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}
.table-badge.bullish { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.table-badge.bearish { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.table-badge.neutral { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }

.rr-table-val.favorable {
  color: #34d399;
}

.action-col {
  display: flex;
  gap: 6px;
}

.empty-watchlist {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

/* Footer */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 12px 20px;
  margin-top: auto;
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

.footer-sep {
  color: var(--border-color);
}

/* Utilities */
.bold { font-weight: 700; }
.text-success { color: #34d399; }
.text-danger { color: #f87171; }
.placeholder-text { color: var(--text-muted); }
.empty-text { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* ==========================================================================
   Responsive Breakpoints (Mobile, Tablet, Desktop)
   VPN Mobile Browser Friendly
   ========================================================================== */

@media (max-width: 1024px) {
  .hero-card {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  
  .hero-action {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-tabs {
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    text-align: center;
  }

  .hero-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .hero-action {
    grid-column: span 1;
  }

  .search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .symbol-search-wrapper {
    flex: 1;
    width: 100%;
  }

  .input-with-button .text-input {
    flex: 1;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-group {
    width: 100%;
  }

  .btn-toggle {
    flex: 1;
  }

  .chart-canvas {
    height: 440px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .add-watchlist-form {
    width: 100%;
    flex-direction: column;
  }

  .add-watchlist-form .text-input,
  .add-watchlist-form .note-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 10px;
  }

  .stock-title {
    font-size: 20px;
  }

  .price-val {
    font-size: 22px;
  }

  .candidate-toggles-bar {
    gap: 4px;
  }

  .toggle-chip {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ==========================================================================
   Screener Tab Styles
   ========================================================================== */

.screener-header {
  margin-bottom: 20px;
}

.screener-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

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

.screener-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.select-input {
  width: 100%;
  cursor: pointer;
  background-color: var(--bg-secondary, #1e293b);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 13px;
}

.select-input option {
  background-color: #0f172a;
  color: #ffffff;
}

.screener-action {
  display: flex;
  justify-content: flex-end;
}

.btn-large {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
}

/* Screener Progress Card */
.screener-progress-card {
  margin-top: 16px;
  border-left: 4px solid var(--primary-color, #3b82f6);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-title {
  font-weight: 600;
  color: #ffffff;
}

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

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary, #1e293b);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Screener Results Table */
.screener-results-card {
  margin-top: 20px;
  padding: 20px;
}

.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.screener-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.screener-row:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.rank-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.rank-1 {
  background: #f59e0b;
  color: #000000;
}

.rank-2 {
  background: #94a3b8;
  color: #000000;
}

.rank-3 {
  background: #b45309;
  color: #ffffff;
}

.stock-cell {
  display: flex;
  flex-direction: column;
}

.stock-name {
  font-weight: 600;
  color: #ffffff;
}

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

.market-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

.support-cell {
  display: flex;
  flex-direction: column;
}

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

.score-pill {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 13px;
}

.screener-tabs-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.subtab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.subtab-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.count-badge {
  font-size: 12px;
  opacity: 0.85;
}

.watch-reason-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 280px;
  white-space: normal;
  line-height: 1.3;
}

.trend-score-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rr-cell {
  display: flex;
  flex-direction: column;
}

.rr-sub-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.target-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-tag.strong {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.target-tag.meaningful {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.empty-table-cell {
  text-align: center;
  padding: 30px !important;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Recommendation Evaluation Card Styles (Analysis Tab)
   ========================================================================== */
.recommendation-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.rec-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rec-status-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.3px;
}

.rec-status-badge.eligible {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.rec-status-badge.watch {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.rec-status-badge.rejected {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.rec-score-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.rec-score-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rec-score-num {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}

.rec-score-max {
  font-size: 14px;
  color: var(--text-muted);
}

.rec-score-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.rec-entry-state {
  color: #ffffff;
}

.rec-target-sub {
  color: var(--text-muted);
}

.rec-alerts-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.rec-alert-item {
  color: #f59e0b;
  font-size: 12px;
  line-height: 1.5;
}

.rec-components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.rec-comp-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rec-comp-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Recommendation Detailed Breakdown Table */
.rec-details-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.rec-details-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rec-details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rec-details-table th,
.rec-details-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.rec-details-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  font-size: 11.5px;
}

.rec-details-table th.text-center,
.rec-details-table td.text-center {
  text-align: center;
}

.rec-details-table th.text-right,
.rec-details-table td.text-right {
  text-align: right;
}

.rec-details-table .item-name {
  font-weight: 600;
  color: #ffffff;
  display: block;
}

.rec-details-table .item-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.rec-details-table .metric-detail {
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.4;
}

.rec-details-table .metric-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: #e2e8f0;
}

.eval-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.eval-pill.good {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.eval-pill.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.eval-pill.bad {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.eval-pill.neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.rec-details-table tr.highlight-penalty {
  background: rgba(239, 68, 68, 0.05);
}

.rec-details-table tr.total-row {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
}

.rec-details-table tr.total-row td {
  border-top: 2px solid rgba(255, 255, 255, 0.15);
  border-bottom: none;
  padding-top: 12px;
  padding-bottom: 12px;
}

.rec-details-table .contrib-val {
  font-weight: 700;
  color: #38bdf8;
  font-size: 12.5px;
}

.rec-details-table .contrib-val .max-denom {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.rec-details-table .contrib-val.danger {
  color: #f87171;
}

/* Screener Return Banner in Analysis Tab */
.screener-back-banner {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-left: 4px solid #3b82f6;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.screener-back-banner .back-btn {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.screener-back-banner .back-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #ffffff;
  transform: translateX(-3px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.screener-back-banner .back-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Settings & Automation Tab Styles
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.settings-card {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

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

.settings-card .card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card .card-icon {
  font-size: 20px;
}

.settings-card .card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main, #f8fafc);
  margin: 0;
}

.settings-hint {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #475569;
  transition: .3s;
  border-radius: 26px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: #10b981;
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(22px);
}

/* Scheduler Live Status Banner */
.scheduler-status-banner {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-left: 4px solid #64748b;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.scheduler-status-banner.active {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main, #f8fafc);
  margin-bottom: 8px;
}

.status-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  display: inline-block;
}

.status-pulse-dot.on {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-details {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Form layout rows */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.input-unit-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-unit-group .form-control {
  flex: 1;
}

.unit-text {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action .form-control {
  padding-right: 44px;
}

.btn-icon-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted, #94a3b8);
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-icon-toggle:hover {
  color: var(--text-main, #f8fafc);
  background: rgba(255, 255, 255, 0.05);
}

.label-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  margin-left: 6px;
  font-weight: 600;
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-top: 6px;
  line-height: 1.4;
}

.checkbox-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  border: 1px solid var(--border-color, #334155);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main, #f8fafc);
}

/* Radio cards */
.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

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

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-color, #334155);
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.radio-card:hover {
  border-color: #3b82f6;
}

.radio-card.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.radio-card input {
  margin-top: 3px;
}

.radio-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
}

.radio-card-desc {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
  line-height: 1.4;
}

.kis-config-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color, #334155);
  transition: opacity 0.3s;
}

.kis-config-section.dim {
  opacity: 0.55;
}

.sub-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-hint {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  font-weight: normal;
}

.radio-inline-group {
  display: flex;
  gap: 20px;
  margin-top: 6px;
}

.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

/* Action box and test result */
.settings-action-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color, #334155);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.test-result-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid transparent;
}

.test-result-box.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.test-result-box.error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.test-result-box .result-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.test-result-box .result-extra {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.85;
}

.info-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12px;
  color: #93c5fd;
  margin-top: 20px;
  line-height: 1.5;
}

.info-callout code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fef08a;
}

/* ==========================================================================
   News & Corporate Context Analysis Component Styling
   ========================================================================== */

.news-context-card {
  grid-column: 1 / -1; /* 화면 전체 너비로 시원하게 확장 */
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
  margin-bottom: 24px;
}

.news-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  padding: 14px 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.news-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.news-source-tag {
  font-size: 11px;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.news-source-banner {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-source-banner .banner-icon {
  font-size: 14px;
}

.news-source-banner .banner-guide a:hover {
  text-decoration: underline;
}

.news-header-title h4 {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.news-subtitle {
  font-size: 11px;
  color: #94a3b8;
  display: block;
  margin-top: 3px;
}

.news-refresh-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-color: rgba(59, 130, 246, 0.5);
  color: #60a5fa;
}

.news-refresh-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.news-loading-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  color: #94a3b8;
  font-size: 13px;
  justify-content: center;
}

/* 3대 핵심 메트릭 그리드 */
.news-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .news-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.news-metric-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 8px;
  padding: 14px;
}

.news-metric-box .box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.news-metric-box .box-label {
  font-weight: 600;
  font-size: 13px;
  color: #cbd5e1;
}

.news-metric-box .box-badge {
  font-weight: 800;
  font-size: 17px;
  padding: 2px 8px;
  border-radius: 6px;
}

.box-badge.positive {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.box-badge.negative {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.box-badge.neutral {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.box-badge.risk-low {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.box-badge.risk-medium {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.box-badge.risk-high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.box-badge.conf-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.news-metric-box .box-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 10px;
}

.metric-gauge-track {
  height: 8px;
  background: rgba(51, 65, 85, 0.6);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.metric-gauge-fill {
  height: 100%;
  position: absolute;
  border-radius: 4px;
  transition: width 0.3s ease, left 0.3s ease;
}

.risk-fill {
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ef4444 100%);
  left: 0;
}

.conf-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #6366f1 100%);
  left: 0;
}

.gauge-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
  margin-top: 5px;
}

/* 요약 배너 */
.news-summary-banner {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.news-summary-banner .summary-icon {
  font-size: 16px;
}

/* 최근 감지된 이벤트 목록 */
.recent-events-section {
  margin-top: 14px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.no-events-box {
  padding: 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed #334155;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

.event-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-item-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.event-item-card:hover {
  border-color: rgba(96, 165, 250, 0.5);
  transform: translateY(-1px);
}

.event-item-card.dir-positive {
  border-left: 3px solid #10b981;
}

.event-item-card.dir-negative {
  border-left: 3px solid #ef4444;
}

.event-item-card.dir-neutral {
  border-left: 3px solid #64748b;
}

.event-dir-badge {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  align-self: flex-start;
}

.event-main-content {
  flex: 1;
}

.event-top-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.event-type-tag {
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.event-title {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}

.certainty-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: auto;
}

.certainty-pill.cert-confirmed {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.certainty-pill.cert-likely {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.certainty-pill.cert-speculative {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.certainty-pill.cert-rumor {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.event-summary-text {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  line-height: 1.4;
}

.event-meta-line {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #64748b;
  flex-wrap: wrap;
}

/* Keyword Highlight & Filter Bar */
mark.kw-highlight {
  background: rgba(234, 179, 8, 0.25);
  color: #facc15;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}

.keyword-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  border: 1px solid #334155;
}

.kw-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
}

.kw-chip-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid #475569;
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kw-chip-btn:hover {
  border-color: #3b82f6;
  color: #ffffff;
}

.kw-chip-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 700;
}

/* Event Accordion for Articles */
.event-articles-accordion {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(51, 65, 85, 0.7);
}

.btn-toggle-articles {
  background: transparent;
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle-articles:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #93c5fd;
}

.article-title-list {
  list-style: none;
  padding: 8px 12px;
  margin: 8px 0 0 0;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 6px;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-title-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(51, 65, 85, 0.5);
  font-size: 12px;
}

.article-title-item:last-child {
  border-bottom: none;
}

.art-press {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
}

.art-link {
  color: #e2e8f0;
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.art-link:hover {
  color: #60a5fa;
  text-decoration: underline;
}

.art-title-text {
  color: #e2e8f0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.art-date {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.ext-icon {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.7;
}

/* All Articles Inspector */
.all-articles-inspector {
  margin-top: 18px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
}

.inspector-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: rgba(30, 41, 59, 0.6);
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  user-select: none;
  transition: background 0.15s ease;
}

.inspector-header:hover {
  background: rgba(51, 65, 85, 0.6);
  color: #ffffff;
}

.inspector-toggle-icon {
  font-size: 11px;
  color: #60a5fa;
}

.inspector-body {
  padding: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.inspector-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.inspector-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.inspector-table th, .inspector-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  text-align: left;
}

.inspector-table th {
  color: #94a3b8;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.4);
}

.press-badge {
  display: inline-block;
  padding: 1px 6px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 4px;
  font-size: 11px;
  color: #cbd5e1;
}

.link-btn {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Keyword Preset Management Sub-section Styling
   ========================================================================== */

.keyword-preset-section {
  margin-top: 24px;
  border-top: 1px solid #334155;
  padding-top: 20px;
}

.sub-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.sub-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.sub-section-desc {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

.reset-ai-btn {
  font-size: 12px;
  padding: 6px 12px;
  color: #cbd5e1;
  border-color: #475569;
}

.reset-ai-btn:hover {
  border-color: #94a3b8;
  color: #fff;
}

.keyword-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid #334155;
  padding-bottom: 8px;
}

.keyword-tabs .tab-btn {
  background: transparent;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #94a3b8;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.keyword-tabs .tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
}

.keyword-tabs .tab-btn.active {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: #fff;
  font-weight: 600;
}

.add-keyword-form {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.add-kw-inputs {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.add-kw-inputs input,
.add-kw-inputs select {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
}

.add-kw-inputs input[type="text"]:first-child {
  flex: 2;
  min-width: 140px;
}

.add-kw-inputs .cat-input {
  flex: 1;
  min-width: 100px;
}

.add-kw-btn {
  font-size: 12px;
  padding: 7px 14px;
  white-space: nowrap;
}

.keyword-table-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #334155;
  border-radius: 8px;
}

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

.keyword-table th {
  background: #1e293b;
  font-size: 11px;
  padding: 8px 12px;
  color: #94a3b8;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
}

.keyword-table td {
  padding: 8px 12px;
  font-size: 12px;
  border-top: 1px solid #1e293b;
  color: #e2e8f0;
}

.kw-type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.kw-type-badge.type-sentiment {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.kw-type-badge.type-event {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.kw-type-badge.type-theme {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.kw-cat {
  font-size: 11px;
  color: #64748b;
  margin-left: 3px;
}

.kw-hint-badge {
  font-size: 11px;
  font-weight: 700;
}

.kw-hint-badge.hint-positive {
  color: #10b981;
}

.kw-hint-badge.hint-negative {
  color: #ef4444;
}

.kw-hint-badge.hint-neutral {
  color: #94a3b8;
}

.kw-source-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.kw-source-badge.source-ai {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.kw-source-badge.source-user {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.btn-text-danger {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  text-decoration: underline;
}

.toggle-switch.small {
  width: 32px;
  height: 18px;
}

.toggle-switch.small .slider:before {
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
}

.toggle-switch.small input:checked + .slider:before {
  transform: translateX(14px);
}

/* ==========================================================================
   Historical Backtest Module Styles
   ========================================================================== */

.preset-pill-group {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(71, 85, 105, 0.6);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #f8fafc;
}

.preset-btn.active {
  background: #3b82f6;
  border-color: #60a5fa;
  color: #ffffff;
  font-weight: 600;
}

.backtest-date-item input[type="date"] {
  width: 100%;
}

.input-with-quick-caps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.capital-badge-hint {
  font-size: 11px;
  color: #94a3b8;
}

/* 5대 성과 지표 그리드 */
.backtest-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .backtest-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .backtest-summary-grid {
    grid-template-columns: 1fr;
  }
}

.backtest-kpi-card {
  padding: 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(51, 65, 85, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease;
}

.backtest-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.4);
}

.backtest-kpi-card.change-up {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(15, 23, 42, 0.8) 100%);
}

.backtest-kpi-card.change-down {
  border-left: 4px solid #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(15, 23, 42, 0.8) 100%);
}

.backtest-kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}

.backtest-kpi-card .kpi-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: #f1f5f9;
}

.backtest-kpi-card.change-up .kpi-value,
.text-up {
  color: #f87171 !important;
}

.backtest-kpi-card.change-down .kpi-value,
.text-down {
  color: #60a5fa !important;
}

.text-accent {
  color: #38bdf8 !important;
}

.backtest-kpi-card .kpi-sub {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

/* 성과 테이블 요소 */
.backtest-table th.return-col,
.backtest-table td.return-col,
.backtest-table th.pnl-col,
.backtest-table td.pnl-col,
.backtest-table th.val-col,
.backtest-table td.val-col {
  text-align: right;
}

.backtest-table .change-up {
  color: #f87171 !important;
}

.backtest-table .change-down {
  color: #60a5fa !important;
}

.backtest-table .change-flat {
  color: #94a3b8 !important;
}

.target-stop-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.mdd-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.font-xs {
  font-size: 11px;
}

.badge-holding {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.4);
}

.entry-price-val {
  font-weight: 700;
  color: #e2e8f0;
}

.entry-date-sub {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.stock-sub-meta {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Table exit vs hold highlight columns */
.highlight-col-th {
  background: rgba(30, 41, 59, 0.5);
}

.highlight-col-td {
  background: rgba(30, 41, 59, 0.25);
}

.exit-cell, .hold-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.exit-status-row {
  margin-bottom: 2px;
}

.exit-price-row, .hold-price-row {
  font-size: 13px;
  color: #f1f5f9;
}

.diff-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.block-sub {
  display: block;
  color: #64748b;
}

.action-btn-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-chart-review {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid #3b82f6;
  color: #ffffff;
}

.btn-chart-review:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

/* Backtest Trade Review Modal Styles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.backtest-chart-modal-dialog {
  width: 95%;
  max-width: 1140px;
  background: #182234;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #283548;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 8px 0;
}

.modal-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 600;
}

.meta-pill.buy-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.meta-pill.tp-pill {
  background: rgba(5, 150, 105, 0.15);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.meta-pill.sl-pill {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.meta-pill.result-pill {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.meta-pill.hold-pill {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.btn-close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.modal-body {
  padding: 12px 16px;
  overflow-y: auto;
  position: relative;
  background: #182234;
}

.modal-loading-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 14px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #283548;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111a28;
}

.modal-tip {
  font-size: 12px;
  color: #64748b;
}

/* ============================================================== */
/* Multi-Condition Strategy Presets & Weights Sliders Styles      */
/* ============================================================== */
.strategy-preset-container {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.strategy-preset-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.strategy-preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.strategy-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.strategy-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #f8fafc;
}

.strategy-btn.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.advanced-filter-section {
  margin-top: 14px;
  margin-bottom: 14px;
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.4);
}

.advanced-filter-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.4);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.advanced-filter-toggle:hover {
  background: rgba(30, 41, 59, 0.7);
}

.toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-icon {
  font-size: 12px;
  color: #3b82f6;
}

.toggle-title {
  font-size: 13px;
  color: #e2e8f0;
}

.advanced-filter-body {
  padding: 16px;
  border-top: 1px solid #334155;
}

.advanced-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.weights-adjustment-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 14px;
}

.weights-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  font-size: 13px;
  color: #cbd5e1;
}

.weights-sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.weight-slider-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #94a3b8;
}

.slider-label strong {
  color: #38bdf8;
}

.weight-slider-item input[type="range"] {
  width: 100%;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* ======================================================== */
/* Backtest Persistent Snapshot Controls                     */
/* ======================================================== */
.snapshot-bar-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid #3b82f6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.snapshot-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.snapshot-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}

.snapshot-title-icon {
  font-size: 16px;
}

.snapshot-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

.snapshot-controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.snapshot-select-wrapper {
  flex: 1;
  min-width: 280px;
}

.snapshot-select {
  width: 100%;
  background: #0f172a;
  border: 1px solid #475569;
  color: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.snapshot-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.snapshot-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.snapshot-badge-fresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.snapshot-btn-group {
  display: flex;
  gap: 6px;
}

.snapshot-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.snapshot-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #64748b;
}

.snapshot-btn.btn-danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.snapshot-btn.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ffffff;
}

/* ======================================================== */
/* Snapshot Manager Modal & Table Styles                    */
/* ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-dialog-large {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 100%;
  max-width: 960px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.modal-close-btn:hover {
  color: #f1f5f9;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.snapshot-meta-banner {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #cbd5e1;
}

.snapshot-table-wrapper {
  overflow-x: auto;
  border: 1px solid #334155;
  border-radius: 8px;
}

.snapshot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.snapshot-table th {
  background: #0f172a;
  color: #94a3b8;
  padding: 12px 14px;
  font-weight: 600;
  border-bottom: 1px solid #334155;
  white-space: nowrap;
}

.snapshot-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  color: #e2e8f0;
  vertical-align: middle;
}

.snapshot-table tr:hover {
  background: rgba(51, 65, 85, 0.3);
}

.snapshot-table tr.active-snap-row {
  background: rgba(16, 185, 129, 0.1);
}

.snapshot-name-cell {
  font-weight: 600;
  color: #38bdf8;
}

.snapshot-date-cell {
  font-family: monospace;
  color: #f59e0b;
}

.snapshot-created-cell {
  font-size: 12px;
  color: #94a3b8;
}

.snap-action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.btn-xs-snap {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-xs-snap:hover {
  background: #334155;
  color: #ffffff;
}

.btn-xs-snap.btn-apply {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.btn-xs-snap.btn-apply:hover {
  background: #10b981;
  color: #ffffff;
}

.btn-xs-snap.btn-delete {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.btn-xs-snap.btn-delete:hover {
  background: #ef4444;
  color: #ffffff;
}

.snapshot-rename-input {
  background: #0f172a;
  border: 1px solid #38bdf8;
  color: #f1f5f9;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
  max-width: 200px;
}

.snapshot-btn.btn-manage {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.snapshot-btn.btn-manage:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
}


/* ==========================================================================
   AUTHENTICATION OVERLAY & MODAL STYLES
   ========================================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 25px rgba(56, 189, 248, 0.1);
  overflow: hidden;
  animation: authFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authFadeIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  padding: 30px 24px 16px;
  text-align: center;
  border-bottom: 1px solid #334155;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.5) 100%);
}

.auth-logo {
  font-size: 40px;
  margin-bottom: 8px;
  line-height: 1;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 14px;
  color: #38bdf8;
  font-weight: 600;
  margin: 0;
}

.auth-body {
  padding: 24px;
}

.auth-desc {
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.5;
  text-align: center;
  margin-bottom: 20px;
}

.auth-desc strong {
  color: #f1f5f9;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.auth-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.auth-footer {
  padding: 14px 20px;
  text-align: center;
  border-top: 1px solid #334155;
  background: #0f172a;
  font-size: 11.5px;
  color: #64748b;
}

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

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
}


/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & PWA STYLES
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  /* Hide desktop header tabs on mobile to declutter */
  .app-header .nav-tabs {
    display: none;
  }

  /* Compact top header */
  .app-header {
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 8px 12px;
  }

  .header-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .brand {
    gap: 8px;
  }

  .brand-icon {
    font-size: 22px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-sub {
    display: none;
  }

  .system-status {
    gap: 6px;
  }

  .system-status .status-text {
    display: none;
  }

  /* Main content bottom clearance for mobile nav */
  .main-content {
    padding: 10px 10px calc(72px + env(safe-area-inset-bottom, 0px)) 10px;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #334155;
    z-index: 10000;
    justify-content: space-around;
    align-items: center;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 4px;
    flex: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item .nav-icon {
    font-size: 19px;
    line-height: 1.2;
    margin-bottom: 2px;
    transition: transform 0.15s ease;
  }

  .bottom-nav-item .nav-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.3px;
  }

  .bottom-nav-item.active {
    color: #38bdf8;
  }

  .bottom-nav-item.active .nav-icon {
    transform: scale(1.15);
  }

  .bottom-nav-item:active {
    opacity: 0.7;
    transform: scale(0.95);
  }

  /* Prevent iOS zoom on input focus */
  input[type="text"],
  input[type="number"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Full-width responsive cards & tables */
  .card {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 12px;
  }

  .chart-canvas {
    height: 380px !important;
    min-height: 380px;
  }

  /* Table horizontal scroll wrappers */
  .table-responsive,
  .keyword-table-container,
  .snapshot-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Auth modal mobile friendly */
  .auth-card {
    max-width: 95vw;
    margin: 10px;
    border-radius: 12px;
  }
}
