:root {
  --bg:      #0A0D12;
  --surface: #111820;
  --card:    #18222C;
  --border:  #2A3A4A;
  --dim:     #1E2A38;
  --t1:      #E4EEF5;
  --t2:      #7A9EB8;
  --t3:      #6A8EA0;
  --amber:   #E8B84B;
  --teal:    #2EDDD8;
  --red:     #E8486A;
}

/*
 * JS-Generated CSS Classes
 * These classes are referenced from JavaScript HTML string generation
 * (app.js, watchlist.js) and will not appear in template markup.
 * Do not remove them based on template-only usage analysis.
 *
 * From app.js:
 *   .coin-name-cell, .num, .roi, .arrow-cell, .reason-cell
 *   .detail-panel, .detail-header, .detail-card, .lane-top
 *   .lane-sections, .lane-section
 *   .coin-explanation, .coin-reason-detail, .lane-explanation
 *   .diagnostic-note, .failure-diagnosis, .replay-section-title
 *   .config-metrics, .metric-row, .metric-label, .metric-value
 *   .tp-guidance, .reason-tooltip, .text-error, .text-dim-color
 *   .text-secondary-color, .lane-status-annotation
 *
 * From watchlist.js:
 *   .star-btn, .star-active, .wl-popover, .wl-pop-header
 *   .wl-pop-item, .wl-pop-action, .wl-bulk-bar, .wl-bulk-pop
 *   .wl-row-selected, .wl-card-checkbox
 */

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

body {
  background-color: var(--bg);
  color: var(--t2);
  font-family: 'Overpass', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.container > .footer { margin-top: auto; }

.app-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 20px clamp(12px, 3vw, 64px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-container > .footer { margin-top: auto; }

/* -- Header -- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-brand {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-decoration: none;
}
.header-brand-text { font-family: 'Cinzel', 'Palatino Linotype', serif; font-size: 1.6rem; font-weight: 400; letter-spacing: 0.07em; color: var(--t1); white-space: nowrap; }
.header-brand-sub { font-family: 'Cinzel', 'Palatino Linotype', serif; font-size: 0.6rem; font-weight: 400; letter-spacing: 0.07em; color: var(--t3); }
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
/* -- User Menu -- */
.user-menu-wrap {
  position: relative;
}
.user-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #3A5060;
  background: var(--card);
  color: var(--t1);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
  padding: 0;
}
.user-avatar-btn:hover { border-color: var(--teal); }
.user-avatar-initial { line-height: 1; }
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--card);
  border: 1px solid #3A5060;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 300;
  padding: 6px 0;
}
.user-menu-email {
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--t2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--t2);
  background: none;
  border: none;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.user-menu-item:hover { background: var(--bg-surface); }
.header .debug-section {
  margin-bottom: 0;
}
.header h1 {
  color: var(--amber);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0;
}
.header p {
  color: var(--t2);
  font-size: 0.9rem;
}

/* -- Shared header utilities (used by admin, debug_viewer, run_summary alongside .header) -- */
.page-title { color: var(--amber); font-size: 1.4rem; font-weight: 600; }
.header-link {
  color: var(--t3); border: 1px solid #3A5060; padding: 6px 14px;
  border-radius: 6px; text-decoration: none; font-size: 0.85rem; white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.header-link:hover { border-color: var(--teal); color: var(--t2); }
.header-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* -- Instrument Bar -- */
.instrument-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.instrument-tab {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--t3);
  padding: 12px 24px;
  border: none;
  border-right: 1px solid var(--border);
  background: none;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}
.instrument-tab:last-child { border-right: none; }
.instrument-tab.active {
  color: var(--teal);
  cursor: default;
}
.instrument-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--teal);
}
.instrument-tab.disabled {
  color: rgba(106, 142, 160, 0.5);
  cursor: default;
}
.instrument-tab:not(.disabled):not(.active):hover {
  color: var(--t2);
}
.instrument-tab:focus-visible {
  box-shadow: 0 0 0 2px rgba(46, 221, 216, 0.2);
  outline: none;
}
.instrument-tooltip {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  white-space: nowrap;
  font-family: 'Overpass', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--t1);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 6px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
}
.instrument-tab:hover .instrument-tooltip,
.instrument-tab:focus-visible .instrument-tooltip {
  transition-delay: 0.2s;
  opacity: 1;
}

/* -- Controls -- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}
.control-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.input-group label {
  font-size: 0.75rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.input-group input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--t1);
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.input-group input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(46,221,216,0.2);
}
.input-group input::placeholder { color: #3A5060; }

/* -- Radio Card Mode Selector -- */
.mode-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 12px;
}
.mode-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.2s; position: relative;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 0 20px rgba(46,221,216,0.03);
}
.mode-card:hover { border-color: #3A5060; box-shadow: 0 0 25px rgba(46,221,216,0.06); transform: translateY(-1px); }
.wl-gear-btn {
  position: absolute; top: 10px; right: 10px; background: transparent; border: none;
  color: var(--t2); font-size: 16px; cursor: pointer; padding: 2px 4px;
  line-height: 1; transition: color 0.15s;
}
.wl-gear-btn:hover { color: var(--amber); }
.mode-card.selected {
  border-color: var(--teal); background: #0A1E20;
  box-shadow: 0 0 30px rgba(46,221,216,0.08);
}
.mode-card .card-top { display: flex; align-items: center; gap: 8px; }
.mode-card .radio-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid #3A5060;
  flex-shrink: 0; transition: border-color 0.15s, background 0.15s; position: relative;
}
.mode-card.selected .radio-dot { border-color: var(--teal); }
.mode-card.selected .radio-dot::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--teal);
}
.mode-card .card-title { font-weight: 500; font-size: 0.88rem; color: var(--t1); }
.mode-card .card-desc { font-size: 0.75rem; color: var(--t2); line-height: 1.4; }
.mode-card .card-input-area { display: none; margin-top: 4px; }
.mode-card.selected .card-input-area { display: block; }

.mode-input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--t1); padding: 7px 10px; font-size: 13px; font-family: inherit;
  outline: none; width: 100%; transition: border-color 0.15s;
}
.mode-input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(46,221,216,0.2); }
.mode-input::placeholder { color: #3A5060; }

.mode-select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--t1); padding: 7px 10px; font-size: 13px; font-family: inherit;
  outline: none; width: 100%; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237A9EB8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.mode-select:focus { border-color: var(--teal); }
.mode-select option { background: var(--card); color: var(--t2); }

.mode-helper-text { font-size: 0.72rem; color: var(--t2); margin-top: 3px; display: block; }

.scan-action { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 20px; }
.budget-indicator {
  font-size: 13px; color: var(--t2); white-space: nowrap;
  font-family: 'Courier Prime', monospace;
}
.budget-indicator.budget-low { color: var(--amber); }
.budget-indicator.budget-zero { color: var(--red); }
.mode-lock-overlay {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(10,13,18,0.85); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--t3); cursor: default;
}
.mode-lock-overlay svg { opacity: 0.6; }
.mode-lock-text { font-size: 12px; }
.mode-card.locked { pointer-events: none; }
.mode-card.locked .card-top, .mode-card.locked .card-desc,
.mode-card.locked .card-input-area { opacity: 0.3; }
.teaser-nav-login { margin-left: 6px; }
.clearance-indicator {
  font-size: 11px; color: var(--t3); white-space: nowrap;
  font-family: 'Courier Prime', monospace; letter-spacing: 0.02em;
}
.clearance-indicator a {
  color: var(--teal); text-decoration: none; margin-left: 4px;
}
.clearance-indicator a:hover { text-decoration: underline; }
.teaser-exhausted-prompt {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 28px 24px; margin-bottom: 20px;
  text-align: center; max-width: 480px; margin-left: auto; margin-right: auto;
}
.teaser-exhausted-heading {
  font-family: 'Cinzel', serif; font-size: 1.1rem; color: var(--t1);
  margin: 0 0 12px; font-weight: 400;
}
.teaser-exhausted-body {
  font-size: 14px; color: var(--t2); line-height: 1.6; margin: 0 0 20px;
}
.teaser-exhausted-actions {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.teaser-exhausted-actions .btn { padding: 10px 28px; font-size: 14px; }
.teaser-exhausted-signin {
  font-size: 13px; color: var(--t3); text-decoration: none;
}
.teaser-exhausted-signin:hover { color: var(--teal); }
.budget-exhausted-banner {
  background: var(--surface); border: 1px solid var(--red);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
  font-size: 13px; color: var(--t2); line-height: 1.5;
}
.budget-exhausted-banner a { color: var(--teal); text-decoration: none; }
.budget-exhausted-banner a:hover { text-decoration: underline; }
.trial-banner {
  background: var(--surface); border: 1px solid var(--amber);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
  font-size: 13px; color: var(--t2); line-height: 1.5;
}
.trial-banner-dismiss {
  float: right; background: none; border: none; color: var(--t3);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px;
}
.trial-banner-dismiss:hover { color: var(--t1); }

.btn {
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  cursor: pointer;
  padding: 10px 24px;
  white-space: nowrap;
  transition: filter 0.15s, opacity 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.btn-teal { background: var(--teal); color: var(--bg); }

/* -- Progress -- */
.progress-section { margin-bottom: 24px; }
.progress-track {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--teal);
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s;
}
.progress-fill.error { background: var(--red); }
.progress-text {
  font-size: 0.8rem;
  color: var(--t3);
}

/* -- Summary Cards -- */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.2s, box-shadow 0.15s;
  user-select: none;
  box-shadow: 0 0 20px rgba(46,221,216,0.03);
}
.summary-card:hover { border-color: #3A5060; transform: translateY(-1px); box-shadow: 0 0 25px rgba(46,221,216,0.06); }
.summary-card.active { border-color: var(--teal); box-shadow: 0 0 30px rgba(46,221,216,0.08); }
.summary-card .card-count {
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--t1);
  font-variant-numeric: tabular-nums;
}
.summary-card .card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t3);
  margin-top: 2px;
}
.summary-card[data-filter="eligible"] .card-count { color: var(--teal); }
.summary-card[data-filter="disqualified"] .card-count { color: var(--red); }
.summary-card[data-filter="non-deployable"] .card-count { color: var(--amber); }
.summary-card[data-filter="unresolved"] .card-count { color: var(--t3); }
.summary-card[data-filter="replay-failure"] .card-count { color: var(--red); }

/* -- Debug Toggle -- */
.debug-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.toggle-label input { opacity: 0; position: absolute; width: 0; height: 0; }
.toggle-label input:focus-visible + .toggle-slider { box-shadow: 0 0 0 2px rgba(46, 221, 216, 0.2); outline: none; }
.toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  background: #3A5060;
  border-radius: 11px;
  transition: background 0.15s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--t3);
  border-radius: 50%;
  transition: transform 0.2s, background 0.15s;
}
.toggle-label input:checked + .toggle-slider { background: var(--teal); }
.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(18px);
  background: #fff;
}
.btn-sm { padding: 6px 16px; font-size: 13px; }

/* -- Table -- */
.results-section { margin-bottom: 24px; }
.roi-disclaimer {
  font-size: 0.8rem;
  color: var(--t2);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 12px;
}

/* -- AI Narrative -- */
.narrative-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.narrative-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.narrative-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--t1);
  margin: 0;
}
.narrative-chevron {
  font-size: 0.75rem;
  color: var(--t2);
  transition: transform 0.2s;
}
.narrative-container.collapsed .narrative-chevron {
  transform: rotate(-90deg);
}
.narrative-content {
  margin-top: 8px;
}
.narrative-container.collapsed .narrative-content {
  display: none;
}
.narrative-disclaimer {
  font-size: 0.8rem;
  color: var(--t2);
  line-height: 1.5;
  margin: 16px 0 0 0;
}
.narrative-body {
  color: var(--t1);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 0;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.table-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--t1);
}
.table-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* -- Manage Watchlists Button -- */
.btn-manage-wl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232,184,75,0.15);
  border: 1px solid var(--amber);
  color: var(--amber);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, background 0.15s;
}
.btn-manage-wl:hover { filter: brightness(1.1); }
.btn-manage-wl.active {
  background: rgba(232,184,75,0.25);
  border-color: var(--amber);
}

/* -- Bulk Action Bar -- */
.wl-bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
}
.wl-bulk-badge {
  font-size: 0.8rem;
  color: var(--amber);
  background: rgba(232,184,75,0.15);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.wl-bulk-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--amber);
  color: var(--bg);
  border: none;
  font-weight: 400;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: filter 0.15s;
}
.wl-bulk-add-btn:hover { filter: brightness(1.1); }
.wl-bulk-remove-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid #3A5060;
  color: var(--t2);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.wl-bulk-remove-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.wl-bulk-done {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--t2);
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.15s;
}
.wl-bulk-done:hover { color: var(--t1); }

/* -- Checkbox Column (Manage Mode) -- */
.wl-checkbox-cell {
  width: 36px;
  text-align: center;
  padding: 10px 6px;
}
.wl-row-selected {
  background: #0E1C28;
}

/* -- Bulk Popover -- */
.wl-bulk-pop {
  position: fixed;
  z-index: 200;
  background: var(--card);
  border: 1px solid #3A5060;
  border-radius: 8px;
  min-width: 260px;
  max-width: calc(100vw - 20px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: popIn 0.15s ease;
  overflow: hidden;
}
.wl-bulk-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--t2);
}
.wl-bulk-pop-item:hover { background: rgba(46,221,216,0.06); }
.wl-bulk-pop-item.dimmed { opacity: 0.45; pointer-events: none; }
.wl-bulk-pop-item.grayed { opacity: 0.35; pointer-events: none; }
.wl-bulk-pop-item.remove-hover:hover { background: rgba(248,81,73,0.06); }
.wl-bulk-badge-partial { color: var(--amber); font-size: 0.75rem; font-weight: 600; }
.wl-bulk-badge-all { color: var(--teal); font-size: 0.75rem; font-weight: 600; }
.wl-bulk-badge-none { color: var(--t3); font-size: 0.75rem; font-weight: 600; }
.wl-bulk-badge-remove-all { color: var(--red); font-size: 0.75rem; font-weight: 600; }
.wl-bulk-pop-empty { padding: 12px 14px; color: var(--t2); font-size: 0.85rem; }

/* -- Watchlist Management Modal -- */
.wl-modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.wl-modal {
  background: var(--card); border: 1px solid #3A5060;
  border-radius: 8px; max-width: 480px; width: 90%;
  max-height: 70vh; display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 30px rgba(46,221,216,0.06);
  animation: popIn 0.15s ease;
}
.wl-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.wl-modal-header .wl-pop-title { font-size: 0.95rem; font-weight: 600; color: var(--t1); }
.wl-modal-body { overflow-y: auto; padding: 8px 0; flex: 1; }
.wl-modal-empty { padding: 24px 16px; text-align: center; color: var(--t2); font-size: 0.85rem; }
.wl-modal-item { border-bottom: 1px solid var(--border); }
.wl-modal-item:last-child { border-bottom: none; }
.wl-modal-item-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; cursor: pointer; transition: background 0.15s;
}
.wl-modal-item-header:hover { background: rgba(46,221,216,0.04); }
.wl-modal-chevron { color: var(--t2); width: 16px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.wl-modal-name {
  flex: 1; color: var(--t2); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; padding: 2px 4px; border-radius: 3px;
  transition: background 0.15s;
}
.wl-modal-name:hover { background: rgba(122,158,184,0.1); }
.wl-modal-name-input {
  background: var(--surface); border: 1px solid var(--teal);
  color: var(--t1); border-radius: 4px; padding: 2px 6px;
  font-size: 0.85rem; font-weight: 500; width: 100%; outline: none;
}
.wl-modal-badge {
  font-size: 0.75rem; color: var(--t2); font-weight: 600;
  padding: 1px 7px; background: rgba(122,158,184,0.1); border-radius: 10px;
  flex-shrink: 0;
}
.wl-modal-delete-btn {
  background: none; border: none; color: var(--t2); cursor: pointer;
  padding: 2px 6px; border-radius: 4px;
  transition: color 0.15s, background 0.15s; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.wl-modal-delete-btn:hover { color: var(--red); background: rgba(232,72,106,0.1); }
.wl-modal-delete-btn.confirming {
  color: var(--red); background: rgba(232,72,106,0.1);
  font-size: 0.75rem; font-weight: 600; padding: 2px 8px;
}
.wl-modal-expanded { padding-bottom: 4px; }
.wl-modal-coins {
  padding: 4px 16px 8px 40px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.wl-coin-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(122,158,184,0.1); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px 8px 3px 10px;
  font-size: 0.78rem; color: var(--t2); font-weight: 500;
}
.wl-coin-chip button {
  background: none; border: none; color: var(--t2); cursor: pointer;
  padding: 0 2px; line-height: 1;
  transition: color 0.15s;
  display: inline-flex; align-items: center;
}
.wl-coin-chip button:hover { color: var(--red); }
.wl-modal-add-row {
  display: flex; gap: 6px; padding: 6px 16px 10px 40px; align-items: center;
}
.wl-modal-add-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  color: var(--t2); border-radius: 6px; padding: 4px 8px;
  font-size: 0.78rem; outline: none; transition: border-color 0.15s;
}
.wl-modal-add-input:focus { border-color: var(--teal); }
.wl-modal-add-input::placeholder { color: var(--t3); }
.wl-modal-add-btn {
  background: var(--amber); color: var(--bg); border: none; border-radius: 6px;
  font-size: 0.75rem; font-weight: 400; padding: 5px 10px; cursor: pointer;
  transition: filter 0.15s; flex-shrink: 0;
}
.wl-modal-add-btn:hover { filter: brightness(1.1); }
.wl-modal-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: center;
}
.wl-modal-create-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--t2); font-size: 0.82rem; padding: 7px 14px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.wl-modal-create-btn:hover { border-color: var(--amber); background: rgba(232,184,75,0.15); }
.wl-modal-create-btn .wl-create-icon { color: var(--amber); display: inline-flex; align-items: center; }
.wl-modal-create-input {
  background: var(--surface); border: 1px solid var(--teal);
  color: var(--t1); border-radius: 6px; padding: 5px 10px;
  font-size: 0.82rem; outline: none; flex: 1;
}

/* -- Settings Modal -- */
.settings-modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.settings-modal {
  background: var(--card); border: 1px solid #3A5060;
  border-radius: 8px; max-width: 480px; width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 30px rgba(46,221,216,0.06);
  animation: popIn 0.15s ease;
}
.settings-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.settings-modal-title { font-size: 0.95rem; font-weight: 600; color: var(--t1); }
.settings-modal-body { padding: 16px; }
.settings-modal-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}
.settings-field-group {
  display: flex; flex-direction: column; gap: 6px;
}
.settings-field-label {
  font-size: 0.75rem; color: var(--t3);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.settings-field-input {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--t1); padding: 8px 12px;
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.15s; width: 100px;
}
.settings-field-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(46,221,216,0.2);
}

/* -- Modal focus-visible states -- */
.settings-modal .wl-pop-close:focus-visible,
.wl-modal .wl-pop-close:focus-visible,
.wl-modal-delete-btn:focus-visible,
.wl-modal-add-btn:focus-visible,
.wl-modal-create-btn:focus-visible,
.wl-modal-item-header:focus-visible,
.wl-coin-chip button:focus-visible {
  box-shadow: 0 0 0 2px rgba(46, 221, 216, 0.2);
  outline: none;
}
.settings-field-input:focus-visible,
.wl-modal-name-input:focus-visible,
.wl-modal-add-input:focus-visible,
.wl-modal-create-input:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(46, 221, 216, 0.2);
  outline: none;
}

/* -- Global focus-visible states -- */
.btn:focus-visible,
.btn-manage-wl:focus-visible,
.summary-card:focus-visible,
.mode-card:focus-visible,
.results-table tbody tr:focus-visible,
.results-table thead th.sortable:focus-visible,
.detail-header:focus-visible,
.star-btn:focus-visible,
.wl-pop-close:focus-visible,
.wl-pop-item:focus-visible,
.wl-pop-new:focus-visible,
.wl-bulk-pop-item:focus-visible,
.wl-bulk-add-btn:focus-visible,
.wl-bulk-remove-btn:focus-visible,
.wl-bulk-done:focus-visible,
.coin-card:focus-visible,
.mobile-sort-dir-btn:focus-visible,
.wl-gear-btn:focus-visible,
.wl-pop-create button:focus-visible,
.user-avatar-btn:focus-visible,
.user-menu-item:focus-visible {
  box-shadow: 0 0 0 2px rgba(46, 221, 216, 0.2);
  outline: none;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
.results-table thead th {
  background: var(--surface);
  color: var(--t3);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.results-table thead th.sortable { cursor: pointer; }
.results-table thead th.sortable:hover { color: var(--teal); }
.results-table thead th .sort-arrow { margin-left: 4px; font-size: 0.6rem; opacity: 0.4; display: inline-flex; vertical-align: middle; }
.results-table thead th.sorted .sort-arrow { opacity: 1; color: var(--teal); }
.results-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.results-table tbody tr:hover { background: var(--card); }
.results-table tbody tr.selected { background: #0E1C28; }
.results-table tbody td {
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.results-table tbody td.coin-name-cell { font-weight: 500; color: var(--t1); }
.results-table tbody td.num { font-weight: 600; color: var(--teal); }
.results-table tbody td.roi { color: var(--t1); }
.results-table thead th[data-key="arrow"],
.results-table tbody td.arrow-cell { color: #3A5060; font-size: 0.7rem; text-align: center; width: 1%; white-space: nowrap; padding-left: 4px; padding-right: 4px; }

/* -- Detail Panel -- */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 4px;
  animation: slideDown 0.2s ease;
  white-space: normal;
  box-shadow: 0 0 30px rgba(46,221,216,0.04);
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.detail-header h3 { font-size: 1rem; color: var(--t1); font-weight: 600; }


.coin-explanation {
  color: var(--t2);
  font-size: 0.85rem;
  font-style: italic;
  margin-bottom: 8px;
}
.coin-reason-detail {
  color: var(--t2);
  font-size: 0.8rem;
  font-style: italic;
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.detail-card {
  background: #0E141A;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}
.detail-card h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
  margin-bottom: 12px;
  font-weight: 600;
}
.lane-top {}
.lane-sections {
  columns: 300px;
  column-gap: 16px;
  max-width: 960px;
  margin: 0;
}
.lane-section {
  break-inside: avoid;
}
.lane-explanation {
  color: var(--t2);
  font-size: 0.8rem;
  font-style: italic;
  margin-bottom: 10px;
  overflow-wrap: break-word;
}
.diagnostic-note {
  color: var(--amber);
  font-style: italic;
}
.failure-diagnosis {
  color: var(--t2);
  font-size: 0.8rem;
  font-style: italic;
  margin-bottom: 10px;
  overflow-wrap: break-word;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(42,58,74,0.5);
  font-size: 0.85rem;
}
.metric-row:last-child { border-bottom: none; }
.metric-label { color: var(--t2); }
.metric-value { color: var(--t2); font-weight: 600; font-variant-numeric: tabular-nums; }
.config-metrics .metric-value { color: var(--t1); }

.replay-window-card {
  background: #0E141A;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 12px;
}
.replay-window-card:first-of-type { margin-top: 0; }
.replay-section-title {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--t1);
  margin-top: 14px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.replay-section-title:first-of-type { margin-top: 0; }

/* -- Take Profit Guidance -- */
.tp-guidance {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.tp-text {
  color: var(--t2);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* -- Footer -- */
.footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}
.footer p { color: #3A5060; font-size: 0.8rem; }
.footer a { color: #3A5060; text-decoration: none; }
.footer a:hover { color: var(--teal); }

/* -- Fee Disclosure -- */
.fee-disclosure-row {
  margin-bottom: 10px;
}
.fee-disclosure {
  font-size: 0.85rem;
  color: var(--t2);
}
.fee-edit-link {
  color: var(--amber);
  text-decoration: none;
  margin-left: 4px;
  cursor: pointer;
}
.fee-edit-link:hover { text-decoration: underline; }

/* -- Star Toggle -- */
.results-table .star-cell { width: 36px; text-align: center; padding: 10px 6px; position: relative; }
.star-btn {
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: #3A5060; padding: 2px 4px; border-radius: 4px; line-height: 1;
  transition: color 0.15s, transform 0.2s, text-shadow 0.15s;
}
.star-btn:hover { color: var(--amber); transform: scale(1.15); }
.star-btn.active { color: var(--amber); text-shadow: 0 0 8px rgba(232,184,75,0.4); }
.star-btn.active:hover { color: #c9a035; }
@keyframes starPop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.star-btn.pop { animation: starPop 0.3s ease; }
.star-btn-locked {
  display: inline-flex; align-items: center; justify-content: center;
  color: #3A5060; padding: 2px 4px; line-height: 1; opacity: 0.5;
  cursor: default;
}
.wl-upgrade-prompt {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--t3); font-size: 13px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  cursor: default; white-space: nowrap;
}

/* -- Watchlist Popover -- */
.wl-popover {
  position: fixed; z-index: 200;
  background: var(--card); border: 1px solid #3A5060;
  border-radius: 8px; min-width: 230px; max-width: calc(100vw - 20px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: popIn 0.15s ease;
  overflow: hidden;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.wl-pop-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 6px 14px;
}
.wl-pop-title {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--t3); font-weight: 600;
}
.wl-pop-close {
  background: none; border: none; color: var(--t2);
  cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1;
  transition: color 0.15s, background 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.wl-pop-close:hover { color: var(--red); background: rgba(232,72,106,0.1); }

.wl-pop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; transition: background 0.15s;
  font-size: 13px; color: var(--t2);
}
.wl-pop-item:hover { background: rgba(46,221,216,0.06); }
.wl-pop-item .wl-pop-icon { color: var(--amber); font-size: 14px; flex-shrink: 0; width: 16px; text-align: center; }
.wl-pop-item .wl-pop-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-pop-item .wl-pop-action {
  font-size: 16px; line-height: 1; padding: 0 2px; flex-shrink: 0;
  transition: color 0.15s; display: inline-block;
}
.wl-pop-item:not(.on-list) .wl-pop-action { color: var(--t2); }
.wl-pop-item:not(.on-list):hover .wl-pop-action { color: var(--amber); }
.wl-pop-item.on-list .wl-pop-action { color: var(--teal); }
.wl-pop-item.on-list:hover .wl-pop-action { color: var(--teal); }

@keyframes flashAdd {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); color: var(--teal); }
  100% { transform: scale(1); }
}
@keyframes flashRemove {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); color: var(--red); }
  100% { transform: scale(1); }
}
.wl-pop-action.flash-add { animation: flashAdd 0.35s ease; }
.wl-pop-action.flash-remove { animation: flashRemove 0.35s ease; color: var(--red); }

.wl-pop-item.just-removed.on-list .wl-pop-action,
.wl-pop-item.just-removed.on-list:hover .wl-pop-action,
.wl-pop-item.just-removed .wl-pop-action { color: var(--red); }
.wl-pop-item.just-removed .wl-pop-name { opacity: 0.55; }
.wl-pop-item.just-removed .wl-pop-icon { opacity: 0.55; }

.wl-pop-divider { height: 1px; background: var(--border); margin: 2px 0; }

.wl-pop-new {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; transition: background 0.15s;
  font-size: 13px; color: var(--t2); font-weight: 500;
}
.wl-pop-new:hover { background: rgba(46,221,216,0.06); color: var(--t1); }
.wl-pop-new .wl-pop-icon { font-size: 14px; width: 16px; text-align: center; }

.wl-pop-create {
  padding: 8px 12px; display: flex; gap: 6px; align-items: center;
  animation: popIn 0.15s ease;
}
.wl-pop-create input {
  flex: 1; background: var(--bg); border: 1px solid var(--teal);
  border-radius: 5px; color: var(--t1); padding: 5px 8px;
  font-size: 13px; font-family: inherit; outline: none;
  box-shadow: 0 0 0 2px rgba(46,221,216,0.12);
}
.wl-pop-create input::placeholder { color: #3A5060; }
.wl-pop-create button {
  background: var(--amber); border: none; border-radius: 5px;
  color: var(--bg); font-size: 12px; font-weight: 400; padding: 5px 10px;
  cursor: pointer; white-space: nowrap; transition: filter 0.15s;
}
.wl-pop-create button:hover { filter: brightness(1.1); }

/* -- Toast -- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid #3A5060;
  border-radius: 8px; padding: 10px 20px; font-size: 0.85rem;
  color: var(--t2); box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 2000; pointer-events: none;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  animation: toastIn 0.25s ease, toastOut 0.3s ease 1.7s forwards;
}
.toast .toast-icon { color: var(--amber); flex-shrink: 0; line-height: 0; }
.toast.toast-error .toast-icon { color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* Utility classes for JS-generated HTML */
.text-error { color: var(--red); }
.text-dim-color { color: var(--t3); }
.text-secondary-color { color: var(--t2); }
.lane-status-annotation { color: var(--t2); font-weight: 400; font-size: 0.85em; }

/* -- Utility -- */
.hidden { display: none !important; }

/* -- Mobile Card View -- */
#mobileCardList { display: flex; flex-direction: column; gap: 8px; }
.coin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.coin-card:hover { border-color: #3A5060; transform: translateY(-1px); }
.coin-card.expanded { border-color: var(--teal); }
.coin-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.coin-card-name {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--t1);
  flex: 1;
}
.coin-card-expand {
  color: var(--t2);
  font-size: 0.7rem;
  transition: transform 0.15s;
}
.coin-card.expanded .coin-card-expand { transform: rotate(90deg); }
.coin-card-metrics {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 4px 8px;
  margin-top: 8px;
  padding-left: 54px;
}
.coin-card-lane-label {
  font-size: 0.72rem;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.coin-card-lane-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--t1);
}
.coin-card-reason {
  margin-top: 6px;
  padding-left: 54px;
  font-size: 0.85rem;
  color: var(--t2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coin-card.expanded .coin-card-reason { white-space: normal; }
.coin-card-detail {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* -- Mobile Sort Bar -- */
.mobile-sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.mobile-sort-bar select {
  flex: 1;
  background: var(--surface);
  color: var(--t2);
  border: 1px solid #3A5060;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.85rem;
  min-height: 44px;
  cursor: pointer;
}
.mobile-sort-dir-btn {
  background: var(--surface);
  color: var(--t2);
  border: 1px solid #3A5060;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.85rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.mobile-sort-dir-btn:hover { border-color: var(--teal); }

/* -- Responsive: Header stacks below 600px -- */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .header-left { justify-content: center; }
  .header-brand-text { font-size: 1.7rem; }
  .header-right {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .instrument-tab { padding: 10px 16px; }
}

@media (max-width: 700px) {
  .mode-row { grid-template-columns: 1fr; }
  .control-row { flex-direction: column; align-items: stretch; }
  .scan-action .btn { width: 100%; }
  .summary-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}

@media (max-width: 768px) {
  /* Touch targets: >=44x44px tap area on all interactive elements */
  .star-btn { min-height: 44px; min-width: 44px; padding: 12px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; padding: 10px 16px; }
  .btn-manage-wl { min-height: 44px; padding: 10px 12px; }
  .wl-bulk-add-btn,
  .wl-bulk-remove-btn { min-height: 44px; padding: 10px 12px; }
  .wl-bulk-done { min-height: 44px; padding: 10px 8px; }
  .wl-pop-item { min-height: 44px; padding: 12px 14px; }
  .wl-modal-delete-btn { min-height: 44px; min-width: 44px; padding: 10px; }
  .wl-modal-item-header { min-height: 44px; padding: 12px 16px; }

  /* Typography floor: no text below 0.8rem (decorative sort-arrow exempt) */
  .mode-card .card-desc { font-size: 0.8rem; }
  .mode-helper-text { font-size: 0.8rem; }
  .summary-card .card-label { font-size: 0.8rem; }
  .results-table thead th { font-size: 0.8rem; }
  .wl-pop-title { font-size: 0.8rem; }
  .wl-coin-chip { font-size: 0.8rem; }
  .wl-bulk-badge-partial,
  .wl-bulk-badge-all,
  .wl-bulk-badge-none,
  .wl-bulk-badge-remove-all { font-size: 0.8rem; }
  .wl-modal-badge { font-size: 0.8rem; }
  .coin-card-lane-label { font-size: 0.8rem; }
}

@media (max-width: 480px) {
  .summary-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* -- Reason tooltips (results table) -- */
.reason-tooltip {
  position: fixed; z-index: 200;
  display: none;
  background: var(--card); border: 1px solid #3A5060;
  border-radius: 6px; padding: 10px 14px;
  max-width: 320px;
  font-size: 0.85rem; line-height: 1.5; color: var(--t2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  pointer-events: none;
  animation: popIn 0.15s ease;
}
.reason-tooltip.visible { display: block; }

/* -- Backtest Timeframes — Toggle Pills (Spec 5.1 §scan-controls Row 2.5 -- */
/* Consumes the Toggle Pills component pattern from design-system.md. */

/* Fieldset wrapper — strip browser defaults; lay out as vertical stack.
   No flex gap: <legend> doesn't participate consistently in flex layout
   across browsers (it's traditionally rendered as fieldset chrome), so
   we use explicit margin-bottom on the legend and margin-top on the
   description to control the spacing instead. */
.timeframes-row {
  border: none;
  margin: 8px 0 4px 0;
  padding: 0;
  min-width: 0;          /* Firefox: prevent fieldset min-width: min-content */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Section caption — uses the body Overpass font (matches the mode-card
   titles "Coins", "Volume Ranked", "Watchlist", which also inherit
   Overpass). Kept uppercase + letter-spaced for the section-caption
   treatment. */
.timeframes-legend {
  /* <legend> default has margin-inline-start; reset for left-flush alignment. */
  padding: 0;
  /* 22px = same effective spacing the .fee-disclosure-row gets below it
     (.controls flex gap 12px + .fee-disclosure-row margin-bottom 10px). */
  margin-bottom: 22px;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--t3);
}

/* Pill group — horizontal flex row that wraps at narrow viewports. */
.timeframes-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Individual pill — outline-only, full-radius. Selected state via :has().
   The hidden checkbox carries the form value; the <label> is the visible
   pill. Click on the label bubbles to the checkbox and fires its change
   event, which Step 4's group-invariant guard will hook. */
.timeframes-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;       /* tap-target floor per Toggle Pills spec */
  padding: 8px 16px;
  border: 1px solid var(--border);
  /* Match .mode-card radius (line 288) for visual consistency. */
  border-radius: 10px;
  color: var(--t2);
  font-family: 'Overpass', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  background: transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
/* Visually hide the input but keep it accessible to assistive tech and
   to label-click bubbling. */
.timeframes-pill input[type="checkbox"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Selected state — teal accent. The font-weight 500 vs 400 bump is the
   WCAG-AA non-color cue (the design-system spec permits border weight
   OR text weight; we use text weight to keep the border at 1px and
   avoid the heavier visual + layout-shift compensation that 2px would
   require). */
.timeframes-pill:has(input:checked) {
  border-color: var(--teal);
  color: var(--teal);
  font-weight: 500;
}
.timeframes-pill:hover {
  border-color: #3A5060;
}
.timeframes-pill:has(input:checked):hover {
  border-color: #52F0EB;   /* one shade brighter than --teal */
}
.timeframes-pill:has(input:focus-visible) {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.timeframes-pill:has(input:disabled) {
  border-color: var(--t3);
  color: var(--t3);
  opacity: 0.5;
  cursor: not-allowed;
}

/* Helper description — matches .roi-disclaimer style (inherits Overpass
   font from body, font-weight 400 inherited). Only the margin differs:
   margin-top here parallels the legend's margin-bottom (spacing parity
   around the pill row). */
.timeframes-description {
  margin: 22px 0 0 0;    /* matches .timeframes-legend bottom spacing */
  font-size: 0.8rem;
  font-style: italic;
  color: var(--t2);
  line-height: 1.5;
}

/* -- Canonical ranking lane header marker (results-table.md RT-5) -- */
/* Uses weight rather than color alone for WCAG-AA non-color-cue compliance. */
.canonical-lane-th {
  font-weight: 600;
}

/* -- Active-set indicator above results table (results-table.md RT-4) -- */
.active-set-indicator {
  font-size: 0.8rem;
  color: var(--t3);
  margin: 4px 0 8px 0;
}

/* -- Eligible-coin canonical ROI metric in detail header (coin-detail.md State Rendering) -- */
.detail-header-metric {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--teal);
  margin-left: 10px;
}

/* -- Reduced motion -- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
