/* ==========================================================================
   CANOA STOCK VALUATION - Premium Financial Analytics Design System
   Vanilla CSS with Glassmorphism, Dark Mode & High-Contrast Visuals
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-darkest: #070a11;
  --bg-base: #0b101c;
  --bg-card: rgba(16, 24, 40, 0.75);
  --bg-card-hover: rgba(22, 33, 56, 0.85);
  --bg-elevated: #162035;
  --bg-input: rgba(10, 16, 28, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 229, 255, 0.5);
  --border-card: rgba(255, 255, 255, 0.12);

  /* Accents */
  --cyan-main: #00e5ff;
  --cyan-glow: rgba(0, 229, 255, 0.25);
  --green-gain: #00e676;
  --green-glow: rgba(0, 230, 118, 0.2);
  --red-loss: #ff4757;
  --red-glow: rgba(255, 71, 87, 0.2);
  --gold-accent: #ffd166;
  --gold-glow: rgba(255, 209, 102, 0.2);
  --purple-accent: #8b5cf6;

  /* Typography */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Shadows & Curves */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(0, 229, 255, 0.2);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-darkest);
  background-image:
    radial-gradient(at 0% 0%, rgba(0, 229, 255, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(11, 16, 28, 1) 0px, transparent 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(7, 10, 17, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(0, 229, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-main);
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #ffffff, var(--cyan-main));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-help-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast),
    background var(--transition-fast);
}

.header-help-link:hover,
.header-help-link:focus-visible {
  color: var(--cyan-main);
  border-color: rgba(0, 229, 255, 0.45);
  background: rgba(0, 229, 255, 0.08);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cyan-main);
  background: rgba(0, 229, 255, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0, 229, 255, 0.25);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--cyan-main);
  box-shadow: 0 0 10px var(--cyan-main);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.3);
    opacity: 1;
  }

  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

.quick-active-config {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Main Layout */
.app-main {
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Cards & Glassmorphism */
.control-panel-card,
.config-editor-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-normal);
}

.control-panel-card:hover,
.config-editor-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--cyan-main);
}

.panel-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.preset-buttons-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-right: 0.25rem;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-preset.active {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan-main);
  border-color: var(--cyan-main);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

/* Enable relative positioning on your button */
.btn-preset[data-tooltip] {
  position: relative;
  cursor: pointer;
}

/* Tooltip text box */
.btn-preset[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  /* Positions tooltip right above button */
  left: 50%;
  transform: translateX(-50%);

  /* Styling */
  background-color: #1e293b;
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: normal;
  white-space: nowrap;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

/* Tooltip arrow */
.btn-preset[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #1e293b transparent transparent transparent;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

/* Show on hover */
.btn-preset[data-tooltip]:hover::after,
.btn-preset[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Controls Grid */
.control-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.6fr;
  gap: 1.25rem;
  align-items: flex-end;
}

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

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

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.invisible-label {
  visibility: hidden;
}

/* Forms & Inputs */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--cyan-main);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}

.form-textarea {
  resize: vertical;
  line-height: 1.6;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-sm,
.btn-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 180, 216, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #00c6eb 0%, #0088cc 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-xs:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.16);
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.tab-btn.active {
  color: var(--cyan-main);
  background: rgba(0, 229, 255, 0.1);
  font-weight: 600;
}

.tab-count {
  background: rgba(0, 229, 255, 0.2);
  color: var(--cyan-main);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
}

/* Tab Contents */
.tab-content {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Summary Metrics Cards */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  backdrop-filter: blur(12px);
}

.stat-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.accent-green {
  color: var(--green-gain) !important;
}

.accent-red {
  color: var(--red-loss) !important;
}

.accent-gold {
  color: var(--gold-accent) !important;
}

/* Table Toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-title-group h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-wrap {
  min-width: 200px;
}

.search-input {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
}

.column-visibility {
  position: relative;
}

.column-visibility > summary {
  list-style: none;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.column-visibility > summary::-webkit-details-marker {
  display: none;
}

.column-visibility-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 220px;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.column-visibility-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  color: var(--text-main);
  font-size: 0.85rem;
}

.column-visibility-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.column-visibility-close:hover,
.column-visibility-close:focus-visible {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.column-visibility-actions,
.column-visibility-options {
  display: grid;
  gap: 0.5rem;
}

.column-visibility-actions {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0.65rem;
}

.column-visibility-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
  font-size: 0.82rem;
  cursor: pointer;
}

/* Data Table Styling */
.table-container {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.86rem;
}

.data-table th,
.data-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table th {
  background: rgba(14, 21, 37, 0.95);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.data-table th:hover {
  color: var(--cyan-main);
}

.data-table th {
  position: relative;
}

.table-header-label {
  vertical-align: middle;
}

.column-info-button {
  width: 15px;
  height: 15px;
  margin-left: 0.35rem;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.62rem;
  line-height: 13px;
  text-align: center;
  text-transform: none;
  vertical-align: middle;
  cursor: pointer;
}

.column-info-button:hover,
.column-info-button:focus-visible {
  color: var(--cyan-main);
  outline: none;
}

.column-info-card {
  position: fixed;
  z-index: 1000;
  width: min(340px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  overflow-y: auto;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-card);
  color: var(--text-main);
  text-align: left;
  white-space: normal;
}

.column-info-card h3 {
  margin: 0 1.5rem 0.65rem 0;
  color: var(--cyan-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.column-info-summary {
  margin: 0 0 0.7rem;
  color: var(--text-main);
  font-size: 0.85rem;
  line-height: 1.5;
}

.column-info-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.column-info-card li + li {
  margin-top: 0.45rem;
}

.column-info-card > a {
  display: inline-block;
  margin-top: 0.8rem;
  color: var(--cyan-main);
  font-size: 0.82rem;
}

.column-info-card > a:hover,
.column-info-card > a:focus-visible {
  color: #ffffff;
}

.column-info-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  padding: 0.1rem 0.3rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.column-info-close:hover,
.column-info-close:focus-visible {
  color: var(--cyan-main);
}

.data-table th.th-left,
.data-table td.td-left {
  text-align: left;
}

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

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

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

/* Numeric Formatting */
.data-table td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.ticker-cell {
  font-family: var(--font-sans) !important;
  font-weight: 700;
  color: #ffffff;
}

.ticker-link {
  color: inherit;
  text-decoration: none;
}

.ticker-link:hover,
.ticker-link:focus-visible {
  color: var(--cyan-main);
  text-decoration: underline;
}

.ticker-yahoo-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #6001d2;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.ticker-yahoo-info-button:hover,
.ticker-yahoo-info-button:focus-visible {
  background: #7e2bea;
  outline: 2px solid rgba(126, 43, 234, 0.4);
  outline-offset: 2px;
}

.yahoo-info-dialog {
  width: min(900px, calc(100vw - 2rem));
  max-width: 900px;
  max-height: min(85vh, 900px);
  padding: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: var(--shadow-card);
}

.yahoo-info-dialog::backdrop {
  background: rgba(3, 7, 14, 0.78);
  backdrop-filter: blur(3px);
}

.yahoo-info-header,
.yahoo-info-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.yahoo-info-header {
  justify-content: space-between;
  margin-bottom: 1rem;
}

.yahoo-info-header h2 {
  margin: 0;
  color: var(--text-main);
  font-size: 1.1rem;
}

.yahoo-info-header p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.yahoo-info-toolbar {
  margin-bottom: 0.75rem;
}

.yahoo-info-toolbar input {
  flex: 1;
  min-width: 100px;
}

.yahoo-info-toolbar .text-dim {
  white-space: nowrap;
  font-size: 0.8rem;
}

.yahoo-info-status {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.yahoo-info-status.error {
  color: var(--red-loss);
}

.yahoo-info-table-wrap {
  max-height: calc(85vh - 180px);
  overflow: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.yahoo-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.yahoo-info-table th,
.yahoo-info-table td {
  padding: 0.1rem 0.1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}

.yahoo-info-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  color: var(--text-muted);
}

.yahoo-info-table td:first-child {
  width: 32%;
  color: var(--text-main);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.yahoo-info-table td:last-child {
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .yahoo-info-dialog {
    width: calc(100vw - 1rem);
    max-height: 90vh;
    padding: 0.85rem;
  }

  .yahoo-info-toolbar {
    flex-wrap: wrap;
  }

  .yahoo-info-toolbar input {
    flex-basis: 100%;
  }

  .yahoo-info-table td:first-child {
    width: 40%;
  }
}

.cell-positive {
  color: var(--green-gain);
  font-weight: 600;
}

.cell-negative {
  color: var(--red-loss);
  font-weight: 600;
}

.cell-neutral {
  color: var(--text-dim);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-upside-level {
  border: 1px solid currentColor;
}

.badge-upside-summary {
  border-color: #d1fae5;
  box-shadow: 0 0 0 1px rgba(209, 250, 229, 0.55), 0 0 9px rgba(52, 211, 153, 0.48);
}

.badge-upside-summary::after {
  content: " ↑";
  color: #d1fae5;
  font-weight: 700;
}

.badge-upside-exceptional_upside {
  color: #34d399;
  background: rgba(52, 211, 153, 0.24);
}

.badge-upside-very_high_upside {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.2);
}

.badge-upside-high_upside {
  color: #86efac;
  background: rgba(134, 239, 172, 0.16);
}

.badge-upside-moderate_upside {
  color: #a3e6ba;
  background: rgba(163, 230, 186, 0.13);
}

.badge-upside-flat_to_upside {
  color: #b7d9c6;
  background: rgba(183, 217, 198, 0.1);
}

.badge-upside-flat_to_downside {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.1);
}

.badge-upside-weak_downside {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
}

.badge-upside-moderate_downside {
  color: #fb8b8b;
  background: rgba(248, 113, 113, 0.16);
}

.badge-upside-high_downside {
  color: #fb8b8b;
  background: rgba(248, 113, 113, 0.2);
}

.badge-upside-very_high_downside {
  color: #f87171;
  background: rgba(248, 113, 113, 0.26);
}

.param-card-upside-levels {
  max-width: 100%;
}

.upside-levels-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.upside-levels-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.upside-levels-table th,
.upside-levels-table td {
  padding: 0.3rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}

.upside-levels-table th {
  color: var(--text-dim);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
}

.upside-levels-table th:first-child,
.upside-levels-table td:first-child {
  width: 43%;
}

.upside-levels-table th:last-child,
.upside-levels-table td:last-child {
  width: 57%;
}

.upside-level-range {
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.upside-levels-table .form-input {
  min-width: 0;
  width: 100%;
  padding: 0.3rem 0.45rem;
  font-size: 0.75rem;
}

.upside-summary-setting {
  width: 100%;
  max-width: 28rem;
  grid-template-columns: 1fr;
}

#input-upside-summary-level {
  min-width: 0;
  font-size: 0.82rem;
}

#input-upside-summary-level option {
  white-space: normal;
}

.badge-subtle {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-dim);
}

.empty-state svg {
  margin-bottom: 1rem;
  stroke: var(--cyan-main);
  opacity: 0.6;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.empty-desc {
  font-size: 0.85rem;
  max-width: 480px;
}

/* Collapsible Accordion & Code Terminal */
.card-accordion {
  margin-top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-toggle {
  width: 100%;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.accordion-toggle:hover {
  background: rgba(255, 255, 255, 0.07);
}

.accordion-body {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.report-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.code-terminal {
  background: #05080e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #38bdf8;
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre;
}

.code-terminal.large {
  min-height: 480px;
}

/* Ticker Config Editor Tab */
.editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.editor-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.logs-toolbar-actions {
  align-items: center;
  justify-content: flex-end;
}

.editor-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.tickers-management-box {
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.add-ticker-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-sm {
  width: 140px;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
}

.pill-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 48px;
}

.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--cyan-main);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.ticker-pill .btn-remove-pill {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
  border-radius: 50%;
  transition: color var(--transition-fast);
}

.ticker-pill .btn-remove-pill:hover {
  color: var(--red-loss);
}

.bulk-tickers-wrap {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bulk-tickers-wrap label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Available Files Table */
.available-files-list h4 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.table-container-sm {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.simple-table th,
.simple-table td {
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
}

/* Intrinsic Config Tab */
.model-toggles-section {
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
}

.model-toggles-section h4 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--cyan-main);
}

.toggle-switches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.switch-label input {
  display: none;
}

.switch-custom {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.switch-custom::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform var(--transition-fast);
}

.switch-label input:checked+.switch-custom {
  background: var(--cyan-main);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.switch-label input:checked+.switch-custom::after {
  transform: translateX(18px);
}

.switch-text {
  font-size: 0.85rem;
  color: var(--text-main);
}

/* Parameter Cards */
.parameters-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

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

.param-card {
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.param-card-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.param-badge {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan-main);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.formula-caption {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

.param-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.param-field label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Logs & Reports Tab */
.logs-layout-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
}

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

.logs-sidebar {
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 600px;
  overflow-y: auto;
}

.logs-sidebar-header h4 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: var(--cyan-main);
}

.logs-item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.log-item-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.log-item-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.log-item-btn.active {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--cyan-main);
}

.log-name {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-date {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.logs-viewer-pane {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.logs-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.logs-viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  /* Hidden by default, shown via JS */
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.visible {
  display: flex;
  /* Shown via JS */
}

.modal-dialog {
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.modal-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideToast 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

@keyframes slideToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-success {
  border-left: 4px solid var(--green-gain);
}

.toast.toast-error {
  border-left: 4px solid var(--red-loss);
}

.toast.toast-info {
  border-left: 4px solid var(--cyan-main);
}