/* ════════════════════════════════════════
   SOS — Stock Options Screener
   Custom stylesheet (Tabler dark/cyan base)
   ════════════════════════════════════════ */

/* ── Brand / logo ──────────────────────── */
.sos-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--tblr-body-color);
}

.sos-subtitle {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--tblr-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ── Brand price display (stock detail page) ── */
.sos-brand-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--tblr-body-color);
  letter-spacing: 0.01em;
  opacity: 1;
  font-variant-numeric: tabular-nums;
}

.sos-brand-change {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 1;
  font-variant-numeric: tabular-nums;
}

/* ── Sidebar ticker badges ──────────────── */
.ticker-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--tblr-gray-400);
  background: rgba(150, 159, 171, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(150, 159, 171, 0.25);
  transition: background 0.15s, border-color 0.15s;
}

.dropdown-item:hover .ticker-badge,
.dropdown-item.active .ticker-badge {
  background: rgba(150, 159, 171, 0.2);
  border-color: var(--tblr-gray-400);
}

/* ── Sparkline placeholder ──────────────── */
.sos-sparkline-placeholder {
  height: 40px;
  background: linear-gradient(
    90deg,
    rgba(150, 159, 171, 0.08) 0%,
    rgba(150, 159, 171, 0.18) 50%,
    rgba(150, 159, 171, 0.08) 100%
  );
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.sos-sparkline-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  animation: shimmer 1.8s infinite;
}

/* ── Chart placeholder ──────────────────── */
.sos-chart-placeholder {
  height: 280px;
}

/* ── Shimmer animation ──────────────────── */
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Theme Settings button ──────────────── */
#btn-theme-settings {
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  transition: background 0.15s, color 0.15s;
}

#btn-theme-settings:hover {
  background: rgba(150, 159, 171, 0.1);
  color: var(--tblr-gray-300);
}

/* ── Card link pop effect ───────────────── */
.card-link-pop {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-link-pop:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* ── Monospace values in stat cards ─────── */
.h1 {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ── Options chain row colours ──────────────── */
.sos-itm td { background: rgba(47, 179, 135, 0.06) !important; }
.sos-atm td { background: rgba(255, 200, 60,  0.07) !important; }
.sos-atm td:first-child { border-left: 2px solid rgba(255,200,60,0.5); }
.sos-itm td:first-child { border-left: 2px solid rgba(47,179,135,0.5); }

/* ── Period button active state ─────────────── */
.period-btn.active {
  background: rgba(150, 159, 171, 0.15) !important;
  color: var(--tblr-body-color) !important;
}

/* ── Monospace values in stat cards ─────────── */
.h1 {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ── Options ROI column ─────────────────────── */
.sos-roi        { font-variant-numeric: tabular-nums; font-weight: 500; }
.sos-roi-high   { color: #2fb387; }   /* >= 3 % — green  */
.sos-roi-medium { color: #f0a930; }   /* >= 1 % — amber  */
.sos-roi-low    { color: #6c7a8d; }   /* < 1 %  — muted  */
.sos-roi-none   { color: #6c7a8d; }   /* no bid — muted  */

/* ── Options filter bar ─────────────────────── */
#options-filter-bar {
  background: rgba(255, 255, 255, 0.02);
}

#options-filter-bar .form-control {
  font-size: 0.82rem;
}

/* Hide browser number spinners for cleaner look */
#options-filter-bar input[type=number]::-webkit-inner-spin-button,
#options-filter-bar input[type=number]::-webkit-outer-spin-button {
  opacity: 0.4;
}

#filter-match-count {
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: right;
}

/* Ensure hidden rows collapse fully */
#options-tab-content tbody tr[style*="display: none"] {
  display: none !important;
}

/* ── Bug fix: sun icon / light swatch label in dark mode ── */
/* Tabler's form-colorinput-light uses dark text on white bg  */
.form-colorinput-light .form-colorinput-label {
  color: #1a1a2e !important;
}
/* Also covers any .icon-sun that inherits white in dark mode  */
[data-bs-theme="dark"] .icon-sun {
  color: #1a1a2e !important;
}

/* ── DTE badge ──────────────────────────────── */
.sos-dte-badge {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.78rem;
}

/* Colour by urgency */
.sos-dte-badge[data-dte="0"],
.sos-dte-badge[data-dte="1"],
.sos-dte-badge[data-dte="2"],
.sos-dte-badge[data-dte="3"],
.sos-dte-badge[data-dte="4"],
.sos-dte-badge[data-dte="5"],
.sos-dte-badge[data-dte="6"],
.sos-dte-badge[data-dte="7"] { color: #d63939; }   /* <= 7d  red    */

/* JS handles the gradient bands > 7 */

/* ── Column header tooltips ─────────────────── */
.sos-th {
  cursor: help;
  white-space: nowrap;
  user-select: none;
}

.sos-th::after {
  content: " ⓘ";
  font-size: 0.65rem;
  opacity: 0.4;
  vertical-align: super;
  letter-spacing: 0;
}

/* ════════════════════════════════════════
   Watchlist
   ════════════════════════════════════════ */

/* ── Summary row ────────────────────────── */
.wl-summary-row td { vertical-align: middle; }

.wl-expand-btn .wl-chevron {
  transition: transform 0.18s ease;
}

/* ── Traffic-light dots in summary ─────── */
.wl-dot {
  display: inline-block;
  width:  10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tblr-secondary);
  flex-shrink: 0;
  box-sizing: border-box;
}
.wl-dot-pass    { background: #2fb387; }
.wl-dot-neutral { background: #6c7a8d; }
.wl-dot-fail    { background: #d63939; }
.wl-dot-off     { background: transparent; border: 1px solid rgba(150, 159, 171, 0.3); }

/* ── Detail panel ───────────────────────── */
.wl-detail-row > td {
  background: rgba(255,255,255,0.025);
  border-top: 1px solid rgba(255,255,255,0.06) !important;
}

.wl-detail-panel {
  border-left: 3px solid rgba(150,159,171,0.2);
}

/* ── Check card ─────────────────────────── */
.wl-check-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 110px;
}

.wl-check-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tblr-muted);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.wl-tv-link {
  color: var(--tblr-muted);
  opacity: 0.6;
  transition: opacity 0.15s;
}
.wl-tv-link:hover { opacity: 1; color: var(--tblr-body-color); }

/* ── Traffic light buttons ──────────────── */
.wl-traffic-light {
  display: flex;
  gap: 4px;
}

.wl-tl-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, opacity 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  background: rgba(255,255,255,0.05);
  color: var(--tblr-body-color);
}

.wl-tl-pass    { color: #2fb387; }
.wl-tl-neutral { color: #6c7a8d; }
.wl-tl-neutral.active { color: #f0a930; }
.wl-tl-fail    { color: #d63939; }

.wl-tl-btn:hover { opacity: 0.7; transform: scale(1.1); }

.wl-tl-btn.active {
  opacity: 1;
  transform: scale(1.12);
}
.wl-tl-pass.active    { border-color: #2fb387; background: rgba(47,179,135,0.15); }
.wl-tl-neutral.active { color: #f0a930; border-color: #f0a930; background: rgba(240,169,48,0.15); }
.wl-tl-fail.active    { border-color: #d63939; background: rgba(214,57,57,0.15); }

/* ── Notes ──────────────────────────────── */
.wl-notes-card { min-width: 220px; }

.wl-notes {
  resize: vertical;
  font-size: 0.82rem;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
  color: var(--tblr-body-color);
}
.wl-notes:focus {
  background: rgba(255,255,255,0.07);
  border-color: rgba(150,159,171,0.4);
  color: var(--tblr-body-color);
  box-shadow: none;
}

/* ── Action bar selected rows ───────────── */
#wl-action-bar {
  background: rgba(150, 159, 171, 0.06);
}

/* ── btn-ghost-danger (not in Tabler beta21) */
.btn-ghost-danger {
  color: var(--tblr-danger);
  background: transparent;
  border: none;
}
.btn-ghost-danger:hover {
  background: rgba(214,57,57,0.1);
  color: #d63939;
}

/* ── Trend arrow ─────────────────────────────────────────────────────────── */
.wl-trend-arrow {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  color: #f0a930;    /* orange — all states default */
  flex-shrink: 0;
}
.wl-trend-up      { color: #f0a930; }
.wl-trend-neutral { color: #f0a930; }
.wl-trend-down    { color: #f0a930; }

/* ── Trend arrow picker buttons ─────────────────────────────────────────── */
.wl-arrow-btn {
  width:   32px;
  height:  32px;
  border-radius: 6px;
  border:  2px solid transparent;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, opacity 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  background: rgba(255,255,255,0.05);
  color: #f0a930;
}

.wl-arrow-btn:hover { opacity: 0.75; transform: scale(1.1); }

.wl-arrow-btn.active {
  opacity: 1;
  transform: scale(1.12);
  border-color: #f0a930;
  background: rgba(240,169,48,0.15);
}

/* ── SMA hint label ──────────────────────────────────────────────────────── */
.wl-trend-hint-up   { color: #2fb387; }
.wl-trend-hint-down { color: #d63939; }

/* ── Stock check dots in sidebar ────────────────────────────────────────── */
.sc-dot {
  display: inline-block;
  width:  7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sc-dot-pass    { background: #2fb387; }
.sc-dot-fail    { background: #d63939; }
.sc-dot-neutral { background: #f0a930; }
.sc-dot-off     { background: rgba(150,159,171,0.2); }

/* Align dots to the right of the ticker link */
.navbar-vertical .dropdown-item {
  display: flex;
  align-items: center;
}

/* ── Stock page trend arrow buttons ─────────────────────────────────────── */
.sc-arrow-btn {
  width:   36px;
  height:  36px;
  border-radius: 8px;
  border:  2px solid transparent;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, border-color 0.12s, opacity 0.12s, background 0.12s;
  opacity: 0.35;
  background: rgba(255,255,255,0.05);
  color: #f0a930;
  font-weight: 700;
}

.sc-arrow-btn:hover {
  opacity: 0.75;
  transform: scale(1.1);
}

.sc-arrow-btn.active {
  opacity: 1;
  transform: scale(1.12);
  border-color: #f0a930;
  background: rgba(240,169,48,0.15);
}

/* ── Sidebar trend arrow ─────────────────────────────────────────────────── */
.sc-trend-arrow {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f0a930;
  line-height: 1;
  flex-shrink: 0;
}

.sc-trend-unset {
  opacity: 0.25;   /* dim → arrow when not yet set */
}

/* ── Stock check accordion header badges ────────────────────────────────── */
.sc-check-badge {
  display: inline-block;
  min-width: 80px;
  text-align: center;
  flex-shrink: 0;
}

/* ── Sidebar dot divider (stock vs options checks) ── */
.sc-dot-divider {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: rgba(150,159,171,0.25);
  flex-shrink: 0;
  margin: 0 1px;
}

/* ── Sticky brand / scrollable nav in vertical sidebar ──────────────────── */

/* Make the sidebar a fixed-height flex column */
.navbar-vertical .container-fluid {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  overflow: visible;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  width: 100%;
}

/* Sidebar must stack above page content so its dropdowns are not clipped */
.navbar-vertical {
  z-index: 1040;
}

/* Tabler's .navbar-expand-lg has overflow-y: scroll — kill it on the sidebar */
.navbar-vertical.navbar-expand-lg {
  overflow-y: visible !important;
}

/* Brand stays at the top — no scroll */
.navbar-vertical.navbar-expand-lg .navbar-brand {
  flex-shrink: 0;
  padding: 0.75rem 0.8rem;
  justify-content: left;
  white-space: pre-wrap;
  z-index: 10;
}

/* Collapsible section fills remaining height and scrolls */
.navbar-vertical .navbar-collapse {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.25rem;
}

/* Mobile toggler stays in flow */
.navbar-vertical .navbar-toggler {
  flex-shrink: 0;
}

/* ── Remove navbar active border colour (green line) ────────────────────── */
.navbar-vertical .nav-link.active {
  border-left-color: transparent !important;
}
:root, [data-bs-theme] {
  --tblr-navbar-active-border-color: transparent;
}

/* ── Skeleton loading placeholders ──────────────────────────────────────── */
.skeleton-text {
  display: inline-block;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(150,159,171,0.12) 0%,
    rgba(150,159,171,0.22) 50%,
    rgba(150,159,171,0.12) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  vertical-align: middle;
  height: 0.85em;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Mini chart skeleton & container ────────────────────────────────────── */
.stock-mini-chart {
  margin-top: auto;
}

.skeleton-chart-bg {
  background: linear-gradient(
    90deg,
    rgba(150,159,171,0.07) 0%,
    rgba(150,159,171,0.13) 50%,
    rgba(150,159,171,0.07) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

/* ── Market status pinned to bottom of sidebar ───────────────────────────── */
.navbar-market-status {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.75rem;
}

#market-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6c7a8d;
}

/* ── Stocks page ROI/Week scan colouring ─────────────────────────────────── */
.sos-card-tier-high {
  background: rgba(47,179,135,0.12) !important;
  border-color: rgba(47,179,135,0.35) !important;
}

.sos-card-tier-medium {
  background: rgba(240,169,48,0.12) !important;
  border-color: rgba(240,169,48,0.35) !important;
}

/* ROI/Wk badge on cards */
.sos-roiw-badge {
  display: inline-block;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.80em;
  --tblr-badge-padding-x: 0;
  padding-left: 0;
  padding-right: 0;
}

/* Legend swatches */
.sos-scan-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
.sos-scan-swatch.sos-scan-high   { background: rgba(47,179,135,0.5); }
.sos-scan-swatch.sos-scan-medium { background: rgba(240,169,48,0.5); }

/* ── ROI/Week scan card tiers ───────────────────────────────────────────── */
.sos-card-tier-high {
  background-color: rgba(47, 179, 135, 0.10) !important;
  border-color: rgba(47, 179, 135, 0.30) !important;
}
.sos-card-tier-medium {
  background-color: rgba(240, 169, 48, 0.10) !important;
  border-color: rgba(240, 169, 48, 0.30) !important;
}

.sos-scan-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.sos-scan-high   { background: rgba(47, 179, 135, 0.6); }
.sos-scan-medium { background: rgba(240, 169, 48, 0.6); }


/* ── Group selector sticky header ───────────────────────────────────────── */
#group-selector-nav {
  position: sticky;
  top: 0.3rem;
  z-index: 5;
  background: var(--tblr-navbar-bg, #182433);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 0.25rem;
}

/* ── Group selector pinned below brand ──────────────────────────────────── */
.navbar-group-sticky {
  flex-shrink: 0;
  padding: 0 0.8rem;
}

.navbar-group-sticky .nav-link {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* ── Dropdown menus need solid background (Tabler/Bootstrap default sometimes transparent) ── */
.dropdown-menu {
  background-color: var(--tblr-dropdown-bg, #1a2030);
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 1080;
  position: absolute;
}

[data-bs-theme="light"] .dropdown-menu,
.theme-light .dropdown-menu {
  background-color: #ffffff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Group selector dropdown must stack above all sidebar items ────────── */
#group-selector-nav {
  position: relative;
  z-index: 1090;
}

#group-selector-nav .dropdown-menu {
  z-index: 1090 !important;
}

/* Make sure the group selector's parent container doesn't trap the dropdown */
.navbar-group-sticky {
  position: relative;
  z-index: 1090;
}

/* ── Sidebar is always dark — force its dropdowns to match ─────────────── */
#group-selector-nav .dropdown-menu,
.navbar-group-sticky .dropdown-menu {
  background-color: #1a2030 !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  color: rgba(255,255,255,0.85);
}

#group-selector-nav .dropdown-menu .dropdown-item,
.navbar-group-sticky .dropdown-menu .dropdown-item {
  color: rgba(255,255,255,0.85);
}

#group-selector-nav .dropdown-menu .dropdown-item:hover,
#group-selector-nav .dropdown-menu .dropdown-item:focus,
.navbar-group-sticky .dropdown-menu .dropdown-item:hover,
.navbar-group-sticky .dropdown-menu .dropdown-item:focus {
  background-color: rgba(255,255,255,0.08);
  color: #ffffff;
}

#group-selector-nav .dropdown-menu .dropdown-item.active,
.navbar-group-sticky .dropdown-menu .dropdown-item.active {
  background-color: rgba(47,179,135,0.18);
  color: #ffffff;
}

#group-selector-nav .dropdown-menu .dropdown-divider,
.navbar-group-sticky .dropdown-menu .dropdown-divider {
  border-top-color: rgba(255,255,255,0.1);
}

/* ── Stock card drag handle on avatar (only in Custom sort mode) ───────── */

/* Avatar contents: letters by default, grip overlay only in draggable mode */
.sos-avatar-grip {
  display: none;
  align-items: center;
  justify-content: center;
}

/* In Custom sort mode: avatar becomes the drag handle */
.sos-grid-draggable .sos-drag-handle {
  cursor: grab;
  position: relative;
  transition: transform 0.15s;
}

.sos-grid-draggable .sos-drag-handle:hover {
  transform: scale(1.06);
}

.sos-grid-draggable .sos-drag-handle:active {
  cursor: grabbing;
}

/* Hide letters, show grip dots when draggable */
.sos-grid-draggable .sos-drag-handle .sos-avatar-letters {
  display: none;
}

.sos-grid-draggable .sos-drag-handle .sos-avatar-grip {
  display: flex;
}

/* Visual cues during a drag */
.sos-drag-ghost {
  opacity: 0.3;
}

.sos-drag-chosen {
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}

/* ── Page-load overlay (shown during slow navigation) ──────────────────── */
.sos-page-loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 22, 33, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.sos-page-loading-overlay.show {
  display: flex;
  /* pointer-events stays none so clicks pass through the overlay */
}

/* ── Editable notes on stock detail page ──────────────────────────────── */
.sos-notes {
  max-width: 600px;
}

.sos-notes-rendered {
  cursor: text;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 4px;
  border: 1px solid transparent;
  min-height: 1.6em;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
}

.sos-notes-rendered:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
}

.sos-notes-rendered:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.18);
}

/* Markdown content — give some basic spacing */
.sos-notes-rendered p { margin: 0 0 0.4em 0; }
.sos-notes-rendered p:last-child { margin-bottom: 0; }
.sos-notes-rendered ul, .sos-notes-rendered ol { margin: 0.2em 0 0.4em 1.2em; padding: 0; }
.sos-notes-rendered code {
  font-size: 0.85em;
  padding: 0 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.sos-notes-rendered a { text-decoration: underline; text-underline-offset: 2px; }

.sos-notes-editor {
  resize: none;        /* let JS auto-grow */
  overflow: hidden;
  min-height: 38px;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Scratchpad ─────────────────────────────────────────────────────── */
.sos-scratchpad-editor {
  resize: none;
  overflow: hidden;
  min-height: 60px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Feed cards — markdown body styling */
.sp-card .sp-rendered img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5em 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sp-card .sp-rendered p { margin: 0 0 0.6em 0; }
.sp-card .sp-rendered p:last-child { margin-bottom: 0; }
.sp-card .sp-rendered ul,
.sp-card .sp-rendered ol { margin: 0.3em 0 0.6em 1.4em; padding: 0; }
.sp-card .sp-rendered code {
  font-size: 0.88em;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.sp-card .sp-rendered pre {
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: 4px;
  overflow-x: auto;
}
.sp-card .sp-rendered pre code {
  background: transparent;
  padding: 0;
}
.sp-card .sp-rendered blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  padding-left: 0.8em;
  margin: 0.4em 0;
  color: rgba(255, 255, 255, 0.7);
}
.sp-card .sp-rendered h1,
.sp-card .sp-rendered h2,
.sp-card .sp-rendered h3,
.sp-card .sp-rendered h4 {
  margin: 0.4em 0 0.3em 0;
}
.sp-card .sp-rendered a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Group selector (sidebar form-select) ──────────────────────────────── */
.sos-group-select {
  background-color: #151f2c !important;
  /* Light chevron for dark background */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 16px 12px !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 0.9rem;
  padding-right: 2.5rem !important;  /* room for chevron */
  padding-left: 2.5rem !important;   /* room for icon */
  appearance: none;                   /* hide native arrow if any */
  -webkit-appearance: none;
}

.sos-group-select:hover {
  border-color: rgba(255, 255, 255, 0.20) !important;
}

.sos-group-select:focus {
  background-color: #151f2c !important;
  border-color: rgba(47, 179, 135, 0.5) !important;
  box-shadow: 0 0 0 0.15rem rgba(47, 179, 135, 0.18) !important;
  color: #ffffff !important;
}

/* Style the option dropdown popup (browser-rendered, limited control) */
.sos-group-select option {
  background-color: #1a2030;
  color: rgba(255, 255, 255, 0.9);
}

/* Wrap so the grid icon overlays the left side of the select */
.sos-group-select-wrap {
  position: relative;
}

.sos-group-select-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;       /* clicks pass through to the select */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* ── Smaller top padding on .pt-lg-3 for tighter sidebar look ─────────── */
@media (min-width: 992px) {
  .pt-lg-3 {
    padding-top: 0.75rem !important;
  }
}

/* ── Dropdown-item indent reduction for more compact submenus ─────────── */
.navbar-vertical.navbar-expand-lg .navbar-collapse .dropdown-menu .dropdown-item {
  padding-left: calc(calc(calc(var(--tblr-page-padding) * 2) / 2) + 0.75rem);
}

/* ── Brighter nav-link text weight ─────────────────────────────────────── */
.nav-link {
  font-weight: 600;
}

/* ── Inline badge inside nav-links (override Tabler's absolute positioning) ─── */
.navbar .navbar-nav .nav-link .badge {
  position: static;
  top: auto;
  right: auto;
  transform: none;
}

/* ── Notes popover on /optscreener ticker labels ────────────────────────── */
.sos-notes-popover {
  max-width: 380px;
  --bs-popover-bg: #1a2030;
  --bs-popover-border-color: rgba(255, 255, 255, 0.10);
  --bs-popover-header-bg: rgba(255, 255, 255, 0.04);
  --bs-popover-header-color: rgba(255, 255, 255, 0.85);
  --bs-popover-body-color: rgba(255, 255, 255, 0.80);
}

.sos-notes-popover .popover-header {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sos-notes-popover .popover-body {
  font-size: 0.85rem;
  line-height: 1.45;
  max-height: 320px;
  overflow-y: auto;
}

.sos-notes-popover .popover-body p { margin: 0 0 0.5em 0; }
.sos-notes-popover .popover-body p:last-child { margin-bottom: 0; }
.sos-notes-popover .popover-body ul,
.sos-notes-popover .popover-body ol { margin: 0.2em 0 0.4em 1.2em; padding: 0; }
.sos-notes-popover .popover-body code {
  font-size: 0.85em;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.sos-notes-popover .popover-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Recommended-strike row highlight (matches /optscreener scan output) ─── */
.sos-recommended-strike {
  background-color: rgba(174, 62, 201, 0.12) !important;
}

.sos-recommended-strike td {
  border-top: 1px solid rgba(174, 62, 201, 0.45);
  border-bottom: 1px solid rgba(174, 62, 201, 0.45);
}

.sos-recommended-strike td:first-child {
  border-left: 3px solid rgba(174, 62, 201, 0.85);
  padding-left: calc(0.5rem - 3px);  /* keep contents aligned despite border */
}

.sos-recommended-strike:hover {
  background-color: rgba(174, 62, 201, 0.18) !important;
}

/* ── Drag-and-drop zones at viewport bottom (optscreener custom sort) ───── */
.sos-drop-zones {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  flex-direction: row;
  z-index: 1050;
  pointer-events: none;        /* zones become interactive only when shown */
}

.sos-drop-zones.show {
  display: flex;
  pointer-events: auto;
}

.sos-drop-zone {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  cursor: grabbing;
  border-top: 3px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}

/* Drop zone children inherit grabbing cursor — prevent SVG fragment overriding */
.sos-drop-zone * {
  cursor: inherit !important;
  pointer-events: none;
}

.sos-drop-zone-top {
  background: rgba(47, 179, 135, 0.85);          /* green */
  border-top-color: rgba(47, 179, 135, 1);
}
.sos-drop-zone-top:hover,
.sos-drop-zone-top.hover {
  background: rgba(47, 179, 135, 1);
  transform: translateY(-2px);
}

.sos-drop-zone-bottom {
  background: rgba(214, 57, 57, 0.85);           /* red */
  border-top-color: rgba(214, 57, 57, 1);
}
.sos-drop-zone-bottom:hover,
.sos-drop-zone-bottom.hover {
  background: rgba(214, 57, 57, 1);
  transform: translateY(-2px);
}

.sos-drop-zone .icon {
  width: 28px;
  height: 28px;
}

/* When SortableJS clones the dragged item into a drop zone, hide it visually */
.sos-drop-zone .sortable-ghost,
.sos-drop-zone .stock-card-col {
  display: none !important;
}


/* During an active drag the body keeps the grabbing cursor */
body.sos-dragging,
body.sos-dragging * {
  cursor: grabbing !important;
}

/* ── Inactive stock cards on /optscreener ──────────────────────────────── */
.stock-card-col.sos-inactive .card {
  border: 1px solid rgba(214, 57, 57, 0.55);
  opacity: 0.65;
  background: rgba(214, 57, 57, 0.04);
  transition: opacity 0.15s;
}

.stock-card-col.sos-inactive .card:hover {
  opacity: 0.92;
}

.stock-card-col.sos-inactive .sos-roiw-badge,
.stock-card-col.sos-inactive .sos-earnings-badge {
  display: none !important;  /* No scan results for inactive — hide stale badges */
}

/* Inactive section divider */
.sos-inactive-divider {
  pointer-events: none;
}
.sos-inactive-divider .hr-text {
  color: rgba(214, 57, 57, 0.75);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sos-inactive-divider .hr-text::before,
.sos-inactive-divider .hr-text::after {
  border-color: rgba(214, 57, 57, 0.35);
}

/* ── Assessment staleness indicators (stock_detail check cards) ─────────── */
/* fresh / none — no special treatment */
.sos-staleness-text-fresh,
.sos-staleness-text-none { color: var(--tblr-secondary); }

/* stale: 2 weeks – 1 month → orange */
.sos-staleness-text-stale { color: #f59f00; }
.card-header.sos-staleness-stale {
  border-left: 3px solid #f59f00;
  background: rgba(245, 159, 0, 0.05);
}

/* old: > 1 month → bold bright red */
.sos-staleness-text-old {
  color: #ff2825;
  font-weight: 700;
}
.card-header.sos-staleness-old {
  border-left: 3px solid #ff2825;
  background: rgba(255, 40, 37, 0.05);
}

/* ── Expected Earnings Move accordion — upcoming earnings indicator ─────── */
.accordion-item.sos-em-upcoming .accordion-header .accordion-button {
  background: rgba(245, 159, 0, 0.05) !important;
}

.accordion-item.sos-em-upcoming .accordion-button:not(.collapsed) {
  background: rgba(245, 159, 0, 0.08) !important;
}

.sos-em-days {
  display: inline-block;
  color: #f59f00;
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.01em;
}

/* ── Sidebar ticker search (Tom Select) ─────────────────────────────────── */
/* The sidebar carries data-bs-theme="dark"; we give the dropdown an explicit
   dark surface so it doesn't fall through to an empty/transparent background
   if --bs-body-bg isn't defined in this scope. */
.navbar-ticker-search {
  padding: 0 1rem 0.75rem 1rem;
  position: relative;
}

.navbar-ticker-search .ts-dropdown {
  background: #1a2234;
  color: #e6e9ee;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  z-index: 1080;
  margin-top: 2px;
}

.navbar-ticker-search .ts-dropdown .option {
  padding: 0.55rem 0.75rem;
  color: #e6e9ee;
}

.navbar-ticker-search .ts-dropdown .option.active,
.navbar-ticker-search .ts-dropdown .active {
  background: rgba(77, 171, 247, 0.12);
  color: #fff;
}

.navbar-ticker-search .ts-dropdown .no-results {
  color: rgba(230, 233, 238, 0.55);
}

/* Typed text + control surface — keep readable on the dark sidebar */
.navbar-ticker-search .ts-control,
.navbar-ticker-search .ts-control input {
  color: #e6e9ee;
}

.navbar-ticker-search .ts-control input::placeholder {
  color: rgba(230, 233, 238, 0.55);
}

/* Hide the form-select chevron Bootstrap inherits onto the Tom Select wrapper */
.navbar-ticker-search .ts-wrapper.form-select,
.navbar-ticker-search .ts-wrapper.form-select.single {
  background-image: none !important;
  padding-right: 0.75rem !important;
}

.ts-ticker-row .ts-ticker-name {
  margin-top: 1px;
  line-height: 1.2;
  color: rgba(230, 233, 238, 0.6);
}

.ts-add-new {
  color: #4dabf7;
  font-style: italic;
}

.no-results {
  padding: 0.6rem 0.75rem;
  font-style: italic;
}

/* ── Scanner dropdown — active group highlight ──────────────────────────── */
#navbar-scanner .dropdown-item.active,
#navbar-scanner .dropdown-item.active:hover {
  background: rgba(245, 159, 0, 0.12);
  color: #f59f00;
  font-weight: 600;
}

#navbar-scanner .dropdown-item.active .text-muted {
  color: rgba(245, 159, 0, 0.7) !important;
}

/* ── Scanner dropdown — match Stocks-dropdown indent alignment ──────────── */
.navbar-vertical.navbar-expand-lg .navbar-collapse #navbar-scanner.dropdown-menu .dropdown-item {
  padding-left: calc(calc(calc(var(--tblr-page-padding) * 2) / 2) + 1.4rem);
}

/* ── Mobile offcanvas adjustments ────────────────────────────────────────── */
/* Below lg breakpoint, the sidebar becomes an offcanvas drawer. */
@media (max-width: 991.98px) {
  /* The aside itself shrinks to just the hamburger + mobile brand row */
  aside.navbar-vertical {
    position: sticky;
    top: 0;
    z-index: 1040;
    padding: 0.4rem 0.6rem;
    background: var(--tblr-navbar-bg, #182030);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* Override the desktop column-flex on the container — mobile is a row */
  .navbar-vertical .container-fluid {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    height: auto !important;
    width: 100%;
    gap: 0.5rem;
  }

  /* Hamburger visible + tappable */
  .navbar-vertical .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.35rem 0.5rem;
  }

  /* Compact mobile brand sits next to the hamburger */
  .navbar-vertical .navbar-brand.d-lg-none {
    font-size: 0.95rem;
    padding: 0 0.25rem;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Offcanvas drawer — keep dark theme, wider on phones */
  #sidebar-offcanvas.offcanvas {
    width: min(86vw, 320px);
    background: var(--tblr-bg-surface, #1a2234);
  }

  /* Inside the drawer, restore the desktop column layout */
  #sidebar-offcanvas .offcanvas-body {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto;
  }

  /* Brand inside drawer (desktop variant) — show it as the drawer's header
     content, restoring its normal padding */
  #sidebar-offcanvas .navbar-brand.d-none.d-lg-flex {
    display: none !important;
  }

  /* The navbar-collapse inside the offcanvas should always be expanded */
  #sidebar-offcanvas .navbar-collapse {
    display: flex !important;
    flex-direction: column;
    height: auto;
    flex: 1 1 auto;
  }

  /* Make nav items stack full-width inside the drawer */
  #sidebar-offcanvas .navbar-nav {
    flex-direction: column;
    width: 100%;
  }

  /* Group dropdowns expand inline (no popover behaviour on mobile) */
  #sidebar-offcanvas .dropdown-menu {
    position: static !important;
    transform: none !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding-left: 1rem;
  }
}

/* At lg+ the offcanvas-lg helper makes the offcanvas render statically.
   Make sure the offcanvas + its body fill the sidebar and stack vertically. */
@media (min-width: 992px) {
  #sidebar-offcanvas.offcanvas-lg {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    visibility: visible !important;
    transform: none !important;
    background: transparent !important;
    border: 0 !important;
    position: static !important;
  }
  #sidebar-offcanvas .offcanvas-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto;
    width: 100%;
    overflow: visible;
    padding: 0 !important;
  }
  /* The mobile compact brand + hamburger row above must NOT render on desktop */
  aside.navbar-vertical > .container-fluid > .navbar-toggler,
  aside.navbar-vertical > .container-fluid > .navbar-brand.d-lg-none {
    display: none !important;
  }
}

/* ── Analyst Rating slider (5-stop range) ──────────────────────────────────── */
.sos-analyst-range {
  width: 100%;
  max-width: 480px;
}

/* Tick labels under the slider align with the 5 stops */
.sos-analyst-ticks {
  width: 100%;
  max-width: 480px;
  user-select: none;
  font-size: 0.72rem;
  opacity: 0.85;
}

/* Visual indicator that no assessment has been committed yet:
   handle and track fade to a muted grey so the slider position
   doesn't masquerade as a confirmed value. */
.sos-analyst-range.sos-analyst-unset {
  opacity: 0.45;
  filter: grayscale(60%);
}

/* As soon as the user touches it (data-set="1") the slider returns to
   full opacity automatically — class is removed by the JS handler. */

/* ── SmartScore weight gear icon on each accordion header ──────────────── */
.accordion-header {
  position: relative;
}

/* Ensure the accordion-button establishes a stacking context BELOW the gear,
   so the gear's z-index actually wins. Without this the gear can be "under"
   the button's hit area despite a higher z-index. */
.accordion-header .accordion-button {
  position: relative;
  z-index: 1;
}

.sos-weight-gear {
  position: absolute;
  top: 50%;
  right: 3rem;             /* leave space for the accordion's own chevron */
  transform: translateY(-50%);
  z-index: 4;              /* above the accordion button */
  background: transparent;
  border: 0;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  color: rgba(150, 159, 171, 0.55);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  line-height: 0;
  pointer-events: auto;     /* defensive — ensure clicks register */
}

.sos-weight-gear:hover,
.sos-weight-gear:focus-visible {
  color: rgba(240, 169, 48, 0.95);
  background: rgba(240, 169, 48, 0.08);
  outline: none;
}

/* Mobile: gear sits closer to chevron — leave less right padding */
@media (max-width: 575px) {
  .sos-weight-gear {
    right: 2.5rem;
    padding: 0.2rem 0.3rem;
  }
}
