/* Cross-lane shell — polish layer on top of terminal-form4 / terminal-inst */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: #e2e8f0;
  min-height: 100vh;
}
.shell {
  margin: 0 auto;
  padding: 1.25rem clamp(1.25rem, 3vw, 2.5rem) 2rem;
}

/* ── Site header (brand + product switch + lane meta) ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.site-header-start {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
  min-width: 0;
}
.site-header-brand {
  flex: 0 0 auto;
}
.site-header .product-switch {
  flex: 0 0 auto;
  margin: 0;
}
.site-header .product-switch--brand {
  flex-shrink: 0;
}
.site-header .product-switch--brand .product-switch-inner {
  border-radius: 8px;
}
.site-header .product-switch--brand .product-switch-btn {
  padding: 0.42rem 0.55rem;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.site-header-end {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}
body.form4-product-mode .site-header-meta--inst {
  display: none;
}
body.inst-product-mode .site-header-meta--form4 {
  display: none;
}

/* ── Shared InsideTerminal brand (Form 4 lane; inst uses frozen inst-brand) ── */
.it-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.it-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
  flex-shrink: 0;
}
.it-brand-name {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(to right, #f8fafc, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.it-lane-badge {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}
.it-meta-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.55);
  flex-shrink: 0;
}

/* ── Form 4 product mode (mirrors inst-depth body treatment) ── */
body.form4-product-mode {
  background-color: #020617;
  background-image: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
  background-attachment: fixed;
}
body.form4-product-mode .site-header .product-switch-inner,
body.inst-product-mode .site-header .product-switch-inner {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
}
.shell.shell--form4 {
  max-width: 1100px;
  border-left: none;
  border-right: none;
  box-shadow: none;
}
.product-switch-inner {
  display: inline-flex;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #334155;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
.product-switch-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 0.9rem;
  border: none;
  background: rgba(10, 15, 24, 0.92);
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.product-switch-btn:hover:not(.is-active) {
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.65);
}
.product-switch-btn + .product-switch-btn {
  border-left: 1px solid #334155;
}
.product-switch-btn.is-active[data-product="form4"] {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.22), rgba(30, 58, 138, 0.35));
  color: #93c5fd;
}
.product-switch-btn.is-active[data-product="inst"] {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(6, 78, 59, 0.42));
  color: #34d399;
}

.lane-root { display: none; }
.lane-root.is-visible { display: block; animation: lane-in 0.2s ease; }
@keyframes lane-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.lane-toggle .lane-btn {
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.lane-toggle .lane-btn:hover:not(.active-briefing) {
  color: #94a3b8;
  border-color: #475569;
}

#focus-workspace,
#f4-chart {
  scroll-margin-top: 5rem;
}

.site-header .site-header-meta {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-header .site-header-meta strong {
  color: #cbd5e1;
  font-weight: 600;
}
.site-header .site-meta-sep {
  color: #64748b;
  opacity: 0.65;
}

.load-error {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: #f87171;
  padding: 1rem;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.15);
  margin: 1rem 0;
}

.empty-state {
  color: #64748b;
  font-size: 0.88rem;
  padding: 1.25rem 1rem;
  text-align: center;
  line-height: 1.45;
}

.is-loading {
  opacity: 0.55;
  pointer-events: none;
}
.shimmer {
  background: linear-gradient(90deg, rgba(30,41,59,0.3) 0%, rgba(51,65,85,0.5) 50%, rgba(30,41,59,0.3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
  min-height: 1rem;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.scanner-caption {
  font-size: 0.78rem;
  color: #64748b;
  margin: -0.35rem 0 0.65rem;
  line-height: 1.45;
}
.scanner-caption strong { color: #94a3b8; }

.scanner-table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #2a3548;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #0c1018;
}
.scanner-table-wrap .term-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}
.scanner-table-wrap .term-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 #2a3548;
}
.scanner-table-wrap .spark-cell {
  width: 72px;
  max-width: 72px;
  padding: 1px 4px !important;
  line-height: 0;
}
.scanner-table-wrap .spark-cell img {
  display: block;
  max-width: 64px;
  height: 18px;
  margin: 0 auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  animation: fade-in 0.18s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-backdrop .modal-sample,
.modal-backdrop .inst-modal-box {
  animation: modal-up 0.22s ease;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
@keyframes modal-up {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  cursor: pointer;
  background: transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.modal-close:hover {
  border-color: #94a3b8;
  color: #e2e8f0;
}


.card-actions { margin-top: 8px; }

.btn-details {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
#lane-form4 .btn-details {
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  background: rgba(16, 185, 129, 0.08);
}
#lane-form4 .btn-details:hover {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.16);
}

.scanner-row-click { cursor: pointer; transition: background 0.12s ease; }
.scanner-row-click.is-selected td {
  background: rgba(96, 165, 250, 0.14) !important;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.focus-lookup {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
}
.focus-lookup select,
.focus-lookup input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  background: #0c1018;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #60a5fa;
  min-width: 120px;
}
.focus-lookup input:focus,
.focus-lookup select:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15);
}
#lane-form4 .focus-hint {
  font-size: var(--f4-type-caption);
  color: var(--f4-dim);
  align-self: center;
}

.preset-chip {
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.preset-chip:hover:not(.active) {
  border-color: #475569;
  color: #cbd5e1;
}
.preset-chip.active { cursor: default; }

/* Shared blue signal strip — Form 4 top signals + 13D/G highlights */
.alist-strip,
#lane-inst #inst-cards.alist-strip {
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.08) 0%, rgba(96, 165, 250, 0.02) 100%);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 8px;
  box-shadow: none;
}

/* Strategy lens strip themes */
.alist-strip--alpha {
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.1) 0%, rgba(52, 211, 153, 0.02) 100%);
  border-color: rgba(52, 211, 153, 0.4);
}
.alist-strip--alpha .alist-title { color: #34d399; }
.alist-strip--institutional {
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.1) 0%, rgba(167, 139, 250, 0.02) 100%);
  border-color: rgba(167, 139, 250, 0.4);
}
.alist-strip--institutional .alist-title { color: #c4b5fd; }
.alist-strip--value {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.1) 0%, rgba(251, 191, 36, 0.02) 100%);
  border-color: rgba(251, 191, 36, 0.4);
}
.alist-strip--value .alist-title { color: #fbbf24; }

.alist-badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #94a3b8;
  margin-right: 4px;
}

#lane-form4 .delayed-tape-banner,
#lane-form4 .premium-teaser {
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.macro-context-card {
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0.5rem 0 0.75rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.75), rgba(10, 15, 24, 0.55));
}
.macro-context-card--calm {
  border-color: rgba(255, 255, 255, 0.1);
}
.macro-context-card--high {
  border-color: rgba(251, 191, 36, 0.5);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(15, 23, 42, 0.65));
}
.macro-context-card--moderate {
  border-color: rgba(96, 165, 250, 0.45);
}
.macro-vol-headline {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.macro-vol-hint { font-size: 0.82rem; color: #94a3b8; line-height: 1.45; }
.macro-schedule {
  margin-top: 10px;
  font-size: 0.78rem;
  color: #94a3b8;
}
.macro-schedule summary {
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  color: #93c5fd;
  margin-bottom: 6px;
}
.macro-schedule-line {
  padding: 5px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  line-height: 1.4;
}

.spark-cell img { height: 22px; width: auto; vertical-align: middle; display: block; }

.review-panel {
  margin-top: 0.25rem;
}
.review-panel .grc-brief-table {
  margin-bottom: 0;
}

#f4-chart-plot {
  width: 100%;
  max-width: 100%;
  min-height: 260px;
  height: 280px;
  position: relative;
  overflow: hidden;
}
#f4-chart-plot .js-plotly-plot,
#f4-chart-plot .plot-container {
  width: 100% !important;
}
#f4-chart-plot .chart-loading {
  color: #64748b;
  font-size: 0.78rem;
  padding: 0.5rem 0;
}
#f4-chart-plot .js-plotly-plot { border-radius: 4px; }
#f4-chart-plot .gtitle { display: none !important; }
/* Plotly hover — dark tooltip (default unified box is white on web) */
#f4-chart-plot .hoverlayer .hovertext path {
  fill: #0f172a !important;
  stroke: #475569 !important;
}
#f4-chart-plot .hoverlayer .hovertext text {
  fill: #f1f5f9 !important;
  font-family: Inter, system-ui, sans-serif !important;
  font-size: 12px !important;
}
#f4-chart-plot .hoverlayer .legendtoggle,
#f4-chart-plot .hoverlayer .nums {
  fill: #f1f5f9 !important;
}

.inst-ticker-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(96, 165, 250, 0.35);
  text-underline-offset: 2px;
}
.inst-ticker-link:hover { color: #93c5fd; }

.tape-expander-head {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.55);
  border: none;
  transition: background 0.15s ease;
}
.tape-expander-head:hover { background: rgba(30, 41, 59, 0.55); }
.tape-expander.is-collapsed .tape-body { display: none; }
.tape-expander.is-collapsed .tape-expander-head { border-bottom: none; }

.nav-btn,
.pager-btn {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nav-btn:hover:not(:disabled),
.pager-btn:hover:not(:disabled) {
  border-color: #60a5fa;
  background: rgba(30, 58, 138, 0.25);
}
.nav-btn:disabled,
.pager-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.ticker-select {
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: #60a5fa;
}

#inst-issuer-panel {
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 8px;
  padding: 0.75rem 0.85rem 1rem;
  margin-bottom: 1rem;
  background: rgba(15, 23, 42, 0.45);
}

.btn-sec {
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-sec:hover {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.1);
}

@media (max-width: 900px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
  }
  .site-header-start,
  .site-header-end {
    justify-content: center;
  }
  .site-header .site-header-meta {
    justify-content: center;
  }
}
