:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --rose-bg: #fff1f2;
  --rose-text: #881337;
  --amber-bg: #fffbeb;
  --amber-text: #92400e;
  --lime-bg: #f7fee7;
  --lime-text: #3f6212;
  --emerald-strong: #d1fae5;
  --emerald-text: #064e3b;
  --positive: #15803d;
  --negative: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #b91c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.auth-loading .app {
  visibility: hidden;
}

body.auth-required .auth-gate {
  display: flex;
}

.auth-gate {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(8px);
  z-index: 2000;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.16);
  padding: 26px;
}

.auth-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin: 8px 0 10px;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.auth-field input {
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #ffffff;
  outline: none;
}

.auth-field input:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.18);
}

.auth-error {
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
}

.total-badge,
.muted-chip {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: visible;
}

.card-header {
  padding: 16px 18px 8px;
}

.market-header,
.market-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.market-actions {
  color: var(--muted);
  font-size: 14px;
}

.inline-refresh-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.inline-refresh-link:hover {
  color: var(--text);
}

.market-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  padding: 0 18px 16px;
}

.market-sentiment-card,
.market-future-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
}

.market-sentiment-card[data-tone="fear"] {
  background: #fff7f7;
}

.market-sentiment-card[data-tone="greed"] {
  background: #f5fff7;
}

.market-sentiment-card-cnn {
  min-width: 0;
}

#marketFuturesGrid {
  grid-column: 1 / -1;
}

.market-card-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.market-sentiment-title {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 800;
}

.market-sentiment-subtitle,
.market-sentiment-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.market-sentiment-bar {
  position: relative;
  margin-top: 14px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fecaca 0%, #fde68a 50%, #bbf7d0 100%);
}

.market-sentiment-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(185, 28, 28, 0.22) 0%, rgba(245, 158, 11, 0.16) 50%, rgba(21, 128, 61, 0.18) 100%);
}

.market-sentiment-marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #0f172a;
  border: 2px solid #ffffff;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
}

.market-futures-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.market-overview-grid {
  margin-top: 12px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(11, minmax(0, 1fr));
}

.market-overview-grid .market-future-card {
  display: grid;
  grid-template-rows: minmax(34px, auto) auto auto 1fr auto;
  padding: 12px 10px;
}

.market-overview-grid .market-card-label {
  display: flex;
  align-items: flex-start;
  line-height: 1.2;
}

.market-overview-grid .market-future-symbol {
  margin-top: 10px;
  font-size: 16px;
}

.market-overview-grid .market-future-price {
  margin-top: 5px;
  font-size: 18px;
}

.market-overview-grid .market-future-change {
  margin-top: auto;
  padding-top: 10px;
  font-size: 13px;
  align-self: end;
}

.market-future-symbol {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 800;
}

.market-future-price {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.market-future-change {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
}

.market-future-change.is-positive {
  color: var(--positive);
}

.market-future-change.is-negative {
  color: var(--negative);
}

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

  .market-futures-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .market-overview-grid {
    grid-column: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

#nextExpirationLabel {
  display: inline-flex;
  align-items: center;
}

.header-meta-text {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.card-header h2 {
  margin: 0;
  font-size: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.cap-bucket-dropdown {
  position: relative;
  min-width: 220px;
}

.cap-bucket-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
  font-weight: 400;
  background: #ffffff;
  cursor: pointer;
  list-style: none;
}

.cap-bucket-summary-text {
  font-weight: 400;
}

.single-filter-summary-text {
  font-weight: 400;
}

.cap-bucket-dropdown summary::-webkit-details-marker {
  display: none;
}

.cap-bucket-dropdown summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 12px;
}

.cap-bucket-dropdown[open] summary::after {
  content: "▴";
}

.cap-bucket-dropdown .cap-bucket-group {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  min-width: 220px;
  box-shadow: var(--shadow);
}

.cap-bucket-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.cap-bucket-option input {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#pricesTable {
  min-width: 1020px;
}

#tickersTable {
  width: max-content;
  min-width: 0;
  table-layout: fixed;
}

#scoutTable {
  width: max-content;
  min-width: 0;
  table-layout: fixed;
}

#customScoutTable {
  width: max-content;
  min-width: 0;
  table-layout: fixed;
}

#tickersTable th,
#tickersTable td {
  white-space: nowrap;
  padding: 8px 4px;
}

#tickersTable td:first-child {
  white-space: normal;
}

#scoutTable th,
#scoutTable td {
  white-space: nowrap;
  padding: 8px 4px;
}

#scoutTable td:first-child {
  white-space: normal;
}

#customScoutTable th,
#customScoutTable td {
  white-space: nowrap;
  padding: 8px 4px;
}

#customScoutTable td:first-child {
  white-space: normal;
}

#tickersTable th:nth-child(even):not(:last-child),
#tickersTable td:nth-child(even):not(:last-child),
#scoutTable th:nth-child(even):not(:last-child),
#scoutTable td:nth-child(even):not(:last-child),
#customScoutTable th:nth-child(even):not(:last-child),
#customScoutTable td:nth-child(even):not(:last-child) {
  background: rgba(148, 163, 184, 0.08);
}

#tickersTable th:nth-child(even):not(:last-child),
#scoutTable th:nth-child(even):not(:last-child),
#customScoutTable th:nth-child(even):not(:last-child) {
  background: rgba(148, 163, 184, 0.13);
}

.scout-sort-btn {
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.scout-sort-btn:hover {
  color: var(--muted);
}

th,
td {
  border-bottom: 1px solid #edf2f7;
  padding: 10px 8px;
  font-size: 14px;
  vertical-align: middle;
}

thead th {
  background: #f1f5f9;
  position: relative;
  z-index: 1;
  text-align: left;
}

.header-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.header-with-resize {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  width: 100%;
}

.action-header-resize {
  min-height: 16px;
}

.action-header-spacer {
  display: inline-block;
  width: 1px;
  min-width: 1px;
  height: 1px;
}

.header-help {
  position: relative;
  display: inline-flex;
}

.header-help summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.header-help summary::-webkit-details-marker {
  display: none;
}

.header-help[open] .header-tooltip,
.header-help:hover .header-tooltip,
.header-help:focus-within .header-tooltip {
  display: block;
}

.header-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 240px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  white-space: normal;
  z-index: 30;
}

.floating-header-tooltip {
  display: none;
  position: fixed;
  width: 240px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  white-space: normal;
  pointer-events: none;
  z-index: 1000;
}

@media (hover: hover) and (pointer: fine) {
  .header-help summary {
    display: none;
  }

  .header-help {
    position: static;
    width: 0;
  }

  .header-help .header-tooltip {
    display: none !important;
  }

  .scout-link-row {
    display: none !important;
  }
}

.ticker-col {
  min-width: 180px;
}

.total-col {
  min-width: 90px;
  text-align: center;
  background: #f8fafc;
}

td.ticker-cell,
td.total-cell {
  font-weight: 700;
}

td.total-cell {
  text-align: center;
  background: #f8fafc;
}

.col-135,
.cell-135,
.col-tone-0,
.cell-tone-0 {
  background: var(--rose-bg);
  color: var(--rose-text);
}

.col-140,
.cell-140,
.col-tone-1,
.cell-tone-1 {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.col-145,
.cell-145,
.col-tone-2,
.cell-tone-2 {
  background: var(--lime-bg);
  color: var(--lime-text);
}

.col-150,
.cell-150,
.col-tone-3,
.cell-tone-3 {
  background: var(--emerald-strong);
  color: var(--emerald-text);
}

.col-135,
.col-140,
.col-145,
.col-150,
.col-tone-0,
.col-tone-1,
.col-tone-2,
.col-tone-3 {
  color: var(--text);
  text-align: center;
}

.dynamic-tone {
  background: var(--tone-bg);
  color: var(--tone-text);
  text-align: center;
  vertical-align: top;
}

#pricesTable td.dynamic-tone > * {
  margin-left: auto;
  margin-right: auto;
}

.dynamic-tone strong {
  color: inherit;
}

#pricesTable thead .dynamic-tone {
  font-weight: 800;
}

.target-price {
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.option-cell-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.option-quote-block {
  margin-bottom: 16px;
}

.option-trade-block {
  width: 100%;
}

.strike-line {
  margin-bottom: 8px;
  font-size: 12px;
  text-align: center;
}

.trade-inputs,
.bought-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.trade-inputs input,
.strike-input {
  height: 28px;
  font-size: 12px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  outline: none;
}

.contract-input {
  width: 40px;
}

.premium-wrap,
.bought-strike-wrap {
  position: relative;
}

.premium-wrap span,
.bought-strike-wrap span {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.premium-input {
  width: 50px;
  padding-left: 16px;
}

.strike-input {
  width: 64px;
  padding-left: 16px;
}

.trade-inputs input.is-empty,
.strike-input.is-empty {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.xmark {
  color: var(--muted);
  font-size: 12px;
  min-width: 10px;
  text-align: center;
}

.hidden {
  color: transparent;
}

.table-footer,
.tickers-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 18px 16px;
  color: var(--muted);
  font-size: 14px;
}

.checkbox-row,
.tickers-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#tickersTable input {
  width: 100%;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 8px;
  font-size: 14px;
  outline: none;
}

#tickersTable input.earnings-risk-input {
  color: var(--negative);
  border-color: #fca5a5;
  background: #fff5f5;
  font-weight: 700;
}

.btn {
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.btn.secondary {
  background: white;
  color: var(--text);
}

.delete-btn {
  border: none;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 16px;
  padding: 6px 8px;
  border-radius: 999px;
}

.delete-btn:hover {
  color: var(--text);
  background: #f1f5f9;
}

.delete-btn.confirming {
  color: #b91c1c;
  background: #fef2f2;
  font-size: 12px;
  font-weight: 700;
}

.ticker-actions-cell {
  white-space: nowrap;
  text-align: center;
}

.ticker-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
}

.reorder-btn {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.reorder-btn:hover:not(:disabled) {
  background: #f8fafc;
}

.reorder-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.error {
  margin: 0 18px 18px;
  padding: 10px 12px;
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: 12px;
  font-size: 14px;
}

#lastPriceUpdate,
#lastEarningsRefresh {
  margin-left: auto;
  text-align: right;
}

#pricesTable td.ticker-cell,
#tickersTable thead th:nth-child(1),
#positionsTable td.ticker-cell {
  padding-left: 12px;
}

#tickersTable .range-cell {
  min-width: 92px;
}

#tickersTable .ma-cell {
  min-width: 58px;
}

#tickersTable .atr-band-cell {
  min-width: 82px;
}

.row-total-value {
  margin-top: 0;
}

.ticker-main-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.ticker-main-line.earnings-risk-text,
.ticker-main-line.earnings-risk-text .ticker-price-inline {
  color: var(--negative);
}

.ticker-price-inline {
  font-size: 13px;
  font-weight: 600;
  color: #000000;
}

.ticker-iv-inline {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.ticker-sub-line {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}

.ticker-sub-line.is-positive,
.ticker-sub-line.is-positive strong {
  color: var(--positive);
}

.ticker-sub-line.is-negative,
.ticker-sub-line.is-negative strong {
  color: var(--negative);
}

.ticker-sub-line.is-neutral strong {
  color: var(--muted);
}

.premium-quote-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 60px;
}

.premium-quote-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text);
  font-weight: 500;
}

.premium-quote-label {
  color: inherit;
  font-weight: inherit;
}

.premium-quote-row strong {
  color: inherit;
  font-weight: inherit;
}

#tickersTable th[data-col-key="premium140"] .header-with-resize,
#tickersTable th[data-col-key="premium145"] .header-with-resize,
#tickersTable th[data-col-key="premium150"] .header-with-resize,
#scoutTable th[data-col-key="premium140"] .header-with-resize,
#scoutTable th[data-col-key="premium145"] .header-with-resize,
#scoutTable th[data-col-key="premium150"] .header-with-resize,
#customScoutTable th[data-col-key="premium140"] .header-with-resize,
#customScoutTable th[data-col-key="premium145"] .header-with-resize,
#customScoutTable th[data-col-key="premium150"] .header-with-resize {
  justify-content: center;
}

#tickersTable th[data-col-key="premium140"] .header-with-help,
#tickersTable th[data-col-key="premium145"] .header-with-help,
#tickersTable th[data-col-key="premium150"] .header-with-help,
#scoutTable th[data-col-key="premium140"] .header-with-help,
#scoutTable th[data-col-key="premium145"] .header-with-help,
#scoutTable th[data-col-key="premium150"] .header-with-help,
#customScoutTable th[data-col-key="premium140"] .header-with-help,
#customScoutTable th[data-col-key="premium145"] .header-with-help,
#customScoutTable th[data-col-key="premium150"] .header-with-help {
  justify-content: center;
}

#tickersTable td:nth-child(5),
#tickersTable td:nth-child(6),
#tickersTable td:nth-child(7),
#scoutTable td:nth-child(5),
#scoutTable td:nth-child(6),
#scoutTable td:nth-child(7),
#customScoutTable td:nth-child(5),
#customScoutTable td:nth-child(6),
#customScoutTable td:nth-child(7) {
  text-align: center;
}

.positions-section {
  border-top: 1px solid #edf2f7;
}

.scout-header,
.scout-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.scout-header,
.scout-footer {
  justify-content: flex-start;
}

.scout-controls {
  padding: 0 18px 14px;
  align-items: flex-end;
}

.scout-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.scout-control span {
  color: var(--text);
}

.scout-control-compact {
  min-width: 120px;
}

.price-filter-pair {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
}

.scout-control select {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
  background: #ffffff;
  outline: none;
}

.scout-control input {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text);
  background: #ffffff;
  outline: none;
}

.scout-checkbox {
  min-height: 38px;
  color: var(--text);
  font-weight: 600;
}

.scout-action-cell {
  text-align: center;
}

.scout-add-btn {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.scout-ticker-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scout-hover-trigger {
  position: relative;
}

.scout-ticker-line {
  font-size: 14px;
  font-weight: 700;
}

.scout-ticker-line.scout-hover-trigger {
  display: inline-block;
  align-self: flex-start;
  width: fit-content;
}

.scout-company-name {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.scout-company-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.scout-industry {
  overflow-wrap: anywhere;
}

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

.scout-hover-source {
  display: none;
}

.scout-info-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  color: var(--text);
  background: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.scout-info-link:hover {
  background: #f8fafc;
}

.floating-scout-popover {
  display: none;
  position: fixed;
  min-width: 168px;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  z-index: 1000;
}

.floating-scout-popover .scout-hover-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.floating-scout-popover .scout-hover-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.floating-scout-popover .scout-hover-description {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.floating-scout-popover .scout-hover-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

#scoutTable .range-cell {
  min-width: 92px;
}

#customScoutTable .range-cell {
  min-width: 92px;
}

#scoutTable .ma-cell {
  min-width: 58px;
}

#customScoutTable .ma-cell {
  min-width: 58px;
}

#scoutTable .atr-band-cell {
  min-width: 82px;
}

#customScoutTable .atr-band-cell {
  min-width: 82px;
}

.range-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 108px;
}

.range-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fecaca 0%, #fef3c7 50%, #bbf7d0 100%);
  overflow: visible;
}

.range-marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #0f172a;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transform: translate(-50%, -50%);
}

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

.ma-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 86px;
}

.ma-line {
  font-size: 12px;
  color: var(--muted);
}

.ma-line-single {
  white-space: nowrap;
}

.atr-band-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 92px;
}

.atr-band-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fecaca 0%, #f8fafc 50%, #bbf7d0 100%);
  overflow: visible;
}

.atr-band-midline {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: rgba(15, 23, 42, 0.18);
  transform: translateX(-50%);
}

.atr-band-marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #0f172a;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transform: translate(-50%, -50%);
}

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

.scout-add-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.scout-empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 18px 12px;
  font-weight: 600;
}

.positions-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
}

.positions-footer {
  justify-content: flex-start;
}

#positionsTable th,
#positionsTable td {
  text-align: center;
}

#positionsTable td.ticker-cell,
#positionsTable th.ticker-col {
  text-align: left;
}

#tickersTable thead th[data-col-key],
#scoutTable thead th[data-col-key],
#customScoutTable thead th[data-col-key] {
  position: relative;
}

.table-col-resize-handle {
  position: absolute;
  top: 0;
  right: -8px;
  width: 16px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  z-index: 5;
}

.table-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.28);
}

#tickersTable thead th:hover .table-col-resize-handle::after,
#scoutTable thead th:hover .table-col-resize-handle::after,
#customScoutTable thead th:hover .table-col-resize-handle::after,
.table-col-resize-handle:hover::after {
  background: rgba(15, 23, 42, 0.48);
}

body.is-resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.position-cell {
  min-width: 220px;
  text-align: center;
}

.bought-position-grid {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 128px;
  margin: 0 auto;
}

.bought-strike-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  width: 40px;
  text-align: right;
}

.bought-strike-line {
  display: grid;
  grid-template-columns: 40px 64px;
  align-items: center;
  column-gap: 6px;
  width: 100%;
}

.bought-input-row {
  display: grid;
  grid-template-columns: 40px 10px 50px;
  align-items: center;
  column-gap: 4px;
  width: 100%;
}

.bought-strike-wrap {
  width: 64px;
}

.premium-wrap {
  width: 50px;
}

#positionsTable .contract-input,
#positionsTable .premium-input,
#positionsTable .strike-input {
  display: block;
  width: 100%;
  height: 28px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

#positionsTable .contract-input {
  padding: 0;
}

#positionsTable .premium-input,
#positionsTable .strike-input {
  padding-right: 6px;
}

#positionsTable .contract-input.is-empty,
#positionsTable .premium-input.is-empty,
#positionsTable .strike-input.is-empty {
  text-align: left;
  padding-left: 8px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

#positionsTable .contract-input:not(.is-empty),
#positionsTable .premium-input:not(.is-empty),
#positionsTable .strike-input:not(.is-empty) {
  text-align: center;
  padding-left: 0;
  border-color: #cbd5e1;
  background: transparent;
}

#positionsTable input:-webkit-autofill,
#positionsTable input:-webkit-autofill:hover,
#positionsTable input:-webkit-autofill:focus,
#positionsTable input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  box-shadow: 0 0 0 1000px transparent inset !important;
  background-color: transparent !important;
  border-color: #cbd5e1;
  transition: background-color 9999s ease-out 0s;
}

.bought-marker-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0 0 8px;
}

.bought-marker {
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  padding: 4px 6px;
  border-radius: 8px;
  color: #000000;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.22);
}

.hidden {
  display: none;
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .scout-control {
    min-width: 100%;
  }

  .price-filter-pair {
    width: 100%;
    flex-wrap: wrap;
  }

  .cap-bucket-dropdown {
    width: 100%;
  }

  .cap-bucket-dropdown .cap-bucket-group {
    min-width: 100%;
  }

  .scout-control-compact {
    min-width: calc(50% - 6px);
  }

  .scout-action-cell {
    text-align: left;
  }
}
