/* Production feature panels */
.app-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.filter-btn,
.row-actions button,
.btn-edit-trade,
.btn-delete-trade,
.link-btn {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  font-size: 12px;
  font-family: var(--font-sans);
}

.filter-btn.active,
.filter-btn:hover,
.row-actions button:hover,
.link-btn:hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(59, 130, 246, 0.32);
  color: var(--text-primary);
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.row-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px 18px;
}

@media (min-width: 768px) {
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) {
  .settings-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.health-summary-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 600px) {
  .health-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .health-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.health-overview-card {
  min-height: 112px;
  padding: 12px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.008)),
    rgba(10, 17, 31, 0.78);
}

.health-overview-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: rgba(96, 165, 250, 0.22);
  opacity: 0.72;
  pointer-events: none;
}

.health-card-header {
  min-height: 18px;
  margin-bottom: 10px;
}

.health-card-header .card-label {
  color: #a8b6ca;
  font-size: 11px;
  font-weight: 800;
}

.health-primary-value {
  margin-top: 2px;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.05;
  letter-spacing: 0;
}

.health-card-footer {
  min-height: 24px;
  margin-top: auto;
  padding-top: 9px;
  color: #76869d;
  border-top-color: rgba(148, 163, 184, 0.09);
}

#health-status-card.is-normal::after {
  background: rgba(59, 130, 246, 0.62);
}

#health-status-card.is-warning::after {
  background: rgba(245, 158, 11, 0.68);
}

#health-status-card.is-error::after {
  background: rgba(239, 68, 68, 0.72);
}

#health-status-card.is-closed::after {
  background: rgba(100, 116, 139, 0.62);
}

#health-status-card.is-normal #health-status {
  color: #f8fafc;
}

#health-status-card.is-warning #health-status {
  color: #fbbf24;
}

#health-status-card.is-error #health-status {
  color: #f87171;
}

#health-status-card.is-closed #health-status {
  color: #cbd5e1;
}

.health-mail-card {
  min-height: 112px;
}

.health-mail-signal-list {
  display: grid;
  gap: 5px;
  margin-top: 0;
}

.health-mail-signal-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.75fr) minmax(64px, 0.55fr) minmax(0, 1.45fr);
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.health-mail-signal-name {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.health-mail-signal-row strong {
  justify-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.09);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.health-mail-signal-row small {
  min-width: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-mail-signal-row.is-sent {
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.055);
}

.health-mail-signal-row.is-sent strong {
  background: rgba(59, 130, 246, 0.12);
  color: var(--success);
}

.health-mail-signal-row.is-skipped {
  border-color: rgba(245, 158, 11, 0.22);
  background: rgba(245, 158, 11, 0.06);
}

.health-mail-signal-row.is-skipped strong {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.health-mail-signal-row.is-failed {
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.06);
}

.health-mail-signal-row.is-failed strong {
  background: rgba(239, 68, 68, 0.14);
  color: var(--danger);
}

.health-mail-signal-row.is-muted {
  opacity: 0.82;
}

@media (max-width: 720px) {
  .health-mail-signal-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .health-mail-signal-row small {
    white-space: normal;
  }
}

.health-analytics-value {
  margin: 0;
}

#health-pv-uv {
  font-size: 21px;
  line-height: 1.1;
  white-space: nowrap;
}

.health-analytics-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.view-details-hover-text {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: #60a5fa;
  font-weight: 800;
  transition: gap 0.2s ease, color 0.2s ease;
}

.comparison-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.comparison-panel h4 {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.text-success {
  color: var(--success) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.cell-amount-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}

.cell-commission-subtext {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.65;
  margin-top: 2px;
}

/* ==========================================
   TRADE MODAL OVERHAUL (design-taste-frontend)
   ========================================== */

/* 弹窗卡片增强 - 暗黑玻璃态强化与纵向滚动保护 */
.modal-content-trade {
  background: rgba(10, 15, 30, 0.88) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(20px) !important;
  max-width: 500px !important;
  
  /* 弹性布局与滚动限高 */
  max-height: 92vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 18px 20px !important; /* 收缩内边距 */
}

.modal-content-trade .modal-body {
  overflow-y: auto !important;
  flex: 1 !important;
  padding-right: 4px !important;
  margin-right: -4px !important;
}

/* 隐藏分组标题，但保留 CSS 供其他可能参考 */
.form-section-title {
  display: none;
}

/* 核心表单控件紧凑微调 (只在交易弹窗中生效) */
.modal-content-trade .form-group {
  margin-bottom: 10px !important;
  gap: 4px !important;
}

.modal-content-trade .form-group label {
  margin-bottom: 3px !important;
  font-size: 11px !important;
}

.modal-content-trade .form-group input,
.modal-content-trade .form-group select {
  padding: 8px 12px !important;
  font-size: 13px !important;
  border-radius: 8px !important;
}

.modal-content-trade .form-row,
.modal-content-trade .form-row-3col {
  gap: 10px !important;
  margin-bottom: 0 !important;
}

/* 结算数据大牌 Billboard (微缩版) */
.settlement-billboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 12px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.billboard-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.billboard-label {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0.8;
}

.billboard-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* 结算大牌右侧高亮部分 */
.highlight-item {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding-left: 12px;
}

.highlight-value {
  font-size: 18px;
  transition: text-shadow 0.3s ease, color 0.3s ease;
}

/* 自适应 BUY/SELL 状态颜色 */
.settlement-billboard.theme-buy .highlight-value {
  color: #60a5fa; /* 明亮的蓝色 */
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.25);
}

.settlement-billboard.theme-sell .highlight-value {
  color: #60a5fa; /* 明亮的翠绿色 */
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.25);
}

/* 底部操作行紧凑化 */
.modal-content-trade .settings-actions {
  margin-top: 16px !important;
}

/* 触觉按钮反馈 */
.modal-content-trade .action-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  padding: 10px 16px !important;
  font-size: 14px !important;
  border-radius: 8px !important;
}

.modal-content-trade .action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.modal-content-trade .action-btn:active {
  transform: scale(0.97) translateY(0);
}

/* Globally handled by close-btn styles */

/* ==========================================
   LOADING STATES & SKELETAL SHIMMER SYSTEMS
   ========================================== */

/* Shimmer Sweep Animation */
@keyframes shimmer-sweep {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

/* Skeletal Shimmer Placeholder */
.shimmer-placeholder {
  display: inline-block;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 37%,
    rgba(255, 255, 255, 0.03) 63%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 1.6s infinite linear;
  border-radius: 4px;
}

/* Metric loading states: when card is loading, make texts transparent and overlay shimmer */
.metric-card.is-loading .loading-shimmer-text {
  color: transparent !important;
  position: relative;
  pointer-events: none;
  user-select: none;
}

.metric-card.is-loading .loading-shimmer-text::after {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  width: 100%;
  height: 70%;
  min-width: 60px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 37%,
    rgba(255, 255, 255, 0.03) 63%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 1.6s infinite linear;
  border-radius: 4px;
}

/* Table Skeletal Loading */
.table-skeleton-row td {
  padding: 12px 16px;
  vertical-align: middle;
}

.table-skeleton-row .shimmer-placeholder {
  height: 14px;
  width: 80%;
  min-width: 50px;
  display: block;
}

/* Chart Loading Overlay Styles */
.chart-wrapper {
  position: relative;
}

.chart-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 30, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show chart overlay when chart-wrapper is loading */
.chart-wrapper.is-loading .chart-loading-overlay {
  opacity: 1;
  pointer-events: auto;
}

.chart-loading-overlay .loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
  animation: pulse-opacity 2s infinite ease-in-out;
}

.chart-loading-overlay .shimmer-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  border-radius: 8px;
}

/* Respect Reduced Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .shimmer-placeholder,
  .metric-card.is-loading .loading-shimmer-text::after {
    animation: none !important;
    background: rgba(255, 255, 255, 0.05) !important;
  }
  .chart-loading-overlay .loading-text,
  .dropzone-loading .loading-status {
    animation: none !important;
    opacity: 0.9 !important;
  }
  .spinner-shimmer {
    animation: none !important;
  }
}

/* ==========================================
   SCREENSHOT DROPZONE & AUTO-FILL PARSER
   ========================================== */

.screenshot-dropzone {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.01);
  padding: 10px 14px;
  margin-bottom: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screenshot-dropzone:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

.screenshot-dropzone.dragover {
  background: rgba(59, 130, 246, 0.04);
  border-color: var(--accent-hover);
  border-style: solid;
  transform: scale(1.005);
}

.dropzone-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  pointer-events: none; /* Let drag events hit the parent container */
}

.dropzone-text {
  font-size: 12px;
  user-select: none;
}

.dropzone-text kbd {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.upload-icon {
  color: var(--text-muted);
}

/* Dropzone Loading Overlay */
.dropzone-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-primary);
  z-index: 5;
}

.spinner-shimmer {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s infinite linear;
}

.loading-status {
  font-size: 12px;
  letter-spacing: 0.05em;
  font-weight: 500;
  animation: pulse-opacity 1.5s infinite ease-in-out;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================
   SETTINGS MODAL SCROLL SAFETY & HIGH DENSITY
   ========================================== */

#settings-modal .modal-content {
  max-height: 90vh;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px !important;
  border-radius: 12px !important;
}

#settings-modal .modal-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
}

#settings-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

#settings-modal .settings-hint {
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}

#settings-modal .modal-section-title {
  font-size: 12px;
  margin-bottom: 8px;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 6px;
}

#settings-modal .modal-section-title-spaced {
  margin-top: 12px;
}

#settings-modal .form-group {
  margin-bottom: 10px;
  gap: 4px;
}

#settings-modal .form-group label {
  margin-bottom: 2px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#settings-modal .form-group input {
  padding: 8px 12px;
  font-size: 13px;
}

#settings-modal .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

#settings-modal .settings-actions {
  margin-top: 14px;
}

#settings-modal .action-btn {
  padding: 10px 16px;
  font-size: 13px;
  width: 100%;
}

@media (max-width: 640px) {
  #settings-modal .form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ==========================================
   MULTI-TRADE SCREENSHOT RESULT TABLE
   ========================================== */

.select-trades-table-wrapper {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.4);
}

#select-trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#select-trades-table th, 
#select-trades-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

#select-trades-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

#select-trades-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Disabled Row Styling for non-RSP/SPMO */
#select-trades-table tbody tr.row-disabled {
  opacity: 0.45;
  background: rgba(0, 0, 0, 0.15);
}

#select-trades-table tbody tr.row-disabled td {
  cursor: not-allowed;
}

#select-trades-table td input[type="checkbox"],
#select-trades-table th input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

#select-trades-table tbody tr.row-disabled td input[type="checkbox"] {
  cursor: not-allowed;
}

/* Tooltip badge for unsupported tickers */
.unsupported-badge {
  display: inline-block;
  font-size: 9px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 6px;
  font-weight: 500;
}

/* ==========================================
   MULTI-TRADE ACTIONS BUTTONS
   ========================================== */
.results-actions {
  display: flex !important;
  gap: 12px !important;
  margin-top: 16px !important;
  width: 100% !important;
  justify-content: space-between !important;
}

.results-actions .action-btn {
  flex: 1 !important;
  width: auto !important; /* Cancel the width: 100% style */
  height: 42px !important;
  padding: 0 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
}

#btn-confirm-screenshot-results {
  flex: 1.8 !important; /* Make confirm button slightly wider than cancel button */
}

/* ==========================================
   IBKR FLEX SYNC TABLE
   ========================================== */
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ibkr-sync-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ibkr-sync-summary > div {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-input);
  background: rgba(255, 255, 255, 0.025);
}

.ibkr-sync-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 14px;
}

.ibkr-table-wrapper {
  max-height: 430px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-input);
  background: rgba(15, 23, 42, 0.36);
}

#ibkr-trades-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 12px;
}

#ibkr-trades-table th,
#ibkr-trades-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

#ibkr-trades-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 23, 42, 0.96);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#ibkr-trades-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

#ibkr-trades-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.ibkr-duplicate-row {
  opacity: 0.52;
}

.ibkr-unsupported-row {
  opacity: 0.58;
}

@media (max-width: 768px) {
  .toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar-actions .compact-action {
    flex: 1;
  }

  .ibkr-sync-summary {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   EXTREME ADD RULE STRIP
   ========================================== */
.extreme-rule-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.2);
}

.extreme-stage {
  min-width: 0;
  min-height: 78px;
  padding: 9px 6px;
  text-align: center;
}

.extreme-stage + .extreme-stage {
  border-left: 1px solid rgba(148, 163, 184, 0.1);
}

.extreme-stage > span,
.extreme-stage > strong,
.extreme-stage > small,
.extreme-stage > em {
  display: block;
}

.stage-threshold {
  color: #64748b;
  font: 700 10px/1.2 var(--font-mono);
}

.extreme-stage > strong {
  margin-top: 7px;
  color: #e2e8f0;
  font: 700 11px/1.2 var(--font-mono);
  white-space: nowrap;
}

.extreme-stage > em {
  margin-top: 8px;
  color: #94a3b8;
  font: normal 600 9px/1.2 var(--font-mono);
  white-space: nowrap;
}

.vix-tier-row {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.vix-tier-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.vix-tier-heading > span {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 700;
}

.vix-tier-heading > strong {
  padding: 2px 6px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  border-radius: 4px;
  color: #60a5fa;
  font-size: 9px;
  font-weight: 700;
}

.vix-tier-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.vix-tier-option {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.18);
  text-align: center;
}

.vix-tier-option.is-primary {
  border-color: rgba(59, 130, 246, 0.58);
  background: rgba(37, 99, 235, 0.13);
}

.vix-tier-option small,
.vix-tier-option span {
  display: block;
}

.vix-tier-option small {
  color: #94a3b8;
  font: 600 10px/1.2 var(--font-mono);
}

.vix-tier-option span {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 11px;
}

.vix-tier-option span strong {
  color: #60a5fa;
  font: 700 12px/1 var(--font-mono);
}

.vix-tier-row > p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 9px;
  line-height: 1.35;
}

/* ==========================================
   DASHBOARD POLISH LAYER
   Focus: dense financial console, calmer hierarchy, better scanning.
   ========================================== */
:root {
  --surface-raised: rgba(11, 18, 32, 0.78);
  --surface-hover: rgba(18, 28, 48, 0.82);
  --line-strong: rgba(148, 163, 184, 0.18);
  --accent-solid: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.24);
}

body {
  background:
    radial-gradient(circle at 18% -18%, rgba(37, 99, 235, 0.16), transparent 34rem),
    linear-gradient(180deg, #07101f 0%, #030712 42%, #020617 100%);
}

.app-container {
  gap: 18px;
  padding: 18px;
}

.dashboard-header,
.dashboard-tabs,
.glass-card,
.auth-card,
.modal-content {
  background: var(--surface-raised);
  border-color: var(--line-soft);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.24);
}

.dashboard-header {
  min-height: 70px;
}

.logo-icon {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 28px rgba(37, 99, 235, 0.22);
}

.title-text h1 {
  letter-spacing: 0;
}

.title-text .subtitle {
  color: #8fb8ff;
  letter-spacing: 0.08em;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.password-toggle:focus-visible {
  outline: none;
  border-color: rgba(96, 165, 250, 0.58) !important;
  box-shadow: var(--focus-ring) !important;
}

.action-btn,
.icon-btn,
.filter-btn,
.ticker-btn,
.timeframe-btn,
.tab-btn {
  min-height: 36px;
}

.icon-btn,
.btn-secondary,
.filter-btn,
.ticker-btn,
.timeframe-btn {
  background: rgba(15, 23, 42, 0.64);
  border-color: var(--line-soft);
}

.btn-primary,
#btn-run-backtest,
#btn-save-trade {
  color: #ffffff;
  background: var(--accent-solid) !important;
  border-color: rgba(147, 197, 253, 0.34);
}

.btn-danger {
  color: #fecaca;
  background: rgba(153, 27, 27, 0.26);
  border-color: rgba(248, 113, 113, 0.26);
}

.dashboard-tabs {
  align-self: flex-start;
  width: auto;
  padding: 4px;
}

.tab-btn {
  color: #9ca9bd;
  border: 1px solid transparent;
}

.tab-btn.active,
.filter-btn.active,
.ticker-btn.active,
.timeframe-btn.active {
  color: #f8fafc;
  background: var(--accent-soft);
  border-color: rgba(96, 165, 250, 0.38);
}

.glass-card {
  padding: 16px;
}

.glass-card::before {
  background: linear-gradient(90deg, rgba(147, 197, 253, 0.18), transparent 64%);
}

.metric-card {
  min-height: 118px;
  gap: 8px;
}

.metric-card:hover,
.glass-card:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong) !important;
}

.card-header,
.section-toolbar,
.app-section-header,
.card-header-vibe {
  align-items: center;
}

.card-label,
.summary-label,
.stats-label,
.macro-label {
  color: #9ca9bd;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.price-value-container {
  min-height: 34px;
}

.price-display,
.macro-value,
.summary-value,
.stats-value {
  font-variant-numeric: tabular-nums;
}

.price-display {
  font-size: clamp(24px, 2.1vw, 30px);
}

.price-change-percent {
  padding: 0;
  border-radius: 0;
  background: none;
}

.card-footer-metrics {
  gap: 12px;
  min-width: 0;
}

.card-footer-metrics div {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flag-item {
  gap: 10px;
}

.flag-label {
  min-width: 0;
}

.flag-status {
  flex: 0 0 auto;
}

.chart-container {
  min-height: 410px;
}

.chart-wrapper {
  min-height: 330px;
}

.chart-shimmer-fill {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-input);
}

.strategy-panel {
  min-width: 0;
}

.rule-box,
.summary-item,
.rebalance-panel,
.stats-box,
.macro-indicator-box {
  background: rgba(2, 6, 23, 0.24);
  border-color: var(--line-subtle);
}

.rule-title-row h4 {
  letter-spacing: 0;
}

.rule-desc {
  color: #a3afc2;
}

.console-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.macro-radar-row {
  margin: 2px 0;
}

.macro-radar-card {
  flex: 1;
}

.macro-radar-card .section-title {
  margin: 0;
  padding: 0;
  border: 0;
}

.macro-indicators-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1.1fr 1.7fr;
  gap: 12px;
}

.macro-indicator-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-input);
}

.macro-rec-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(2, 6, 23, 0.24));
  border-color: rgba(96, 165, 250, 0.22);
}

.macro-label {
  margin-bottom: 8px;
}

.macro-label-accent {
  color: #93c5fd;
}

.macro-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.macro-value {
  color: #f8fafc;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.macro-rec-title {
  min-width: 0;
  color: #f8fafc;
  font-size: 15px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.macro-desc {
  margin-top: 8px;
  color: #75839a;
  font-size: 11px;
  line-height: 1.45;
}

.macro-desc-accent {
  color: #a9c3ff;
}

.macro-rec-factors {
  margin-top: 6px;
  color: #7184a3;
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
}

.badge-compact {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.table-wrapper {
  scrollbar-color: rgba(148, 163, 184, 0.34) rgba(2, 6, 23, 0.18);
}

.table-wrapper::-webkit-scrollbar {
  height: 10px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: rgba(2, 6, 23, 0.22);
  border-radius: 999px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  color: #d5ddeb;
}

.empty-row td {
  background: rgba(2, 6, 23, 0.18);
  color: #7f8ba0;
  font-style: normal;
}

.form-group label,
#settings-modal .form-group label,
.modal-content-trade .form-group label {
  color: #aab6c8;
  font-weight: 650;
}

.form-group input,
.form-group select,
.form-group textarea,
#settings-modal .form-group input,
.modal-content-trade .form-group input,
.modal-content-trade .form-group select,
.password-wrapper {
  background: rgba(2, 6, 23, 0.42);
  border-color: var(--line-soft);
}

.auth-card {
  max-width: 430px;
  padding: 34px;
}

.auth-card .logo-area {
  margin-bottom: 24px;
}

.auth-card .logo-icon {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 18px 36px rgba(37, 99, 235, 0.25);
}

.auth-card h2 {
  letter-spacing: 0;
}

.auth-tabs .tab-btn {
  min-width: 0;
}

@media (min-width: 760px) {
  .console-actions {
    grid-template-columns: 1fr 1fr;
  }

  .console-actions #btn-force-run {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .macro-indicators-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-container {
    padding: 12px;
    gap: 14px;
  }

  .dashboard-header {
    position: static;
    padding: 14px;
  }

  .logo-area {
    gap: 12px;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .logo-icon::before {
    top: 8px;
    left: 8px;
    width: 14px;
    height: 14px;
  }

  .title-text h1 {
    font-size: 20px;
    line-height: 1.16;
  }

  .title-text .subtitle {
    font-size: 10px;
  }

  .dashboard-tabs {
    width: 100%;
  }

  .section-toolbar,
  .app-section-header,
  .card-header-vibe {
    flex-direction: column;
    align-items: stretch;
  }

  .macro-indicators-grid {
    grid-template-columns: 1fr;
  }

  .card-footer-metrics {
    flex-direction: column;
    gap: 4px;
  }

  .metric-card {
    min-height: 104px;
  }

  .chart-container,
  .chart-wrapper {
    min-height: 300px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 26px 18px;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .connection-status {
    width: 100%;
    justify-content: center;
  }

  .icon-btn {
    padding: 8px 12px;
  }
}

/* Data freshness and return methodology */
.data-freshness-panel {
  display: grid;
  flex: 1 1 auto;
  min-width: 280px;
  max-width: 570px;
  gap: 4px 10px;
  padding: 7px 11px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 9px;
  background: rgba(2, 6, 23, 0.3);
  color: var(--text-secondary);
}

.data-freshness-main,
.data-freshness-meta {
  display: flex;
  align-items: center;
  min-width: 0;
}

.data-freshness-main {
  gap: 7px;
  color: #dbeafe;
  font-size: 11px;
  white-space: nowrap;
}

.data-freshness-session {
  padding: 2px 6px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 999px;
  color: #93c5fd;
  font-size: 10px;
  line-height: 1.2;
}

.data-freshness-meta {
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: #718096;
  font-size: 10px;
  line-height: 1.3;
}

.data-freshness-meta span {
  white-space: nowrap;
}

.data-freshness-meta b {
  color: #aebdce;
  font-weight: 600;
}

.data-freshness-retry {
  min-height: 22px;
  margin-left: auto;
  padding: 0 8px;
  border: 1px solid rgba(248, 113, 113, 0.36);
  border-radius: 6px;
  background: rgba(127, 29, 29, 0.24);
  color: #fecaca;
  font-size: 10px;
  font-weight: 700;
}

.data-freshness-retry:hover {
  background: rgba(153, 27, 27, 0.36);
}

.data-freshness-panel.is-closed .data-freshness-session {
  border-color: rgba(251, 191, 36, 0.28);
  color: #fcd34d;
}

.data-freshness-panel.is-error .data-freshness-session {
  color: #fda4af;
}

.data-freshness-panel.is-error .data-freshness-session {
  border-color: rgba(251, 113, 133, 0.28);
}

.portfolio-pnl-methodology {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  margin-top: 6px;
  color: #64748b;
  font-size: 10px;
  line-height: 1.35;
}

.portfolio-pnl-methodology span {
  white-space: nowrap;
}

.portfolio-pnl-methodology span + span::before {
  content: '•';
  margin-right: 12px;
  color: rgba(148, 163, 184, 0.34);
}

.portfolio-pnl-methodology strong {
  color: #aebdce;
  font-weight: 600;
}

@media (max-width: 980px) {
  .dashboard-header {
    flex-wrap: wrap;
  }

  .data-freshness-panel {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
}

@media (max-width: 720px) {
  .portfolio-pnl-methodology {
    gap: 3px 8px;
  }

  .portfolio-pnl-methodology span + span::before {
    margin-right: 8px;
  }
}

@media (max-width: 480px) {
  .data-freshness-panel {
    min-width: 0;
  }

  .data-freshness-main {
    flex-wrap: wrap;
  }
}

/* AI Diagnosis Report & Floating Drawer Styles */
.ai-float-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: none; /* Managed by JS, default is none, shown on backtest tab */
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 30px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border: 1px solid rgba(37, 99, 235, 0.4);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
  transition: all 0.3s ease;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.ai-float-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5);
  border-color: rgba(37, 99, 235, 0.6);
}

.ai-float-trigger .sparkle-icon {
  font-size: 15px;
}

.ai-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
}

.ai-drawer.active {
  pointer-events: auto;
}

.ai-drawer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ai-drawer.active .ai-drawer-backdrop {
  opacity: 1;
}

.ai-drawer-content {
  position: absolute;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100%;
  background: rgba(10, 15, 30, 0.95) !important;
  border-left: 1px solid rgba(37, 99, 235, 0.22) !important;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0 !important;
  border-radius: 0 !important;
}

.ai-drawer.active .ai-drawer-content {
  right: 0;
}

.ai-drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-drawer-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
}

.ai-drawer-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
}

.ai-drawer-actions {
  display: flex;
  justify-content: center;
}

.btn-ai-generate {
  width: 100%;
  padding: 10px 16px !important;
  background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
  border: 1px solid rgba(37, 99, 235, 0.3) !important;
  font-size: 12.5px !important;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}

.ai-insight-card {
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  transition: all 0.2s ease;
}

.ai-insight-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(37, 99, 235, 0.25);
}

.ai-insight-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-insight-card p.ai-paragraph {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.ai-insight-card ul.ai-list {
  margin: 0;
  padding-left: 0;
  list-style-type: none;
}

.ai-insight-card ul.ai-list li {
  position: relative;
  margin-bottom: 6px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.5;
  padding-left: 14px;
}

.ai-insight-card ul.ai-list li::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: var(--card-theme-color, var(--accent));
  font-weight: bold;
}

.ai-insight-card ul.ai-list li:last-child {
  margin-bottom: 0;
}

.ai-insight-card .ai-code {
  font-family: var(--font-mono);
  background: rgba(37, 99, 235, 0.08);
  color: #93c5fd;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.ai-diagnosis-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
  text-align: center;
}

.ai-spinner-ring {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(37, 99, 235, 0.1);
  border-radius: 50%;
  border-top-color: #2563eb;
  border-right-color: #06b6d4;
  animation: ai-spin 1s linear infinite;
}

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

.ai-loading-text {
  font-size: 13px;
  color: #60a5fa;
  animation: ai-pulse 2s infinite ease-in-out;
}

@keyframes ai-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* AI Wide Modal Styles */
.modal-content-wide {
  max-width: 850px !important;
  width: calc(100% - 32px) !important;
  background: rgba(10, 15, 30, 0.95) !important;
  border: 1px solid rgba(168, 85, 247, 0.22) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(20px) !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 24px !important;
}

.ai-modal-body {
  overflow-y: auto !important;
  flex: 1 !important;
  padding-right: 4px !important;
  margin-right: -4px !important;
  scrollbar-width: thin;
}

.ai-report-body {
  display: grid;
  grid-template-cols: 1fr 1fr;
  gap: 16px;
  width: 100%;
  padding-bottom: 8px;
}

.ai-report-body .ai-insight-card {
  margin-bottom: 0 !important;
}

.ai-report-body .ai-model-badge {
  grid-column: span 2;
  margin-top: 8px;
}

@media (max-width: 768px) {
  .ai-report-body {
    grid-template-cols: 1fr;
    gap: 12px;
  }
  .ai-report-body .ai-model-badge {
    grid-column: span 1;
  }
}

/* ==========================================================================
   ADVANCED BACKTEST TOOLS: RISK-ADJUSTED, MATRIX, & COMPARISON LEADERBOARD
   ========================================================================== */

.backtest-advanced-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 0;
  width: 100%;
}

.matrix-controls-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 12px;
  background: rgba(4, 10, 22, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  margin-top: 10px;
}

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

.matrix-control-item label {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.matrix-control-item select {
  background: #0d1222;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.matrix-control-item select:focus {
  border-color: var(--accent);
}

.matrix-control-item .range-hint {
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.matrix-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  width: 100%;
  padding: 0 10px;
}

.matrix-y-axis-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.05em;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  text-align: center;
  white-space: nowrap;
}

.matrix-grid-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
}

.matrix-x-axis-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  margin-top: 4px;
}

.matrix-cell {
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 4px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.matrix-cell:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  z-index: 5;
}

.matrix-cell:active {
  transform: scale(0.95);
}

.matrix-cell .cell-val {
  font-family: var(--font-mono);
}

.matrix-cell .cell-coord {
  font-size: 8px;
  opacity: 0.4;
  margin-top: 2px;
  font-weight: 400;
}

.matrix-cell .matrix-tooltip {
  visibility: hidden;
  width: 170px;
  background-color: rgba(10, 15, 30, 0.96);
  color: #f8fafc;
  text-align: left;
  border-radius: 6px;
  padding: 8px 10px;
  position: absolute;
  z-index: 50;
  bottom: 125%;
  left: 50%;
  margin-left: -85px;
  opacity: 0;
  transition: opacity 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.4;
  font-family: var(--font-mono);
}

.matrix-cell .matrix-tooltip strong {
  color: var(--accent);
}

.matrix-cell:hover .matrix-tooltip {
  visibility: visible;
  opacity: 1;
}

.matrix-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 46px 20px;
  color: #64748b;
  font-size: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.005);
  width: 100%;
}

/* Strategy Comparison Leaderboard styling */
.comparison-leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.comparison-leaderboard-table th {
  background: rgba(255, 255, 255, 0.02);
  color: #64748b;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.comparison-leaderboard-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}

.comparison-leaderboard-table tbody tr {
  transition: background-color 0.2s;
}

.comparison-leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.comparison-leaderboard-table tr.empty-row td {
  text-align: center;
  padding: 40px;
}

.leaderboard-btn {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-btn-apply {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.2);
}

.leaderboard-btn-apply:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.leaderboard-btn-apply:active {
  transform: translateY(0);
}

.leaderboard-btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
  margin-left: 6px;
}

.leaderboard-btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

.leaderboard-btn-delete:active {
  transform: translateY(0);
}

/* Tab Buttons inside Comparison Card */
.comp-tab-btn {
  transition: all 0.2s ease-in-out;
  text-align: center;
  white-space: nowrap;
}

.matrix-grid-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
}

.matrix-x-axis-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  margin-top: 4px;
}

.matrix-cell {
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 4px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.matrix-cell:hover {
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
  z-index: 5;
}

.matrix-cell:active {
  transform: scale(0.95);
}

.matrix-cell .cell-val {
  font-family: var(--font-mono);
}

.matrix-cell .cell-coord {
  font-size: 8px;
  opacity: 0.4;
  margin-top: 2px;
  font-weight: 400;
}

.matrix-cell .matrix-tooltip {
  visibility: hidden;
  width: 170px;
  background-color: rgba(10, 15, 30, 0.96);
  color: #f8fafc;
  text-align: left;
  border-radius: 6px;
  padding: 8px 10px;
  position: absolute;
  z-index: 50;
  bottom: 125%;
  left: 50%;
  margin-left: -85px;
  opacity: 0;
  transition: opacity 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.4;
  font-family: var(--font-mono);
}

.matrix-cell .matrix-tooltip strong {
  color: var(--accent);
}

.matrix-cell:hover .matrix-tooltip {
  visibility: visible;
  opacity: 1;
}

.matrix-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 46px 20px;
  color: #64748b;
  font-size: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.005);
  width: 100%;
}

/* Strategy Comparison Leaderboard styling */
.comparison-leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.comparison-leaderboard-table th {
  background: rgba(255, 255, 255, 0.02);
  color: #64748b;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.comparison-leaderboard-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}

.comparison-leaderboard-table tbody tr {
  transition: background-color 0.2s;
}

.comparison-leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.comparison-leaderboard-table tr.empty-row td {
  text-align: center;
  padding: 40px;
}

.leaderboard-btn {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-btn-apply {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.2);
}

.leaderboard-btn-apply:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.leaderboard-btn-apply:active {
  transform: translateY(0);
}

.leaderboard-btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
  margin-left: 6px;
}

.leaderboard-btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

.leaderboard-btn-delete:active {
  transform: translateY(0);
}

/* Tab Buttons inside Comparison Card */
.comp-tab-btn {
  transition: all 0.2s ease-in-out;
}
.comp-tab-btn:hover {
  color: #c084fc !important;
  background: rgba(192, 132, 252, 0.05) !important;
}
.comp-tab-btn.active {
  background: rgba(192, 132, 252, 0.15) !important;
  color: #c084fc !important;
}

/* Strategy Name Cell Tooltip styling */
.strategy-name-cell {
  position: relative;
  cursor: help;
}

.strategy-desc-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: 20px;
  bottom: 125%;
  width: 280px;
  background: rgba(8, 14, 28, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(192, 132, 252, 0.25);
  color: #94a3b8;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.6;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  font-weight: normal;
  text-align: left;
}

.strategy-desc-tooltip strong {
  color: #f8fafc;
}

.strategy-name-cell:hover .strategy-desc-tooltip {
  visibility: visible;
  opacity: 1;
}

.strategy-name-cell .name-text {
  border-bottom: 1px dotted rgba(192, 132, 252, 0.6);
  padding-bottom: 1px;
}

/* Compact layout for Macro Radar Card placed at the top */
.macro-radar-card {
  padding: 10px 14px;
}

.macro-radar-card .card-header-vibe {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.macro-radar-card .macro-indicators-grid {
  gap: 10px;
}

.macro-radar-card .macro-indicator-box {
  min-height: 78px;
  padding: 8px 12px;
}

.macro-radar-card .macro-label {
  margin-bottom: 4px;
}

.macro-radar-card .macro-desc {
  margin-top: 4px;
}

.macro-radar-card .macro-value {
  font-size: 19px;
}

/* Guest Login Divider */
.guest-login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: #64748b;
  font-size: 13px;
}

.guest-login-divider::before,
.guest-login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guest-login-divider:not(:empty)::before {
  margin-right: 12px;
}

.guest-login-divider:not(:empty)::after {
  margin-left: 12px;
}

/* ==========================================
   WEBSITE VISIT ANALYTICS SURFACE STYLES
   ========================================== */
.analytics-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}

@media (min-width: 1024px) {
  .analytics-charts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.chart-container-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
}

/* Custom Progress Bar for distributions */
.progress-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.progress-name {
  color: var(--text-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-value-label {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 500;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 100%);
  width: 0%; /* Driven dynamically by JS */
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Alternate colors for locations top ranks */
.progress-item:nth-child(1) .progress-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}
.progress-item:nth-child(2) .progress-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}
.progress-item:nth-child(3) .progress-fill {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

/* Analytics Table styles */
.analytics-table-card {
  padding: 24px;
}

.logs-table-card {
  flex: 0 0 auto;
  padding: 18px;
}

.logs-table-card .table-responsive {
  max-height: min(48vh, 520px) !important;
  min-height: 260px;
  overflow: auto !important;
  scrollbar-gutter: stable;
}

.analytics-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.analytics-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15, 23, 42, 0.96);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.analytics-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.analytics-table tbody tr {
  transition: background-color 0.2s ease;
}

.analytics-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

/* Tiny device/badge icons or labels */
.device-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.device-badge.desktop {
  background: rgba(59, 130, 246, 0.08);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.15);
}

.device-badge.mobile {
  background: rgba(59, 130, 246, 0.08);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.15);
}

.device-badge.tablet {
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.15);
}

.sub-tab-btn {
  transition: all 0.2s ease;
}
.sub-tab-btn:hover {
  color: var(--text-primary) !important;
}
.sub-tab-btn.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}

/* Blacklist Action Buttons & Lock screen */
.btn-blacklist-action {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.btn-blacklist-action.action-block {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.15);
  background: rgba(239, 68, 68, 0.04);
}

.btn-blacklist-action.action-block:hover {
  background: var(--danger);
  color: var(--text-primary);
  border-color: var(--danger);
  box-shadow: 0 0 10px var(--danger-glow);
}

.btn-blacklist-action.action-unblock {
  color: var(--success);
  border-color: rgba(59, 130, 246, 0.18);
  background: rgba(59, 130, 246, 0.04);
}

.btn-blacklist-action.action-unblock:hover {
  background: var(--success);
  color: var(--text-primary);
  border-color: var(--success);
  box-shadow: 0 0 10px var(--success-glow);
}

/* Global Access Denied Overlay Screen */
.blacklist-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(2, 4, 12, 0.92);
  backdrop-filter: blur(32px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.blacklist-card {
  padding: 40px;
  max-width: 520px;
  width: 90%;
  border: 1px solid rgba(239, 68, 68, 0.15);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-radius: var(--radius-card);
  animation: cardScaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardScaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}


