/* =========================================================================
   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. */

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;
  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;
}

.brand-cs-icon {
  width: 28px;
  height: 28px;
  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: #FFFFFF;
}

.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: #FFFFFF;
}

.pill-btn.active-sell {
  background: var(--color-gold);
  color: #FFFFFF;
}

.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: #FFFFFF;
}

#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;
}

/* 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: #FFFFFF !important;
  border-color: var(--color-jade) !important;
}

.leg-btn.btn-sell.active {
  background: var(--color-gold) !important;
  color: #FFFFFF !important;
  border-color: var(--color-gold) !important;
}

/* 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: 16px;
  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);
}

#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;
}

.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;
}
@media (max-width: 1100px) { .overview-band { grid-template-columns: 1fr; } }
.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); }

/* ---- 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); }
.btn-research-pos:hover { background: var(--color-gold); color: var(--text-on-gold); }
.link-btn.btn-research-ticket { margin-left: 8px; font-weight: 700; color: var(--color-gold); text-decoration: underline; text-underline-offset: 3px; }
.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-page, var(--bg-subtle)); }
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-primary); border: 1px solid var(--border-medium); padding: 1px 6px; }
.ext-path-head { justify-content: space-between; }
.ext-path-head .row-sub { margin: 0; }
