/* =========================================================================
   CleverAlpha Securities — Application Stylesheet
   Layout radius = 0 (cards, tables, inputs, modals). Buttons and pills are the one exception
   (approved tactile pill spec). Day and Night themes via tokens.css.
   ========================================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

/* Layout radius rule: nothing in this stylesheet sets a radius except .btn (pill) and the
   session dot (circle). Keep it that way instead of a global !important override. */

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: background var(--dur-base), color var(--dur-base);
}

/* Tabular figures for institutional financial data */
.num, .tabular, [data-num] {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* Brand Wordmark: All Cap Poppins, 20% letter spacing (0.20em), CLEVER bold, ALPHA light */
.brand-wordmark-container {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-cs-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}

.brand-wordmark {
  font-family: 'Poppins', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.20em; /* 20% letter spacing per brand directive */
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  color: var(--text-primary);
}

.brand-wordmark .brand-bold {
  font-weight: 700;
  color: var(--text-primary);
}

.brand-wordmark .brand-light {
  font-weight: 300;
  color: var(--text-secondary);
}

.brand-wordmark-securities {
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--color-gold);
  text-transform: uppercase;
  margin-top: 3px;
}

/* Eyebrows & Brand taglines */
.eyebrow {
  font-family: var(--font-accent);
  font-weight: var(--fw-light);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-muted);
}

.eyebrow-jade {
  color: var(--color-jade) !important;
}

.eyebrow-gold {
  color: var(--color-gold) !important;
}

/* =========================================================================
   TOP BANNER & GLOBAL HEADER
   ========================================================================= */
.system-status-bar {
  background: var(--status-bar-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 54px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  transition: background var(--dur-base), border-color var(--dur-base);
}

.status-pills {
  display: flex;
  gap: 16px;
  align-items: center;
}

.status-pills-center {
  gap: 12px;
}

.status-pills-right {
  gap: 16px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--color-jade);
  display: inline-block;
}

.status-dot.pulse {
  box-shadow: 0 0 8px var(--color-jade);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Market Countdown Pill (User Requested) */
.market-countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Sun & Crescent Day / Night Mode Toggle */
.theme-toggle-cluster {
  display: inline-flex;
  align-items: center;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 2px;
  gap: 2px;
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 3px 8px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--dur-fast);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
}

.theme-toggle-btn.active {
  background: var(--bg-card);
  color: var(--color-jade);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="night"] .theme-toggle-btn.active {
  background: #222222;
  color: var(--color-gold);
  border: 1px solid #333333;
}

.header-main {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--dur-base), border-color var(--dur-base);
}

.brand-division-tag {
  border-left: 1px solid var(--border-medium);
  padding-left: 14px;
  display: flex;
  flex-direction: column;
}

.brand-division-sub {
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  font-family: var(--font-accent);
}

/* Nav Switcher */
.nav-tabs {
  display: flex;
  height: 100%;
}

.nav-tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 14px;
  height: 48px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--color-jade);
  background: var(--bg-hover);
}

.header-right-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
@media (max-width: 1280px) {
  .header-main { height: auto; min-height: 48px; flex-wrap: wrap; row-gap: 0; }
  .brand-division-tag { display: none; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; height: 40px; border-top: 1px solid var(--border-color); }
  .nav-tab-btn { height: 40px; padding: 0 10px; }
  .header-right-meta { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; padding: 4px 0; }
}

/* Ticker Search Box (Left of Buying Power) */
.header-ticker-search {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  height: 32px;
  transition: border-color var(--dur-fast);
}

.header-ticker-search:focus-within {
  border-color: var(--color-jade);
}

.header-ticker-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  width: 140px;
}

.header-ticker-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.btn-header-search {
  background: var(--bg-subtle);
  border: none;
  border-left: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  height: 100%;
  padding: 0 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--dur-fast);
}

.btn-header-search:hover {
  background: var(--color-jade);
  color: var(--text-on-jade);
}

.buying-power-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.buying-power-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.buying-power-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-jade);
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* =========================================================================
   BUTTONS & CONTROLS (Strict radius = 0)
   ========================================================================= */
.btn {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  height: 48px;
  min-height: 48px;
  padding: 0 28px;
  cursor: pointer;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: all var(--dur-fast) cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98) translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(0, 0, 0, 0.2);
}

.btn-jade {
  background: var(--color-jade);
  color: var(--text-on-jade);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(64, 193, 172, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-jade:hover {
  background: var(--color-jade-hover);
  box-shadow: 0 4px 12px rgba(64, 193, 172, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--color-gold);
  color: var(--text-on-gold);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-gold:hover {
  background: var(--color-gold-hover);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-danger:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-sm {
  height: 36px;
  min-height: 36px;
  padding: 0 16px;
  font-size: 13px;
}
.btn:disabled, .btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn:focus-visible { outline: 2px solid var(--color-info); outline-offset: 2px; }
.btn-link {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  font: inherit; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; padding: 0;
}
.btn-link:hover { color: var(--text-primary); }

/* Inputs, Selects, Radios */
.input, .select {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color var(--dur-fast);
}

.input:focus, .select:focus {
  border-color: var(--color-jade);
}

.input-num {
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   LAYOUT & CONTAINER
   ========================================================================= */
.app-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  flex: 1;
}

.view-section {
  display: none;
}
.view-section.active {
  display: block;
  animation: fadeIn 180ms ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grid Layouts */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
}

/* =========================================================================
   CARDS & PANELS
   ========================================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 20px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Metric KPI Tile */
.metric-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.metric-label {
  font-family: var(--font-accent);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.metric-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-sub.positive {
  color: var(--color-jade);
  font-weight: 600;
}

.metric-sub.negative {
  color: var(--color-danger);
  font-weight: 600;
}

/* =========================================================================
   TABLES & BLOTTERS (Data-Dense, Radius = 0)
   ========================================================================= */
.data-table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  background: var(--table-head-bg);
  color: var(--text-secondary);
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  background: var(--table-row-bg);
}

.data-table tbody tr:hover td {
  background: var(--table-hover-bg);
}

/* Status Badges */
.badge {
  display: inline-block;
  font-family: var(--font-accent);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid currentColor;
}

.badge-jade {
  color: var(--color-jade);
  background: var(--color-jade-dim);
  border-color: var(--color-jade);
}

.badge-gold {
  color: var(--color-gold);
  background: var(--color-gold-dim);
  border-color: var(--color-gold);
}

.badge-danger {
  color: var(--color-danger);
  background: var(--color-danger-dim);
  border-color: var(--color-danger);
}

.badge-info {
  color: var(--color-info);
  background: var(--color-info-dim);
  border-color: var(--color-info);
}

.badge-neutral {
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border-color: var(--border-medium);
}

/* =========================================================================
   ORDER ENTRY POPUP MODAL
   ========================================================================= */
.order-entry-modal-card {
  background: var(--modal-bg);
  border: 1px solid var(--color-jade);
  width: 100%;
  max-width: 520px;
  max-height: 94vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  color: var(--text-primary);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  padding-right: 44px;
  margin-bottom: 16px;
}

.pill-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border-color);
  margin-bottom: 16px;
}

.pill-btn {
  background: var(--bg-subtle);
  border: none;
  color: var(--text-secondary);
  padding: 10px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur-fast);
}

.pill-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.pill-btn.active-buy {
  background: var(--color-jade);
  color: var(--text-on-jade);
}

.pill-btn.active-sell {
  background: var(--color-gold);
  color: var(--text-on-gold);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.form-label span.note {
  color: var(--text-muted);
  font-size: 10px;
}

.ticket-summary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 14px;
  margin: 16px 0;
  font-size: 12px;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--text-secondary);
}

.ticket-row.total {
  border-top: 1px solid var(--border-medium);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  color: var(--text-primary);
}

.buying-power-notice {
  font-size: 10px;
  padding: 8px 10px;
  background: var(--color-jade-dim);
  border-left: 2px solid var(--color-jade);
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* =========================================================================
   TICKER RESEARCH & CORPORATE INFO MODAL
   ========================================================================= */
.ticker-modal-card {
  background: var(--modal-bg);
  border: 1px solid var(--border-medium);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  color: var(--text-primary);
}

.ticker-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  padding-right: 52px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.corp-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 16px;
  margin-bottom: 20px;
}

@media(max-width: 768px) {
  .corp-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.corp-stat-item {
  display: flex;
  flex-direction: column;
}

.corp-stat-label {
  font-family: var(--font-accent);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.corp-stat-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.news-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.news-headline {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
}

/* =========================================================================
   INTERACTIVE CANVAS CHART & CONTROLS
   ========================================================================= */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px 20px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-ticker-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.chart-ticker-sym {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.chart-ticker-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-jade);
}

.chart-ticker-chg {
  font-size: 12px;
  color: var(--color-jade);
  font-weight: 600;
}

.timeframe-group {
  display: flex;
  gap: 2px;
  background: var(--border-color);
}

.timeframe-btn {
  background: var(--bg-subtle);
  border: none;
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.timeframe-btn.active {
  background: var(--color-jade);
  color: var(--text-on-jade);
}

#marketCanvas {
  width: 100%;
  height: 320px;
  display: block;
}

/* =========================================================================
   OPTIONS CHAIN CLICKABLE PRICE CELLS & DELTA METERS
   ========================================================================= */
.opt-clickable-cell {
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  user-select: none;
  font-weight: 600;
}

/* =========================================================================
   KEY TERMS "i" INFO EXPLAINER BUTTON (User Requested)
   ========================================================================= */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50% !important;
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-display);
  cursor: pointer;
  vertical-align: middle;
  margin-left: 4px;
  transition: all var(--dur-fast);
  line-height: 1;
  padding: 0;
}

/* Top Layer Nested Explainer Modal (User Requested) */
#termInfoModal {
  z-index: 3000 !important;
}

#termInfoModal .modal-card {
  z-index: 3001 !important;
  max-width: 500px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px var(--color-jade);
}

.opt-clickable-cell:hover {
  background: var(--bg-hover) !important;
}

.opt-clickable-cell.call-ask:hover, .opt-clickable-cell.put-ask:hover {
  color: var(--color-jade-hover) !important;
  text-decoration: underline;
}

.opt-clickable-cell.call-bid:hover, .opt-clickable-cell.put-bid:hover {
  color: var(--color-gold-hover) !important;
  text-decoration: underline;
}

/* Per-Strike NBBO-Derived Implied Volatility (IV %) Cells (Mirror Layout) */
.opt-iv-cell {
  min-width: 82px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.opt-iv-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.opt-iv-wrap.put {
  justify-content: flex-end;
}
.opt-iv-bar-track {
  width: 28px;
  height: 4px;
  background: var(--border-color);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.opt-iv-bar-fill {
  height: 100%;
  transition: width var(--dur-base) ease-out;
}
.opt-iv-bar-fill.call {
  background: var(--color-jade);
  opacity: 0.72;
}
.opt-iv-bar-fill.put {
  background: var(--color-gold);
  opacity: 0.78;
}

/* Delta Visualization Meter Bars (User Requested) */
.delta-cell {
  position: relative;
  min-width: 90px;
}

.delta-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.delta-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border-color);
  position: relative;
  overflow: hidden;
}

.delta-bar-fill {
  height: 100%;
  transition: width var(--dur-base) ease-out;
}

.delta-bar-fill.call {
  background: var(--color-jade);
}

.delta-bar-fill.put {
  background: var(--color-gold);
}

/* Dynamic Unified Greek Bar Meter Fills (User Requested) */
.greek-bar-fill {
  height: 100%;
  transition: width var(--dur-base) ease-out;
}

.greek-bar-fill.gamma {
  background: #40C1AC;
  box-shadow: 0 0 6px rgba(64, 193, 172, 0.4);
}

.greek-bar-fill.theta {
  background: var(--color-gold);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.35);
}

.greek-bar-fill.vega {
  background: #38BDF8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.35);
}

/* Rho Bi-Directional Center Pivot Track (User Requested) */
.rho-pivot-track {
  flex: 1;
  height: 6px;
  background: var(--border-color);
  position: relative;
  overflow: hidden;
}

.rho-pivot-center {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--text-muted);
  z-index: 2;
}

.rho-bar-fill-call {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  background: var(--color-jade);
  transition: width var(--dur-base) ease-out;
}

.rho-bar-fill-put {
  position: absolute;
  right: 50%;
  top: 0;
  bottom: 0;
  background: var(--color-danger);
  transition: width var(--dur-base) ease-out;
}

/* =========================================================================
   MULTI-LEG OPTIONS STRATEGY BUILDER & PAYOFF ANALYZER (User Requested)
   ========================================================================= */
.leg-box-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 1px;
}

.leg-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all var(--dur-fast);
}

.leg-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.leg-btn.btn-buy.active {
  background: var(--color-jade) !important;
  color: var(--text-on-jade) !important;
  border-color: var(--color-jade) !important;
}

.leg-btn.btn-sell.active {
  background: var(--color-gold) !important;
  color: var(--text-on-gold) !important;
  border-color: var(--color-gold) !important;
}

/* Inline Bid↔Ask Limit Price-Improvement Slider on Active B/S Rows */
.opt-spread-slider-cell {
  padding: 6px 10px !important;
  background: var(--bg-subtle) !important;
  vertical-align: middle;
}
.opt-spread-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  width: 100%;
  min-width: 224px;
}
.opt-spread-bound-btn {
  background: none;
  border: 0;
  padding: 1px 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  line-height: 1.1;
  flex-shrink: 0;
}
.opt-spread-bound-btn.bid {
  color: var(--color-gold);
}
.opt-spread-bound-btn.ask {
  color: var(--color-jade);
}
.opt-spread-bound-btn:hover {
  text-decoration: underline;
}
.opt-spread-range-wrap {
  flex: 1 1 96px;
  min-width: 88px;
  height: 22px;
  display: flex;
  align-items: center;
  position: relative;
}
.opt-spread-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border: 1px solid var(--border-medium);
  outline: none;
  cursor: ew-resize;
  margin: 0;
  padding: 0;
}
.opt-spread-range:disabled {
  cursor: default;
  opacity: 0.75;
}
.opt-spread-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 2px;
  height: 6px;
  background: transparent;
  border: 0;
  opacity: 0;
  cursor: ew-resize;
}
.opt-spread-range::-moz-range-thumb {
  width: 2px;
  height: 6px;
  border: 0;
  background: transparent;
  opacity: 0;
  cursor: ew-resize;
}
.opt-thumb-qty {
  position: absolute;
  top: 50%;
  left: calc(var(--thumb-pct, 0.5) * (100% - var(--thumb-w, 28px)) + (var(--thumb-w, 28px) / 2));
  transform: translate(-50%, -50%);
  width: var(--thumb-w, 28px);
  height: 20px;
  padding: 0 3px;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 16px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--color-jade);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  cursor: ew-resize;
  outline: none;
  z-index: 2;
  user-select: none;
  transition: box-shadow 0.12s ease;
}
.opt-thumb-qty.side-sell {
  border-color: var(--color-gold);
}
.opt-thumb-qty:focus {
  cursor: text;
  user-select: text;
  box-shadow: 0 0 0 2px rgba(64, 193, 172, 0.25), 0 2px 6px rgba(0, 0, 0, 0.35);
}
.opt-thumb-qty.side-sell:focus {
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.28), 0 2px 6px rgba(0, 0, 0, 0.35);
}
.opt-spread-limit-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  border: 1px solid currentColor;
  background: var(--bg-card);
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1.2;
}
.opt-spread-limit-pill.buy {
  color: var(--color-jade);
  border-color: var(--color-jade-border);
}
.opt-spread-limit-pill.sell {
  color: var(--color-gold);
  border-color: var(--color-gold-border);
}
.opt-spread-state-tag {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 4px;
  border: 1px solid var(--color-gold-border);
  color: var(--color-gold);
  background: var(--color-gold-dim);
  flex-shrink: 0;
}

/* Floating Strategy Dock Bar */
.strategy-dock-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--header-bg);
  border-top: 2px solid var(--color-jade);
  padding: 12px 24px;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: space-between;
  animation: slideUp 200ms ease-out;
}

.strategy-dock-bar.active {
  display: flex;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.strategy-legs-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.strategy-leg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  font-size: 11px;
}

.strategy-leg-pill.buy {
  border-left: 3px solid var(--color-jade);
}

.strategy-leg-pill.sell {
  border-left: 3px solid var(--color-gold);
}

/* Inline [B | S] Flipper & Editable Contract Quantity inside Dock Leg Pills */
.dock-leg-side-group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 1px;
}
.dock-side-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  width: 17px;
  height: 17px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all var(--dur-fast);
}
.dock-side-btn:hover {
  color: var(--text-primary);
}
.dock-side-btn.buy.active {
  background: var(--color-jade);
  color: var(--text-on-jade);
}
.dock-side-btn.sell.active {
  background: var(--color-gold);
  color: var(--text-on-gold);
}
.dock-leg-qty-input {
  width: 38px;
  height: 20px;
  padding: 0 3px;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  outline: none;
}
.strategy-leg-pill.buy .dock-leg-qty-input:focus {
  border-color: var(--color-jade);
}
.strategy-leg-pill.sell .dock-leg-qty-input:focus {
  border-color: var(--color-gold);
}

/* =========================================================================
   OPTIONS CHAIN HELD POSITION MARKERS & NEUTRAL ATM STYLING
   Green (Jade) = Held Long · Gold = Held Short · Slate/Neutral = ATM
   ========================================================================= */
tr.opt-row-atm {
  background: var(--bg-hover);
}
.opt-atm-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 4px;
  line-height: 1;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-strong, var(--border-medium));
  vertical-align: middle;
}
.opt-pinned-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 3px;
  line-height: 1;
  color: var(--text-muted);
  border: 1px dashed var(--border-medium);
  vertical-align: middle;
}
td.opt-strike-cell {
  text-align: center;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-primary);
  white-space: nowrap;
}
td.opt-strike-cell.is-atm {
  font-weight: 800;
  background: var(--bg-hover);
  border-top: 1.5px solid var(--border-strong, var(--border-medium));
  border-bottom: 1.5px solid var(--border-strong, var(--border-medium));
}
td.opt-strike-cell.pos-long {
  color: var(--color-jade) !important;
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--color-jade), inset -3px 0 0 var(--color-jade);
}
td.opt-strike-cell.pos-short {
  color: var(--color-gold) !important;
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--color-gold), inset -3px 0 0 var(--color-gold);
}
td.opt-strike-cell.pos-dual-long-short {
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--color-jade), inset -3px 0 0 var(--color-gold);
}
td.opt-strike-cell.pos-dual-short-long {
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--color-gold), inset -3px 0 0 var(--color-jade);
}

/* Held Contract Count Box Between Bid & Ask Digits (Zero Column Misalignment) */
.opt-bid-with-pos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.opt-held-qty-badge {
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: var(--bg-card);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.opt-held-qty-badge.long {
  color: var(--color-jade);
  border: 1.5px solid var(--color-jade);
}
.opt-held-qty-badge.short {
  color: var(--color-gold);
  border: 1.5px solid var(--color-gold);
}
.opt-held-qty-badge.long:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(64, 193, 172, 0.22), 0 2px 6px rgba(0, 0, 0, 0.28);
}
.opt-held-qty-badge.short:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.26), 0 2px 6px rgba(0, 0, 0, 0.28);
}

/* Held Position Tag inside Open Inline Bid↔Ask Slider + Expiry Header Badges */
.opt-slider-held-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 5px;
  line-height: 1.1;
  background: var(--bg-card);
  flex-shrink: 0;
  white-space: nowrap;
}
.opt-slider-held-tag.long {
  color: var(--color-jade);
  border: 1px solid var(--color-jade);
}
.opt-slider-held-tag.short {
  color: var(--color-gold);
  border: 1px solid var(--color-gold);
}
.opt-exp-pos-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  line-height: 1.1;
  background: var(--bg-card);
}
.opt-exp-pos-badge.long {
  color: var(--color-jade);
  border: 1px solid var(--color-jade);
}
.opt-exp-pos-badge.short {
  color: var(--color-gold);
  border: 1px solid var(--color-gold);
}

/* =========================================================================
   3D VOLATILITY SURFACE INTERACTIVE STAGE, HUD, NODE POPOVER & DELTA HEDGE BAR
   ========================================================================= */
.vol-surface-stage {
  position: relative;
  width: 100%;
  height: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: height 180ms ease;
}
.vol-surface-stage.expanded {
  height: 680px;
}
.vol-surface-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg-card);
  cursor: grab;
}
.vol-surface-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  pointer-events: none;
}
.vol-hud-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  pointer-events: auto;
}
.vol-hud-btn {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.vol-hud-btn:last-child {
  border-right: 0;
}
.vol-hud-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.vol-hud-btn.active {
  background: var(--color-jade);
  color: var(--text-on-jade);
}
.vol-hud-readout {
  min-width: 46px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-primary);
}

/* Point-and-Click 3D Vertex Ticket Popover */
.vol-node-popover {
  position: absolute;
  z-index: 12;
  width: 304px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong, var(--border-medium));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  padding: 12px;
  font-size: 11px;
}
.vol-node-popover[hidden] {
  display: none !important;
}
.vol-node-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px;
  margin: 8px 0;
}
.vol-node-tab {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  height: 23px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vol-node-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-medium);
}
.vol-node-qty-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-medium);
  background: var(--bg-subtle);
}
.vol-node-qty-step {
  width: 24px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-weight: 800;
  cursor: pointer;
}
.vol-node-qty-step:hover {
  background: var(--bg-hover);
}
.vol-node-qty-input {
  width: 44px;
  height: 26px;
  border: 0;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  outline: none;
}

/* Live Stock Delta-Neutralizer & Dispersion Desk Bar */
.vol-delta-hedge-bar {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.vol-delta-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
}
.vol-delta-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.vol-delta-metric .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
}
.vol-delta-metric .val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.vol-delta-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.vol-hedge-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  user-select: none;
}
.vol-hedge-toggle-pill.active {
  border-color: var(--color-jade);
  box-shadow: inset 3px 0 0 var(--color-jade);
}
.vol-hedge-toggle-pill input[type="checkbox"] {
  accent-color: var(--color-jade);
  margin: 0;
  cursor: pointer;
}

#payoffCanvas {
  width: 100%;
  height: 280px;
  display: block;
}

/* =========================================================================
   BULK POSITIONS TOOLBAR & CHECKBOXES
   ========================================================================= */
.positions-bulk-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  margin-bottom: 12px;
  animation: fadeIn 150ms ease-out;
}

.positions-bulk-bar.active {
  display: flex;
}

.pos-checkbox {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: var(--color-jade);
}

/* =========================================================================
   CSV BATCH TOOLBAR
   ========================================================================= */
.csv-batch-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================================
   FIXED INCOME DESK (CDExplorer Integration)
   ========================================================================= */
.fi-banner {
  background: var(--bg-subtle);
  border: 1px solid var(--color-gold);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fi-banner-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 4px;
}

.fi-banner-desc {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 650px;
}

/* =========================================================================
   ACH & CASH TRANSFERS (MX IAV + Dwolla)
   ========================================================================= */
.transfer-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .transfer-split { grid-template-columns: 1fr; gap: 16px; }
}

.instant-credit-card {
  border: 1px solid var(--color-jade);
  background: var(--color-jade-dim);
  padding: 16px;
  margin-bottom: 16px;
}

/* =========================================================================
   COMPLIANCE ARCHIVE & DOCUMENTS (SEC 17a-4 WORM)
   ========================================================================= */
.worm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

/* =========================================================================
   FOOTER (Strict Mirror of cleveralpha.com Reorganized for Securities BD)
   ========================================================================= */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 56px 24px 32px;
  font-size: 12px;
  color: var(--text-secondary);
}

.footer-inner {
  max-width: 1560px;
  margin: 0 auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 48px;
  margin-bottom: 40px;
}

@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr; }
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  margin: 16px 0;
}

.footer-social-links {
  display: flex;
  gap: 14px;
  align-items: center;
}

.footer-social-link {
  color: var(--text-muted);
  transition: color var(--dur-fast);
}

.footer-social-link:hover {
  color: var(--color-jade);
}

/* Three Entity Blocks (Securities First) */
.footer-entities-section {
  display: flex;
  flex-direction: column;
}

.footer-entities-title {
  font-family: var(--font-accent);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.entity-blocks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .entity-blocks-grid { grid-template-columns: 1fr; }
}

.entity-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.entity-box.featured-bd {
  border-color: var(--color-gold);
}

.entity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.entity-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.entity-badge-tag {
  font-size: 9px;
  padding: 2px 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
}

.entity-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.entity-url {
  font-size: 11px;
  color: var(--color-gold);
  text-decoration: none;
}
.entity-url:hover {
  text-decoration: underline;
}

/* Disclaimers */
.footer-disclosures {
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.7;
}

.disc-heading {
  font-family: var(--font-accent);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 14px;
  margin-bottom: 4px;
  display: block;
}

.disc-text {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.disc-text a {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Bottom Bar */
.footer-bottom-bar {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-muted);
  font-size: 11px;
}

.footer-bottom-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.footer-bottom-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-bottom-nav a:hover {
  color: var(--text-primary);
}

/* =========================================================================
   PERMISSION ACCESS GATE MODAL (2FA)
   ========================================================================= */
.access-gate-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-canvas);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.access-gate-overlay.unlocked {
  display: none !important;
}

.access-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
  position: relative;
}

.gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-gold);
  background: var(--color-gold-dim);
  border: 1px solid var(--color-gold-border);
  padding: 4px 10px;
  margin-bottom: 20px;
}

.gate-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.gate-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.gate-error {
  display: none;
  font-size: 11px;
  color: var(--color-danger);
  background: var(--color-danger-dim);
  border: 1px solid var(--color-danger);
  padding: 8px 12px;
  margin-bottom: 16px;
}

.gate-error.active {
  display: block;
}

.two-fa-inputs-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 6px;
  width: 100%;
}

.two-fa-digit-input {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  height: 52px;
  text-align: center;
  font-family: var(--font-mono), monospace;
  font-size: 22px;
  font-weight: 700;
  padding: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.two-fa-digit-input:focus {
  border-color: var(--color-jade);
  background: var(--bg-hover);
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--modal-bg);
  border: 1px solid var(--border-medium);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 48px rgba(0,0,0,0.25);
  color: var(--text-primary);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

/* =========================================================================
   DERIVATIVES SUITE SUB-NAVIGATION BAR (Option 2 Architecture)
   ========================================================================= */
.derivatives-subnav-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-gutter: stable;
  border-radius: 0 !important;
}

.derivatives-subnav-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-right: 1px solid var(--border-color);
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-fast);
  border-radius: 0 !important;
}

.derivatives-subnav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.derivatives-subnav-btn.active {
  background: var(--bg-hover);
  color: var(--color-jade);
  border-bottom-color: var(--color-jade);
  font-weight: 700;
}

[data-theme="night"] .derivatives-subnav-btn.active {
  color: var(--color-gold);
  border-bottom-color: var(--color-gold);
}

/* Zero-radius layout elements (buttons are the approved pill exception) */
.badge,
.market-countdown-pill,
.theme-toggle-cluster,
.theme-toggle-btn,
.input,
.select,
.modal-card,
.two-fa-digit-input {
  border-radius: 0;
}

/* Ergonomic Options Table Container & Sticky Strike Anchor (Directive 3c) */
.options-table-container {
  overflow-x: auto;
  scrollbar-gutter: stable;
  max-width: 100%;
}

.options-table-container table {
  min-width: 980px;
}


/* =========================================================================
   NEW COMPONENTS — toasts, ticket pre-flight, key/value lists, as-of stamps
   ========================================================================= */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 5000;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px; pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-medium); border-left: 4px solid var(--border-strong);
  padding: 12px 40px 12px 14px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  opacity: 0; transform: translateY(8px); transition: opacity 180ms ease, transform 180ms ease;
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-out { opacity: 0; transform: translateY(8px); }
.toast-title { font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.toast-jade { border-left-color: var(--color-jade); }
.toast-gold { border-left-color: var(--color-gold); }
.toast-danger { border-left-color: var(--color-danger); }
.toast-info { border-left-color: var(--color-info); }
.toast-close {
  position: absolute; top: 6px; right: 8px; background: none; border: none; color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 4px;
}
.toast-close:hover { color: var(--text-primary); }

.ticket-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; }
.order-entry-modal-card .form-group { margin-bottom: 10px; }
.order-entry-modal-card .pill-selector { margin-bottom: 12px; }
.ticket-header .eyebrow { display: block; margin-top: 4px; }
.ticket-symbol-readout { font-size: 12px; color: var(--text-secondary); margin-top: 6px; min-height: 16px; }
.readout-warn { color: var(--color-gold); font-weight: 600; }
.readout-asof { color: var(--text-muted); }
.ticket-note {
  font-size: 11px; color: var(--text-secondary); line-height: 1.5;
  background: var(--bg-subtle); border: 1px solid var(--border-color); padding: 10px 12px; margin-bottom: 14px;
}
.ticket-preflight { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.ticket-preflight:empty { display: none; }
.pf-item { font-size: 12px; line-height: 1.45; padding: 8px 10px; border: 1px solid; }
.pf-block { color: var(--color-danger); border-color: var(--color-danger); background: var(--color-danger-dim); font-weight: 600; }
.pf-warn { color: var(--color-gold); border-color: var(--color-gold-border); background: var(--color-gold-dim); }
.ticket-summary { border-top: 1px solid var(--border-color); padding-top: 12px; margin-bottom: 12px; }
.ticket-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; color: var(--text-secondary); }
.ticket-row.total { color: var(--text-primary); font-weight: 600; border-top: 1px solid var(--border-color); margin-top: 6px; padding-top: 8px; }
.buying-power-notice { font-size: 11px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }

.kv-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.kv-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.kv-list dt { color: var(--text-secondary); }
.kv-list dd { color: var(--text-primary); font-weight: 600; text-align: right; }
.kv-rows { display: flex; flex-direction: column; }
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-color); }
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--text-secondary); }
.kv-val { color: var(--text-primary); font-weight: 600; text-align: right; }

.alloc-track { height: 6px; background: var(--bg-subtle); border: 1px solid var(--border-color); }
.alloc-fill { height: 100%; }

.data-asof { font-size: 10px; color: var(--text-muted); letter-spacing: 0.04em; }
.row-sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.row-problem { font-size: 11px; color: var(--color-danger); margin-top: 3px; font-weight: 500; }
tr.row-rejected td { background: var(--color-danger-dim); }
.empty-row { text-align: center; color: var(--text-muted); padding: 28px 12px !important; font-size: 12px; }
.provider-notice { font-size: 12px; color: var(--text-secondary); padding: 14px; border: 1px dashed var(--border-medium); background: var(--bg-subtle); line-height: 1.5; }
.gate-footnote { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 14px; }
.build-stamp { display: block; margin-top: 4px; font-size: 10px; color: var(--text-muted); font-family: var(--font-mono, monospace); }
.hdr-signout { margin-left: 4px; }
.fix-log { font-family: var(--font-mono, monospace); font-size: 11px; line-height: 1.6; background: var(--bg-subtle); border: 1px solid var(--border-color); padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.fix-log-head { color: var(--color-gold); margin-bottom: 8px; }
.fix-log-foot { font-size: 11px; color: var(--text-muted); margin-top: 10px; }
#marketCountdownDot.pulse { animation: ca-pulse 1.6s ease-in-out infinite; }
@keyframes ca-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }


/* =========================================================================
   OVERVIEW BAND (allocation + account) and TAX LOSS HARVEST
   ========================================================================= */
.overview-band {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 28px;
  margin-bottom: 20px;
  transition: padding 0.16s ease;
}
.overview-band.is-collapsed {
  padding-top: 12px;
  padding-bottom: 12px;
}
.overview-band.is-collapsed .overview-acc-header {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.overview-acc-header {
  cursor: pointer;
}
.overview-acc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--text-primary);
  font: inherit;
}
.overview-acc-chev {
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.18s ease, border-color 0.15s ease;
  flex: none;
}
.overview-acc-toggle:hover .overview-acc-chev {
  border-color: var(--color-gold);
}
.overview-acc-toggle[aria-expanded="true"] .overview-acc-chev {
  transform: rotate(-135deg) translateY(-1px);
  border-color: var(--color-gold);
}
.overview-acc-body[hidden] {
  display: none !important;
}

.portfolio-greeks-bar {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}
.portfolio-greeks-metrics {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: nowrap;
  min-width: 0;
}
.portfolio-greeks-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
@media (max-width: 1120px) {
  .portfolio-greeks-bar { flex-wrap: wrap; }
  .portfolio-greeks-metrics { flex-wrap: wrap; }
}
@media (max-width: 1100px) {
  .overview-band { grid-template-columns: 1fr; }
  .overview-band.is-collapsed { gap: 10px; }
}
.overview-alloc .ticket-note { margin-top: 14px; }

.alloc-stacked {
  display: flex;
  height: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: 12px;
}
.alloc-stacked > span { display: block; height: 100%; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.alloc-legend .alloc-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.alloc-legend .alloc-swatch { width: 10px; height: 10px; flex: none; }
.alloc-legend .alloc-pct { font-weight: 700; color: var(--text-primary); }
.alloc-legend .alloc-val { color: var(--text-secondary); }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.kv-grid > div { border-bottom: 1px solid var(--border-color); padding-bottom: 6px; font-size: 12px; display: flex; justify-content: space-between; gap: 12px; }
.kv-grid dt { color: var(--text-secondary); }
.kv-grid dd { color: var(--text-primary); font-weight: 600; text-align: right; }

/* Harvest control row above the positions table */
.harvest-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  margin-top: 14px;
}
.harvest-bar-facts { font-size: 12px; color: var(--text-secondary); }
.harvest-bar-facts strong { color: var(--text-primary); }
.harvest-bar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.harvest-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.harvest-input-wrap { position: relative; }
.harvest-currency { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-secondary); }
.harvest-input { width: 130px; height: 36px; padding-left: 22px; font-size: 14px; font-weight: 600; text-align: right; }
.harvest-help { font-size: 11px; color: var(--text-muted); margin: 6px 0 12px; }
.th-term { white-space: nowrap; }

/* Harvest modal */
.modal-card-wide { max-width: 1040px; }
.harvest-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}
@media (max-width: 760px) { .harvest-summary { grid-template-columns: repeat(2, 1fr); } }
.harvest-summary .metric-tile { padding: 12px 14px; }
.harvest-summary .metric-value { font-size: 20px; }
.harvest-section-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 6px 0 8px; }
.harvest-table td, .harvest-table th { padding: 9px 10px; }
.harvest-table .lot-id { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-secondary); }
.harvest-others { margin-top: 10px; }
.harvest-others summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); padding: 6px 0; }
.harvest-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.harvest-tally { font-size: 13px; color: var(--text-secondary); }
.harvest-tally strong { color: var(--text-primary); }
.harvest-tally .ok { color: var(--color-jade); font-weight: 700; }
.harvest-tally .over { color: var(--color-danger); font-weight: 700; }
.harvest-note { margin-top: 18px; }
.term-pill { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 7px; border: 1px solid var(--border-color); color: var(--text-secondary); }
.term-pill.long { color: var(--color-jade); border-color: var(--color-jade); }
[data-theme="night"] .term-pill.long { color: var(--color-gold); border-color: var(--color-gold); }

/* ---- Tax lots inside a position row (Build 4) ---- */
.pos-sym-cell { white-space: nowrap; }
.btn-lots-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; color: var(--text-primary); font: inherit; border-radius: 0; box-shadow: none; }
.btn-lots-toggle strong { color: var(--text-primary); }
.btn-lots-toggle .chev { width: 7px; height: 7px; border-right: 2px solid var(--text-secondary); border-bottom: 2px solid var(--text-secondary); transform: rotate(-45deg); transition: transform .15s ease; flex: none; }
.btn-lots-toggle[aria-expanded="true"] .chev { transform: rotate(45deg); border-color: var(--color-gold); }
.btn-lots-toggle:hover .chev { border-color: var(--color-gold); }
.btn-lots-toggle:focus-visible { outline: 2px solid var(--color-gold); outline-offset: 3px; }
.lot-detail-row > td { padding: 0 0 14px 0 !important; background: var(--bg-subtle); border-bottom: 2px solid var(--border-medium); }
.lot-panel { margin: 0 12px 0 52px; border-left: 2px solid var(--color-gold); padding: 10px 14px 6px 16px; }
.lot-panel-empty { font-size: 12px; color: var(--text-muted); padding: 12px 16px; }
.lot-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.lot-panel-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-primary); }
.lot-panel-sub { font-size: 11px; color: var(--text-muted); }
.lot-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.lot-table th { text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.lot-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border-color); color: var(--text-primary); vertical-align: middle; white-space: nowrap; }
.lot-table tbody tr:last-child td { border-bottom: 1px solid var(--border-medium); }
.lot-table tfoot td { font-weight: 600; border-bottom: 0; padding-top: 9px; color: var(--text-secondary); }
.lot-table .lot-id { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-secondary); }
.lot-today { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--color-gold); margin-left: 4px; }
.lot-muted { color: var(--text-muted); }
.lot-split { white-space: nowrap; }
.btn-sell-lot { padding: 3px 10px; font-size: 11px; }
.ticket-lot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; font-size: 11px; line-height: 1.4; color: var(--text-secondary); background: var(--bg-subtle); border-left: 2px solid var(--color-gold); }
.ticket-lot-clear { background: none; border: 0; padding: 0; color: var(--color-gold); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; box-shadow: none; border-radius: 0; flex: none; }
.ticket-lot-clear:hover { color: var(--text-primary); }
/* Shares ↔ dollars entry (Ticket 3b). Conversion reads like a receipt line; the toggle is the same quiet link as "Clear lot". */
.ticket-qty-mode { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; font-size: 11px; line-height: 1.4; color: var(--text-secondary); min-height: 16px; }
.ticket-qty-conv { font-variant-numeric: tabular-nums; }
.ticket-qty-conv.warn { color: var(--color-gold); }

/* ---- Earnings expirations (Build 5) ---- */
#optionsExpiryPicker option.opt-earnings { color: var(--color-gold); font-weight: 700; }
.btn-earnings { white-space: nowrap; }
.btn-earnings.active { background: var(--color-gold); color: var(--text-on-gold); border-color: var(--color-gold); }
.btn-earnings:disabled { opacity: .45; cursor: not-allowed; }
.exp-card-earnings { border-left: 3px solid var(--color-gold) !important; }
.exp-card-month { border-left-color: color-mix(in srgb, var(--color-gold) 55%, transparent) !important; }
.earnings-badge { letter-spacing: 0.04em; }
.earnings-strip { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 18px; margin-bottom: 16px; border: 1px solid var(--border-medium); border-left: 3px solid var(--color-gold); background: var(--bg-subtle); font-size: 12px; color: var(--text-secondary); }
.earnings-strip strong { color: var(--text-primary); }
.earnings-strip strong.gold { color: var(--color-gold); }
.earnings-strip-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.earnings-strip-facts { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.earnings-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-on-gold); background: var(--color-gold); padding: 2px 8px; }
.earnings-dim { color: var(--text-muted); }

/* ---- ETF Research Intelligence (Build 6) ---- */
.pos-actions { white-space: nowrap; }
.pos-actions .btn + .btn { margin-left: 6px; }
.btn-research-pos, .btn-research-ticket { border-color: var(--color-gold); color: var(--text-primary); border-radius: 9999px; }
.btn.btn-research-ticket { margin-top: 6px; padding: 4px 12px; font-size: 11px; font-weight: 700; color: var(--color-gold); border-color: var(--color-gold); border-radius: 9999px; display: inline-flex; align-items: center; transition: background 0.15s ease, color 0.15s ease; }
.btn-research-pos:hover, .btn-research-ticket:hover, .btn.btn-research-ticket:hover { background: var(--color-gold) !important; color: var(--text-on-gold) !important; border-color: var(--color-gold) !important; }

/* Ticker Autocomplete Popover (Popular Alphabetically Similar Tickers) */
.ticker-autocomplete-wrap { position: relative; display: inline-flex; align-items: center; }
.ticker-autocomplete-input {
  padding-left: 26px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ticker-autocomplete-prefix-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.ticker-autocomplete-menu {
  position: fixed;
  min-width: 260px;
  max-height: 285px;
  overflow-y: auto;
  background-color: #FFFFFF !important;
  border: 1px solid var(--border-strong, #94A3B8);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
  z-index: 99999 !important;
  padding: 4px 0;
  opacity: 1 !important;
  backdrop-filter: none;
}
[data-theme="night"] .ticker-autocomplete-menu {
  background-color: #111111 !important;
  border-color: #444444;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.75);
}
.ticker-ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.1s ease;
}
[data-theme="night"] .ticker-ac-item {
  background-color: #111111;
}
.ticker-ac-item:last-child { border-bottom: none; }
.ticker-ac-item:hover, .ticker-ac-item.active {
  background-color: #F1F5F9 !important;
}
[data-theme="night"] .ticker-ac-item:hover,
[data-theme="night"] .ticker-ac-item.active {
  background-color: #1F1F1F !important;
}
.ticker-ac-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
}
.ticker-ac-left svg {
  color: var(--text-muted);
  flex-shrink: 0;
}
.ticker-ac-match { font-weight: 400; color: var(--text-secondary); }
.ticker-ac-bold { font-weight: 800; color: var(--text-primary); }
.ticker-ac-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 135px;
}
.lot-option-action-select { border-radius: 9999px !important; padding: 5px 28px 5px 12px !important; font-size: 11px !important; font-weight: 600 !important; border-color: var(--color-gold) !important; width: auto !important; min-width: 175px; cursor: pointer; }
.research-state { padding: 22px 6px; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.research-state code { font-family: var(--font-mono, monospace); font-size: 12px; }
.research-error { color: var(--color-danger); }
.research-table { width: 100%; table-layout: fixed; }
.research-table th, .research-table td { vertical-align: middle; white-space: normal; overflow-wrap: anywhere; }
.research-table .badge { white-space: nowrap; margin-bottom: 3px; }
.research-table .btn-research-buy { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.research-holding td { background: var(--bg-subtle); }
.research-win { margin-right: 4px; }
.research-lines { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-primary); line-height: 1.55; }
.research-lines li { margin-bottom: 4px; }
.research-src { color: var(--color-jade); font-weight: 700; text-decoration: none; }
.research-considered { margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.research-considered summary { cursor: pointer; font-weight: 600; color: var(--text-primary); }
.research-considered ul, .research-considered ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.5; }
.research-considered a { color: var(--color-jade); }
.research-meta { margin-top: 14px; font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.research-disclosure { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-color); font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-medium); border-top-color: var(--color-gold); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Browser ticketing · /ticket (Build 7) ---- */
body.ticket-mode .system-status-bar .status-pills-center,
body.ticket-mode .header-main,
body.ticket-mode .app-container,
body.ticket-mode .site-footer,
body.ticket-mode .support-drawer,
body.ticket-mode #researchModal,
body.ticket-mode #harvestModal { display: none !important; }
body.ticket-mode { min-width: 0; background: var(--bg-canvas); }
body.ticket-mode .system-status-bar { position: sticky; top: 0; z-index: 5; }
body.ticket-mode .system-status-bar #clockET { display: none; }
body.ticket-mode .system-status-bar .hdr-signout { white-space: nowrap; }
body.ticket-mode #orderEntryModal { position: static; display: flex; justify-content: center; align-items: flex-start; background: transparent; backdrop-filter: none; padding: 16px 12px 24px; }
body.ticket-mode #orderEntryModal .order-entry-modal-card { max-width: 480px; max-height: none; box-shadow: none; }
body.ticket-mode #orderEntryModal .modal-close-btn { top: 16px; right: 16px; }
.ticket-mode-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-color); font-size: 12px; }
.ticket-mode-links { display: flex; gap: 14px; }
.ticket-mode-links .btn-link { background: none; border: 0; padding: 0; color: var(--color-jade); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; box-shadow: none; border-radius: 0; }
.ticket-mode-done { padding: 18px 0 4px; }
.ticket-done-title { font-size: 18px; font-weight: 700; color: var(--color-jade); margin-bottom: 6px; }
.ticket-done-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.ticket-done-actions .btn { text-decoration: none; }

/* ---- Browser ticketing · header button + install panel (Build 9) ---- */
.hdr-ext-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; background: var(--bg-hover); border: 1px solid var(--border-color); color: var(--text-secondary); padding: 4px 10px; font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; margin-right: 8px; border-radius: 0; box-shadow: none; }
.hdr-ext-btn:hover { color: var(--text-primary); border-color: var(--color-gold); }
.hdr-ext-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-medium); display: inline-block; }
.hdr-ext-dot.on { background: var(--color-jade); box-shadow: 0 0 6px var(--color-jade); }
.hdr-ext-dot.off { background: var(--color-gold); }
.ext-status { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); margin: 14px 0; }
.ext-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.ext-actions .btn { text-decoration: none; }
.ext-steps { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-primary); line-height: 1.55; }
.ext-steps li { margin-bottom: 6px; }
.ext-steps code, .ext-status code, #extBody code { font-family: var(--font-mono, monospace); font-size: 12px; background: var(--bg-subtle); padding: 1px 5px; }
body.ticket-mode .hdr-ext-btn { display: none; }
@media (max-width: 900px) { .hdr-ext-btn span:not(.hdr-ext-dot) { display: none; } }
.status-pills-right { flex-wrap: nowrap; }
.status-pills-right .hdr-signout, .status-pills-right .hdr-acct { white-space: nowrap; }
@media (max-width: 1240px) { .hdr-ext-btn span:not(.hdr-ext-dot) { display: none; } .hdr-ext-btn { padding: 5px 7px; } }

.ext-path { padding: 12px 0; border-top: 1px solid var(--border-color); }
.ext-path-primary { border-top: 0; padding-top: 4px; }
.ext-path-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-primary); margin-bottom: 10px; }
.ext-step-no { width: 20px; height: 20px; border-radius: 50%; background: var(--color-jade); color: var(--text-on-jade); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.ext-drag-row { display: flex; align-items: flex-start; gap: 16px; }
.ext-bookmarklet { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 9px 16px; background: var(--color-gold); color: var(--text-on-gold); font-family: var(--font-display); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-decoration: none; border: 1px dashed var(--text-on-gold); outline: 2px solid var(--color-gold); cursor: grab; user-select: none; }
.ext-bookmarklet:active { cursor: grabbing; }
.ext-drag-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.ext-drag-text kbd { font-family: var(--font-mono, monospace); font-size: 11px; background: var(--bg-subtle); border: 1px solid var(--border-medium); padding: 1px 6px; }
.ext-advanced { margin-top: 14px; }
@media (max-width: 560px) { .ext-drag-row { flex-direction: column; } }
.ext-bookmarklet img { width: 18px; height: 18px; display: block; border: 1px solid var(--text-on-gold); }
.ext-inline-link { color: var(--color-jade); font-weight: 600; text-decoration: underline; }
.ext-icon-steps { margin-top: 10px; padding: 10px 12px; background: var(--bg-subtle); border-left: 3px solid var(--color-gold); font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.ext-icon-steps ol { margin: 6px 0 0; padding-left: 18px; }
.ext-icon-steps li { margin-bottom: 3px; }
.ext-icon-steps kbd { font-family: var(--font-mono, monospace); font-size: 11px; background: var(--bg-card); border: 1px solid var(--border-medium); padding: 1px 6px; }
.ext-path-head { justify-content: space-between; }
.ext-path-head .row-sub { margin: 0; }

/* Responsive Status Bar & Mobile/Tablet Viewport Guardrails (Zero Horizontal Overflow) */
@media (max-width: 1180px) {
  .system-status-bar {
    height: auto;
    min-height: 48px;
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .status-pills-center {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 8px;
    padding-top: 4px;
  }
  .status-pills-right {
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }
}
@media (max-width: 768px) {
  .header-main { padding: 4px 12px; }
  .app-container { padding: 14px 12px; overflow-x: hidden; }
  .view-section, .card { max-width: 100%; min-width: 0; overflow-x: auto; }
  .card { padding: 14px; }
  .header-ticker-input { width: 105px; }
  #clockET { display: none; }
}

/* ---- Option Position Greeks, Volatility & Price Economics Accordion ---- */
#positionsTableBody td {
  padding-left: 10px;
  padding-right: 10px;
}
#positionsTableBody .pos-actions .btn {
  padding: 4px 9px;
  font-size: 11px;
}
.btn-opt-greeks-acc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: var(--color-gold);
  color: var(--text-primary);
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.btn-opt-greeks-acc:hover,
.btn-opt-greeks-acc.active {
  background: var(--color-gold);
  color: var(--text-on-gold);
  border-color: var(--color-gold);
}
.btn-opt-greeks-acc .opt-acc-chev {
  width: 6px;
  height: 6px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.18s ease;
  flex: none;
}
.btn-opt-greeks-acc[aria-expanded="true"] .opt-acc-chev {
  transform: rotate(-135deg) translateY(-1px);
}

.opt-econ-accordion-row > td {
  padding: 0 0 14px 0 !important;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--border-medium);
}
@keyframes optAccordionSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.opt-econ-accordion-row.opt-acc-animate-in .opt-econ-panel {
  animation: optAccordionSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.opt-econ-panel {
  margin: 0 14px 0 36px;
  max-width: calc(100% - 50px);
  box-sizing: border-box;
  border-left: 3px solid var(--color-jade);
  padding: 12px 14px 10px 14px;
}
.opt-econ-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.opt-econ-head-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.opt-econ-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.opt-econ-sub {
  font-size: 11px;
  color: var(--text-secondary);
}
.opt-econ-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.opt-econ-nbbo {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.opt-econ-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.opt-greeks-stack-card,
.opt-econ-card {
  min-width: 0;
  box-sizing: border-box;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.opt-section-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 9px;
}
.opt-greeks-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.opt-greek-col {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opt-greek-col-hdr {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 4px;
}
.opt-tier {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.opt-tier-initial {
  border-top: 1px dashed var(--border-medium);
  padding-top: 6px;
}
.opt-tier-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.opt-tier-tag.current { color: var(--color-jade); }
.opt-tier-tag.initial { color: var(--text-muted); }
.opt-tier-current .opt-tier-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
}
.opt-tier-initial .opt-tier-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.25;
}
.opt-tier-sub {
  font-size: 10px;
  color: var(--text-muted);
}
.opt-tier-drift {
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px solid var(--border-color);
  font-size: 10px;
  font-weight: 700;
}

.opt-econ-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.opt-econ-table th {
  text-align: left;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 8px 5px 0;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.opt-econ-table td {
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}
.opt-econ-table tbody tr:last-child td {
  border-bottom: 0;
}
.opt-econ-breakeven {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--border-medium);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-secondary);
}

@media (max-width: 1120px) {
  .opt-econ-panel { margin-left: 16px; }
  .opt-econ-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .opt-greeks-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

