/* APEX Algo UI v3: final shared product interface. Loaded after legacy styles. */
:root {
  --apex-bg: #e9eee9;
  --apex-surface: #f8faf7;
  --apex-surface-2: #f0f4ef;
  --apex-ink: #10201a;
  --apex-muted: #617069;
  --apex-line: #d6ded8;
  --apex-line-strong: #becac2;
  --apex-deep: #061d17;
  --apex-deep-2: #0b3025;
  --apex-green: #0b6b49;
  --apex-mint: #55dda0;
  --apex-copper: #d06a3a;
  --apex-red: #b5352f;
  --apex-amber: #a96912;
  --apex-shadow: 0 18px 50px rgba(7, 30, 23, .08);
  --apex-shadow-soft: 0 8px 24px rgba(7, 30, 23, .055);
  --apex-radius: 18px;
  --apex-mono: "Cascadia Code", "Cascadia Mono", Consolas, monospace;
  --forest: var(--apex-green);
  --forest-2: var(--apex-deep);
  --ink: var(--apex-ink);
  --muted: var(--apex-muted);
  --line: var(--apex-line);
  --panel: var(--apex-surface);
  --clay: var(--apex-copper);
  --good: var(--apex-green);
  --danger: var(--apex-red);
  --amber: var(--apex-amber);
}

html { background: var(--apex-bg); }
body {
  color: var(--apex-ink);
  background:
    linear-gradient(rgba(8, 45, 34, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 45, 34, .025) 1px, transparent 1px),
    radial-gradient(circle at 8% -5%, rgba(55, 156, 109, .16), transparent 30rem),
    var(--apex-bg);
  background-size: 36px 36px, 36px 36px, auto, auto;
  font-family: "Segoe UI Variable Text", "Aptos", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255,255,255,.42), transparent 32%);
  z-index: -1;
}

h1, h2, h3 {
  color: var(--apex-ink);
  font-family: "Segoe UI Variable Display", "Aptos Display", "Segoe UI", sans-serif;
  letter-spacing: -.035em;
}
h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
.eyebrow {
  margin-bottom: 7px;
  color: var(--apex-copper);
  font-family: var(--apex-mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
}
.muted-note, .lede { color: var(--apex-muted); }

.shell {
  width: min(1580px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 20px 0 56px;
}
.panel {
  border: 1px solid rgba(15, 48, 37, .11);
  border-radius: var(--apex-radius);
  background: rgba(250, 252, 249, .94);
  box-shadow: var(--apex-shadow-soft);
  backdrop-filter: blur(12px);
}
.panel:hover { border-color: rgba(15, 78, 56, .18); }

/* Compact command header shared by admin and customer workspaces. */
.shell > .hero {
  min-height: 150px;
  margin: 0 0 18px;
  padding: 26px 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(104, 220, 165, .16);
  border-radius: 22px;
  color: #edf8f2;
  background:
    radial-gradient(circle at 82% 20%, rgba(80, 220, 157, .16), transparent 18rem),
    linear-gradient(112deg, var(--apex-deep) 0%, #0a2b21 58%, #10392b 100%);
  box-shadow: 0 22px 60px rgba(5, 29, 22, .18);
}
.shell > .hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .34;
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(117, 230, 180, .13) 50%, transparent 50.5%),
    linear-gradient(transparent 49.5%, rgba(117, 230, 180, .1) 50%, transparent 50.5%);
  background-size: 38px 38px;
  mask-image: linear-gradient(90deg, transparent 35%, #000 100%);
}
.shell > .hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 110px;
  right: 28%;
  bottom: -48px;
  border: 1px solid rgba(85, 221, 160, .24);
  border-radius: 50%;
  transform: rotate(-13deg);
  background: none;
}
.shell > .hero > div:first-child {
  position: relative;
  z-index: 1;
  max-width: 880px;
  padding: 0;
}
.shell > .hero .eyebrow { color: var(--apex-mint); }
.shell > .hero h1 {
  margin: 0;
  max-width: none;
  color: #f5fbf7;
  font-size: clamp(2rem, 3.5vw, 3.65rem);
  line-height: 1;
  letter-spacing: -.05em;
}
.shell > .hero .lede {
  max-width: 760px;
  margin: 12px 0 0;
  color: rgba(231, 246, 237, .68);
  font-size: .98rem;
  line-height: 1.5;
}
.shell > .hero .hero-card {
  position: relative;
  z-index: 1;
  min-width: 235px;
  padding: 18px 20px;
  align-self: center;
  border: 1px solid rgba(134, 229, 185, .2);
  border-radius: 15px;
  color: #f4fbf7;
  background: rgba(255,255,255,.07);
  box-shadow: inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(12px);
}
.shell > .hero .hero-card strong {
  margin: 5px 0 4px;
  color: #fff;
  font-size: 1.15rem;
}
.shell > .hero .hero-card small,
.shell > .hero .hero-card .metric-label { color: rgba(235, 248, 240, .64); }
.shell > .hero .logout-link {
  margin-top: 12px;
  color: var(--apex-mint);
  font-size: .84rem;
  text-decoration: none;
}

/* Desktop workspace shells. */
.admin-shell,
.portal-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 18px 22px;
  align-items: start;
}
.admin-shell > .hero,
.portal-shell > .hero { grid-column: 1 / -1; }
.admin-shell > .app-nav,
.portal-shell > .portal-section-nav {
  grid-column: 1;
  align-self: start;
  position: sticky;
  top: 18px;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(114, 225, 177, .13);
  border-radius: 17px;
  background: var(--apex-deep);
  box-shadow: 0 16px 42px rgba(5, 30, 22, .16);
}
.admin-shell > .app-nav::before,
.portal-shell > .portal-section-nav::before {
  content: "WORKSPACE";
  padding: 12px 11px 9px;
  color: rgba(228, 244, 235, .42);
  font: 700 .62rem/1 var(--apex-mono);
  letter-spacing: .16em;
}
.app-nav-button,
.portal-section-button {
  position: relative;
  min-height: 46px;
  padding: 0 13px 0 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(237, 248, 241, .68);
  background: transparent;
  font-size: .84rem;
  font-weight: 720;
  text-align: left;
  box-shadow: none;
}
.app-nav-button::before,
.portal-section-button::before {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 17px;
  transform: translateY(-50%);
  color: rgba(101, 226, 168, .62);
  font: 700 .8rem/1 var(--apex-mono);
  text-align: center;
}
.app-nav-button:nth-child(1)::before,
.portal-section-button:nth-child(1)::before { content: "◇"; }
.app-nav-button:nth-child(2)::before,
.portal-section-button:nth-child(2)::before { content: "↗"; }
.app-nav-button:nth-child(3)::before,
.portal-section-button:nth-child(3)::before { content: "⌁"; }
.app-nav-button:nth-child(4)::before,
.portal-section-button:nth-child(4)::before { content: "▦"; }
.app-nav-button:hover,
.portal-section-button:hover { color: #fff; background: rgba(255,255,255,.055); }
.app-nav-button.active,
.portal-section-button.active {
  border-color: rgba(99, 225, 168, .16);
  color: #fff;
  background: linear-gradient(100deg, rgba(28, 124, 83, .75), rgba(22, 85, 62, .58));
  box-shadow: inset 3px 0 var(--apex-mint), 0 8px 18px rgba(0,0,0,.12);
}
.app-nav-button.active::before,
.portal-section-button.active::before { color: var(--apex-mint); }
.admin-shell > .app-page,
.portal-shell > .portal-metrics,
.portal-shell > .portal-section { grid-column: 2; min-width: 0; }
.app-page.active { animation: apex-reveal .28s ease both; }
.portal-section.active { animation: apex-reveal .28s ease both; }
@keyframes apex-reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* Panel hierarchy and controls. */
.control-panel,
.preview-panel,
.grid .panel,
.customer-api-panel,
.signals-panel,
.portal-credentials-panel,
.portal-api-panel { padding: 22px; }
.panel-head {
  min-height: 48px;
  margin: 0 0 18px;
  padding: 0 0 15px;
  border-bottom: 1px solid var(--apex-line);
}
.panel-head h2 { margin: 0; }
label, .choice-group { color: #32423a; font-size: .85rem; font-weight: 680; }
input, textarea, select {
  min-height: 44px;
  border: 1px solid var(--apex-line-strong);
  border-radius: 10px;
  color: var(--apex-ink);
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(7, 30, 23, .035);
}
textarea { padding-top: 11px; }
input:hover, textarea:hover, select:hover { border-color: #aabbb0; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--apex-green);
  box-shadow: 0 0 0 3px rgba(11, 107, 73, .12);
}
input[readonly] { color: #5d6b64; background: #edf1ed; }
button, .link-button {
  min-height: 42px;
  border-radius: 10px;
  font-size: .84rem;
  font-weight: 760;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
button:hover, .link-button:hover { transform: translateY(-1px); }
button:focus-visible,
.link-button:focus-visible,
a:focus-visible { outline: 3px solid rgba(85,221,160,.38); outline-offset: 2px; }
.primary {
  border-color: #0a6344;
  color: #fff;
  background: linear-gradient(135deg, #0d7651, #07543a);
  box-shadow: 0 9px 20px rgba(7, 91, 61, .18);
}
.secondary {
  border-color: var(--apex-line-strong);
  color: #294138;
  background: #fff;
  box-shadow: 0 2px 7px rgba(7, 30, 23, .035);
}
.secondary:hover { border-color: #8fa79a; background: #f9fbf9; }
.danger-button { border-color: rgba(181,53,47,.25); color: var(--apex-red); background: #fffafa; }
.button-row { gap: 8px; }

.grid.two { grid-template-columns: minmax(360px, .76fr) minmax(440px, 1.24fr); gap: 18px; }
.choice-group,
.history-options,
.scheduler-box,
.iframe-generator,
.invoice-panel,
.portal-business-box,
.status-box,
.key-output,
.gateway-credential-card {
  border-color: var(--apex-line);
  border-radius: 13px;
  background: var(--apex-surface-2);
}
.instrument-choice-row { padding: 12px; border: 1px solid var(--apex-line); background: #f5f7f4; }
.pill-check {
  min-height: 35px;
  border: 1px solid var(--apex-line);
  border-radius: 8px;
  color: #43534b;
  background: #fff;
  font-family: var(--apex-mono);
  font-size: .74rem;
}
.pill-check:has(input:checked) {
  border-color: rgba(11, 107, 73, .35);
  color: var(--apex-green);
  background: #e7f5ed;
}
.checkline { border-radius: 10px; }
.checkline input[type="checkbox"],
.pill-check input[type="checkbox"] { accent-color: var(--apex-green); }
.status-box, .key-output { color: #52625a; box-shadow: none; }
.log-box { border-radius: 11px; color: #bde9d4; background: #081f18; }
.preview-frame { min-height: 660px; border: 1px solid var(--apex-line); border-radius: 13px; background: #f7f9f6; box-shadow: none; }

/* Data feeds and cards. */
.analysis-list,
.signals-list,
.customer-keys-list { gap: 9px; }
.signal-editor {
  border-color: var(--apex-line);
  border-radius: 12px;
  background: var(--apex-surface-2);
}
.analysis-card,
.signal-card,
.customer-key-card {
  border: 1px solid var(--apex-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}
.analysis-card:hover,
.signal-card:hover,
.customer-key-card:hover { border-color: #a9bdb0; background: #fbfdfb; box-shadow: 0 7px 20px rgba(7,30,23,.05); }
.analysis-card.active {
  border-color: rgba(11,107,73,.38);
  background: linear-gradient(90deg, #e9f7ef, #fff 55%);
  box-shadow: inset 3px 0 var(--apex-green);
}
.card-symbol, .signal-card strong, .customer-key-card strong { color: var(--apex-ink); }
.badge { border-radius: 7px; font-family: var(--apex-mono); font-size: .69rem; letter-spacing: .03em; }
.badge.bullish { color: #087246; background: #e4f6eb; }
.badge.bearish { color: #a52e29; background: #fae9e7; }
.badge.neutral { color: #5d6963; background: #edf1ee; }
.signal-levels span,
.signal-type-summary span,
.signal-embed-details span { border-color: var(--apex-line); border-radius: 8px; background: #eef2ee; }

/* Portal metrics and customer pages. */
.portal-shell > .portal-metrics {
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
  margin: 0;
}
.portal-shell > .portal-section { grid-row: 3; }
.portal-shell > .portal-section-nav { grid-row: 2 / span 2; }
.portal-metric-card {
  min-height: 116px;
  padding: 17px 18px;
  border-radius: 14px;
  background: rgba(250,252,249,.96);
  box-shadow: var(--apex-shadow-soft);
}
.portal-metric-card::after { display: none; }
.portal-metric-card span {
  color: #76827c;
  font-family: var(--apex-mono);
  font-size: .63rem;
  letter-spacing: .09em;
}
.portal-metric-card strong { color: var(--apex-deep); font-size: 1.3rem; }
.clickable-metric:hover { transform: translateY(-2px); border-color: rgba(11,107,73,.28); }
.portal-grid { margin-top: 18px; }

.portal-api-panel { margin-top: 16px; }

/* Billing and integration panels. */

.customer-api-panel > .key-output { margin-top: 14px; }
.compact-form, .customer-key-form { gap: 10px; }
.customer-key-secret { border-radius: 7px; background: #edf1ee; }

.portal-invoice-card { grid-template-columns: minmax(0,1fr) auto; align-items: center; }
.portal-invoice-total { display: grid; gap: 8px; justify-items: end; }
.portal-invoice-total > strong { color: var(--apex-green); font-family: var(--apex-mono); }
.invoice-panel { margin-top: 14px; padding: 18px; }
.payment-settings-panel { background: #f6f9f6; }
.payment-switches,
.payment-general-grid,
.gateway-credentials-grid,
.payment-plan-grid { gap: 12px; }
.gateway-credential-card { padding: 16px; background: #fff; }
.gateway-credential-card legend { color: #244138; font-family: var(--apex-mono); font-size: .75rem; }
.payment-order-card.provisioned,
.payment-order-card.approved { border-left: 3px solid var(--apex-green); }
.payment-order-card.review { border-left: 3px solid var(--apex-amber); }
.payment-order-card.failed,
.payment-order-card.refunded { border-left: 3px solid var(--apex-red); }

/* Authentication page. */
.login-shell {
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
  gap: 0;
  padding: 0;
  place-items: stretch;
  background: var(--apex-deep);
}
.login-intro {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 6vw, 84px);
  overflow: hidden;
  color: #f0faf4;
  background:
    radial-gradient(circle at 20% 10%, rgba(77, 220, 155, .17), transparent 25rem),
    linear-gradient(145deg, #061d17, #0b3025);
}
.login-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .28;
  background:
    linear-gradient(90deg, rgba(116,224,176,.12) 1px, transparent 1px),
    linear-gradient(rgba(116,224,176,.1) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(130deg, #000, transparent 70%);
}
.login-brand,
.commerce-brand {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 1.12rem;
  font-weight: 820;
  letter-spacing: -.03em;
  text-decoration: none;
}
.login-brand span, .commerce-brand span { color: var(--apex-mint); }
.login-intro-copy { position: relative; z-index: 1; max-width: 690px; }
.login-intro-copy .eyebrow { color: var(--apex-mint); }
.login-intro h1 {
  color: #f5fcf8;
  font-size: clamp(3.2rem, 7vw, 7.2rem);
  line-height: .88;
  letter-spacing: -.07em;
}
.login-intro p { max-width: 580px; color: rgba(231,246,237,.68); font-size: 1rem; line-height: 1.6; }
.login-capabilities { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.login-capabilities span { padding: 7px 10px; border: 1px solid rgba(134,229,185,.18); border-radius: 999px; color: rgba(235,248,240,.72); font: 650 .68rem/1 var(--apex-mono); }
.login-form-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background: #edf1ed;
}
.login-card {
  width: min(440px, 100%);
  padding: 34px;
  gap: 18px;
  border-radius: 18px;
  background: #fbfcfa;
  box-shadow: 0 28px 80px rgba(4,27,20,.16);
}
.login-card::before { display: none; }
.login-card h1 { color: var(--apex-ink); font-size: 2.5rem; }
.login-card .primary { width: 100%; }
.login-plans-link { color: var(--apex-green); font-size: .84rem; text-decoration: none; }

/* Public pricing and checkout. */
.commerce-body {
  min-height: 100vh;
  color: #edf8f2;
  background:
    radial-gradient(circle at 86% 5%, rgba(72,214,151,.13), transparent 28rem),
    linear-gradient(150deg, #061b15 0%, #0a2c22 44%, #0d382a 100%);
}
.commerce-body::before {
  background:
    linear-gradient(90deg, rgba(113,222,174,.055) 1px, transparent 1px),
    linear-gradient(rgba(113,222,174,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 1;
}
.commerce-shell { width: min(1180px, calc(100vw - 36px)); padding: 20px 0 50px; }
.commerce-header {
  min-height: 64px;
  padding: 10px 14px 10px 20px;
  border: 1px solid rgba(138,229,188,.15);
  border-radius: 15px;
  background: rgba(4,24,18,.72);
  box-shadow: none;
  backdrop-filter: blur(18px);
}
.commerce-header .secondary { border-color: rgba(159,230,198,.18); color: #f2faf5; background: rgba(255,255,255,.055); }
.commerce-hero {
  position: relative;
  max-width: 880px;
  padding: 86px 16px 52px;
}
.commerce-hero::after {
  content: "LIVE MARKET CONTEXT / SIGNAL DELIVERY / BUSINESS API";
  display: block;
  margin-top: 38px;
  color: rgba(117,225,177,.45);
  font: 650 .64rem/1.5 var(--apex-mono);
  letter-spacing: .14em;
}
.commerce-proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  margin: 0 0 26px;
  border: 1px solid rgba(142,225,189,.14);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.035);
}
.commerce-proof > div { display: grid; gap: 5px; padding: 17px 19px; border-right: 1px solid rgba(142,225,189,.12); }
.commerce-proof > div:last-child { border-right: 0; }
.commerce-proof strong { color: #edf9f2; font-size: .86rem; }
.commerce-proof span { color: rgba(226,244,234,.52); font: 600 .67rem/1.4 var(--apex-mono); }
.commerce-hero .eyebrow, .checkout-copy .eyebrow { color: var(--apex-mint); }
.commerce-hero h1,
.checkout-copy h1 {
  max-width: 850px;
  color: #f6fcf8;
  font-size: clamp(3.5rem, 7.5vw, 7.3rem);
  line-height: .88;
  letter-spacing: -.075em;
}
.commerce-hero > p:last-of-type,
.checkout-copy > p { max-width: 660px; color: rgba(233,247,239,.66); line-height: 1.65; }
.pricing-grid { gap: 14px; margin-top: 8px; }
.price-card {
  gap: 15px;
  padding: 30px;
  border: 1px solid rgba(180,215,198,.16);
  border-radius: 17px;
  color: var(--apex-ink);
  background: #f8faf7;
  box-shadow: 0 24px 65px rgba(0,0,0,.18);
}
.price-card.featured { border: 1px solid rgba(85,221,160,.62); transform: none; box-shadow: inset 0 4px var(--apex-green), 0 24px 65px rgba(0,0,0,.2); }
.price-card h2 { font-size: 1.65rem; }
.price-card p { color: var(--apex-muted); }
.price-card ul { min-height: 118px; color: #3c4d45; }
.price { color: var(--apex-deep); font-size: clamp(3rem, 5vw, 4.5rem); }
.commerce-footer { display: flex; justify-content: space-between; gap: 20px; color: rgba(225,242,232,.45); }
.checkout-layout { gap: clamp(28px, 6vw, 72px); padding: 78px 16px 40px; }
.checkout-copy h1 { font-size: clamp(3.3rem, 6.4vw, 6.2rem); }
.order-summary { border-color: rgba(146,226,189,.18); border-radius: 13px; background: rgba(255,255,255,.055); }
.order-summary span { color: var(--apex-mint); }
.trust-row span { border-color: rgba(146,226,189,.18); color: rgba(232,247,238,.64); }
.checkout-steps { display: grid; gap: 0; margin: 28px 0; padding: 0; list-style: none; }
.checkout-steps li { display: flex; align-items: center; gap: 11px; min-height: 42px; border-left: 1px solid rgba(122,224,178,.17); color: rgba(230,245,236,.45); font-size: .82rem; }
.checkout-steps li span { width: 38px; margin-left: -19px; color: rgba(111,225,174,.58); font: 700 .65rem/1 var(--apex-mono); text-align: center; background: #09281f; }
.checkout-steps li.active { color: #f2faf5; }
.checkout-steps li.active span { color: var(--apex-mint); }
.checkout-card {
  min-height: 500px;
  padding: 28px;
  border: 1px solid rgba(172,213,193,.18);
  border-radius: 18px;
  background: #f8faf7;
  box-shadow: 0 30px 90px rgba(0,0,0,.25);
}
.commerce-status { color: var(--apex-red); }

/* Embeddable analysis remains intentionally content-first. */
.embed-body,
.signal-embed-body { background: #e8ede8; }
.embed-shell,
.signal-embed-shell { padding-top: 14px; }
.embed-body,
.signal-embed-body { width: 100%; max-width: 100%; overflow-x: hidden; overscroll-behavior: contain; }
html.embed-document {
  width: 100%;
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto !important;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}
html.embed-document body.embed-body {
  min-height: 100vh;
  height: auto;
  overflow-x: hidden;
  overflow-y: visible !important;
  overscroll-behavior-y: auto;
}
html.embed-document,
html.embed-document body.embed-body,
.embed-body .embed-shell,
.embed-body .chart-layout { touch-action: pan-y; }
.embed-body .chart-header,
.embed-body .mobile-orientation-hint,
.embed-body .side-panel,
.embed-body .side-panel * { touch-action: pan-y; }
.embed-shell,
.signal-embed-shell { width: min(100% - 20px, 1640px); max-width: 100%; }
.embed-body .chart-layout {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
}
.embed-body .side-panel {
  width: 100%;
  scroll-margin-top: 10px;
}
@media (min-width: 1100px) {
  .embed-body[data-analysis-engine="levels"] .chart-layout {
    grid-template-columns: minmax(0, 1fr) minmax(310px, 350px);
    align-items: start;
  }
}
@media (min-width: 1380px) {
  .embed-body[data-analysis-engine="sk"] .chart-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 325px);
    align-items: start;
  }
}
.embed-body[data-analysis-engine="levels"] .level-list > div {
  padding-block: 5px;
  gap: 8px;
}
.embed-body[data-analysis-engine="levels"] .level-list dd { text-align: right; }
html[data-theme="dark"] .embed-body[data-analysis-engine] .bias-badge.neutral {
  background: #193329;
  color: #e9f4ee;
}
.chart-stage,
.side-panel,
.signal-chart-card { border-radius: 14px; background: #fafbf8; box-shadow: var(--apex-shadow-soft); }
.chart-stage,
.side-panel { min-width: 0; overflow: hidden; }
.chart-header { padding-bottom: 13px; border-bottom: 1px solid var(--apex-line); }
.chart-header > * { min-width: 0; }
.chart-actions { justify-content: flex-end; }
.chart-header h1 { font-size: clamp(1.55rem, 3vw, 2.6rem); }
.bias-badge,
.signal-embed-badge { border-radius: 9px; font-family: var(--apex-mono); }
#analysisCanvas,
#signalCanvas {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  overscroll-behavior: contain;
}
.embed-body #analysisCanvas { touch-action: none; }

/* Responsive behavior. */
@media (max-width: 1180px) {
  .portal-shell > .portal-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }

}

@media (max-width: 980px) {
  .shell { width: min(100vw - 24px, 1580px); padding-top: 12px; }
  .admin-shell,
  .portal-shell { display: block; }
  .admin-shell > .app-nav,
  .portal-shell > .portal-section-nav {
    position: sticky;
    top: 6px;
    z-index: 30;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    margin: 0 0 14px;
    overflow-x: auto;
    border-radius: 13px;
  }
  .admin-shell > .app-nav::before,
  .portal-shell > .portal-section-nav::before { display: none; }
  .app-nav-button,
  .portal-section-button { flex: 0 0 auto; min-height: 42px; padding: 0 13px; text-align: center; }
  .app-nav-button::before,
  .portal-section-button::before { display: none; }
  .portal-metrics { margin-bottom: 14px !important; }
  .portal-grid { margin-top: 14px; }
  .grid.two { grid-template-columns: 1fr; }
  .preview-frame { min-height: 600px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 420px; padding: 42px 28px; }
  .login-intro h1 { max-width: 680px; font-size: clamp(3.2rem, 10vw, 6rem); }
  .login-form-wrap { min-height: auto; padding: 50px 24px; }

  .shell > .hero { grid-template-columns: 1fr; }
  .shell > .hero .hero-card { width: 100%; min-width: 0; }
}

@media (max-width: 720px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .shell > .hero { min-height: 0; padding: 22px; gap: 18px; border-radius: 16px; }
  .shell > .hero h1 { font-size: 2.15rem; }
  .shell > .hero .lede { font-size: .9rem; }
  .portal-shell > .portal-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .portal-metric-card { min-height: 104px; padding: 14px; }
  .portal-metric-card strong { font-size: 1.08rem; }
  .control-panel,
  .preview-panel,
  .grid .panel,
  .customer-api-panel,
  .signals-panel,
  .portal-credentials-panel,
  .portal-api-panel { padding: 16px; }
  .panel-head { align-items: flex-start; }
  .gateway-credentials-grid,
  .payment-plan-grid,
  .payment-switches,
  .payment-general-grid,
  .invoice-form-grid { grid-template-columns: 1fr; }
  .pricing-grid, .checkout-layout { grid-template-columns: 1fr; }
  .commerce-proof { grid-template-columns: 1fr; }
  .commerce-proof > div { border-right: 0; border-bottom: 1px solid rgba(142,225,189,.12); }
  .commerce-proof > div:last-child { border-bottom: 0; }
  .commerce-footer { flex-direction: column; text-align: left; }
  .commerce-shell { width: min(100vw - 20px, 1180px); padding-top: 10px; }
  .commerce-header { min-height: 58px; }
  .commerce-hero { padding: 58px 8px 36px; }
  .commerce-hero h1 { font-size: clamp(3.1rem, 17vw, 5rem); }
  .commerce-hero::after { margin-top: 28px; }
  .price-card { padding: 23px; }
  .checkout-layout { padding: 50px 8px 30px; }
  .checkout-copy h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
  .checkout-card { padding: 20px; }
  .login-shell,
  .login-intro,
  .login-form-wrap,
  .login-card,
  .login-intro-copy { width: 100%; min-width: 0; max-width: 100%; }
  .login-intro { min-height: 390px; padding: 28px; }
  .login-intro h1 { max-width: 100%; font-size: clamp(2.75rem, 14vw, 4.6rem); overflow-wrap: normal; }
  .login-intro-copy .eyebrow { max-width: 100%; line-height: 1.55; }
  .login-intro p { max-width: 100%; }
  .login-capabilities { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .login-capabilities span { flex: 0 0 auto; }
  .login-form-wrap { padding: 34px 14px; }
  .login-card { padding: 25px; }
  .portal-invoice-card { grid-template-columns: 1fr; }
  .portal-invoice-total { justify-items: start; }

  .embed-shell,
  .signal-embed-shell { width: 100%; padding: 6px; }
  .embed-body .chart-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .embed-body .chart-stage,
  .embed-body .side-panel,
  .signal-chart-card { width: 100%; min-width: 0; padding: 12px; overflow: hidden; }
  .embed-body .chart-header { align-items: flex-start; flex-direction: column; }
  .embed-body .chart-actions { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 3px; }
  .embed-body .chart-actions button { flex: 0 0 auto; }
  .embed-body #analysisCanvas,
  .signal-embed-body #signalCanvas {
    width: 100%;
    max-width: 100%;
    height: clamp(430px, 65vh, 620px);
    touch-action: none;
  }
}

@media (orientation: landscape) and (max-height: 760px) {
  .embed-body #analysisCanvas {
    height: clamp(400px, 76vh, 620px);
  }
  .embed-body .chart-stage,
  .embed-body .side-panel { padding: 10px; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .embed-body #analysisCanvas {
    height: clamp(450px, 62vh, 540px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Brand assets and persistent theme control. */
apex-logo { display: inline-block; vertical-align: middle; }
.apex-logo {
  position: relative;
  width: 190px;
  height: 54px;
  overflow: hidden;
  contain: layout paint;
  flex: 0 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}
.apex-logo-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  transform: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}
.apex-logo-stacked { width: 180px; height: 180px; }
.apex-logo-stacked .apex-logo-image { width: 100%; }
.apex-logo-image-dark { display: block; }
.apex-logo-image-light { display: none; }
html[data-theme="light"] .apex-logo-image-dark { display: none; }
html[data-theme="light"] .apex-logo-image-light { display: block; }
.workspace-logo { width: 150px; height: 38px; margin: 0 0 8px; }
.workspace-logo .apex-logo-image { width: 100%; }
.embed-logo { width: 122px; height: 30px; margin: 0 0 5px; }
.embed-logo .apex-logo-image { width: 100%; }
.login-brand { width: 190px; height: 54px; }
.commerce-brand { width: 170px; height: 48px; }
.commerce-brand .apex-logo { width: 170px; height: 48px; }
.commerce-brand .apex-logo-image { width: 100%; }

html[data-theme-switching],
html[data-theme-switching] *,
html[data-theme-switching] *::before,
html[data-theme-switching] *::after {
  transition: none !important;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--apex-line-strong);
  border-radius: 9px;
  color: var(--apex-muted);
  background: var(--apex-surface);
  box-shadow: none;
  font: 680 .72rem/1 var(--apex-mono);
  white-space: nowrap;
}
.theme-toggle-icon { color: var(--apex-copper); font-size: .95rem; }
.shell > .hero .theme-toggle {
  width: 100%;
  margin-top: 12px;
  border-color: rgba(139,226,188,.18);
  color: rgba(237,248,241,.72);
  background: rgba(255,255,255,.05);
}
.commerce-header .secondary { margin-left: auto; }
.commerce-header .theme-toggle {
  margin-left: 7px;
  border-color: rgba(139,226,188,.18);
  color: rgba(237,248,241,.72);
  background: rgba(255,255,255,.05);
}
.login-form-wrap { position: relative; }
.login-form-wrap > .theme-toggle { position: absolute; top: 22px; right: 22px; }
.chart-actions .theme-toggle { min-height: 34px; }
.signal-chart-card .chart-header > .theme-toggle { margin-left: auto; }

/* Dark is the default product theme. */
html[data-theme="dark"] {
  --apex-bg: #071510;
  --apex-surface: #0f231c;
  --apex-surface-2: #112920;
  --apex-ink: #edf6f0;
  --apex-muted: #98aba1;
  --apex-line: #263d34;
  --apex-line-strong: #395348;
  --apex-shadow: 0 18px 50px rgba(0, 0, 0, .24);
  --apex-shadow-soft: 0 8px 24px rgba(0, 0, 0, .18);
  --good: #61dca3;
  --danger: #ff9189;
  --amber: #efb85e;
  --clay: #ef8b59;
  color-scheme: dark;
}
html[data-theme="dark"],
html[data-theme="dark"] body { background-color: var(--apex-bg); }
html[data-theme="dark"] body {
  color: var(--apex-ink);
  background:
    linear-gradient(rgba(95, 190, 143, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 190, 143, .025) 1px, transparent 1px),
    radial-gradient(circle at 8% -5%, rgba(28, 119, 80, .18), transparent 31rem),
    var(--apex-bg);
  background-size: 36px 36px, 36px 36px, auto, auto;
}
html[data-theme="dark"] body::before { background: linear-gradient(120deg, rgba(76,177,130,.045), transparent 34%); }
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3 { color: var(--apex-ink); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .portal-metric-card,
html[data-theme="dark"] .price-card,
html[data-theme="dark"] .checkout-card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .chart-stage,
html[data-theme="dark"] .side-panel,
html[data-theme="dark"] .signal-chart-card {
  border-color: var(--apex-line);
  color: var(--apex-ink);
  background: rgba(15, 35, 28, .96);
  box-shadow: var(--apex-shadow-soft);
}
html[data-theme="dark"] .panel:hover { border-color: #345346; }
html[data-theme="dark"] label,
html[data-theme="dark"] .choice-group { color: #cbd8d1; }
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  border-color: var(--apex-line-strong);
  color: #edf6f0;
  background: #0b1d17;
  color-scheme: dark;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #71877c; }
html[data-theme="dark"] input[readonly] { color: #9bada4; background: #10231c; }
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .theme-toggle {
  border-color: var(--apex-line-strong);
  color: #cbdad2;
  background: #132920;
}
html[data-theme="dark"] .secondary:hover { border-color: #4c6a5c; background: #173329; }
html[data-theme="dark"] .danger-button { border-color: rgba(210,83,75,.3); color: #f08b84; background: #291815; }
html[data-theme="dark"] .choice-group,
html[data-theme="dark"] .history-options,
html[data-theme="dark"] .scheduler-box,
html[data-theme="dark"] .iframe-generator,
html[data-theme="dark"] .invoice-panel,
html[data-theme="dark"] .portal-business-box,
html[data-theme="dark"] .status-box,
html[data-theme="dark"] .key-output,
html[data-theme="dark"] .gateway-credential-card,
html[data-theme="dark"] .payment-settings-panel { border-color: var(--apex-line); background: #10261e; }
html[data-theme="dark"] .gateway-credential-card,
html[data-theme="dark"] .analysis-card,
html[data-theme="dark"] .signal-card,
html[data-theme="dark"] .customer-key-card { border-color: var(--apex-line); background: #0b1e17; }
html[data-theme="dark"] .analysis-card:hover,
html[data-theme="dark"] .signal-card:hover,
html[data-theme="dark"] .customer-key-card:hover { border-color: #3b5a4c; background: #10271f; }
html[data-theme="dark"] .analysis-card.active { border-color: #277552; background: linear-gradient(90deg, #123c2c, #0d241b 58%); }
html[data-theme="dark"] .card-symbol,
html[data-theme="dark"] .signal-card strong,
html[data-theme="dark"] .customer-key-card strong { color: #edf6f0; }
html[data-theme="dark"] .instrument-choice-row { border-color: var(--apex-line); background: #0c1f18; }
html[data-theme="dark"] .pill-check { border-color: var(--apex-line); color: #aebfb6; background: #13271f; }
html[data-theme="dark"] .pill-check:has(input:checked) { border-color: #2d7656; color: #6ae0a9; background: #123a2b; }
html[data-theme="dark"] .signal-levels span,
html[data-theme="dark"] .signal-type-summary span,
html[data-theme="dark"] .signal-embed-details span,
html[data-theme="dark"] .customer-key-secret { border-color: var(--apex-line); color: #c4d6cd; background: #142a21; }
html[data-theme="dark"] .preview-frame { border-color: var(--apex-line); background: #081711; }
html[data-theme="dark"] .portal-metric-card strong,
html[data-theme="dark"] .price,
html[data-theme="dark"] .price-card h2 { color: #f0f8f3; }
html[data-theme="dark"] .price-card p,
html[data-theme="dark"] .price-card ul { color: #a6b8ae; }

html[data-theme="dark"] .login-form-wrap { background: #081711; }
html[data-theme="dark"] .login-card h1 { color: #f1f8f4; }
html[data-theme="dark"] .login-plans-link { color: var(--apex-mint); }
html[data-theme="dark"] .embed-body,
html[data-theme="dark"] .signal-embed-body { background: #071510; }
html[data-theme="dark"] .mobile-orientation-hint {
  border-color: rgba(113, 218, 166, 0.24);
  color: #d8e9df;
  background: #10271f;
}
html[data-theme="dark"] .mobile-orientation-hint .secondary {
  border-color: rgba(113, 218, 166, 0.28);
  color: #eef8f2;
  background: #174b38;
}

/* Keep every workspace surface in the selected theme. */
html[data-theme="dark"] .admin-shell > .app-nav,
html[data-theme="dark"] .portal-shell > .portal-section-nav {
  border-color: #29483b;
  background: #091c15;
}
html[data-theme="dark"] .empty,
html[data-theme="dark"] .rich-empty,
html[data-theme="dark"] .feed-filters,
html[data-theme="dark"] .portal-feed-filters,
html[data-theme="dark"] .signal-type-summary { color: var(--apex-muted); }
html[data-theme="dark"] option { color: #edf6f0; background: #0b1d17; }

/* Dark-theme coverage for nested and dynamically generated UI. */
html[data-theme="dark"] .app-nav-button,
html[data-theme="dark"] .portal-section-button {
  color: #aebfb6;
  background: transparent;
}
html[data-theme="dark"] .app-nav-button:hover,
html[data-theme="dark"] .portal-section-button:hover { color: #eef7f2; background: #142c23; }
html[data-theme="dark"] .app-nav-button.active,
html[data-theme="dark"] .portal-section-button.active {
  border-color: #347a5c;
  color: #f4fbf7;
  background: #174c38;
}
html[data-theme="dark"] .panel-head { border-color: var(--apex-line); }
html[data-theme="dark"] .credential-form,
html[data-theme="dark"] .context-section { border-color: var(--apex-line); }
html[data-theme="dark"] .rich-empty,
html[data-theme="dark"] .signal-editor,
html[data-theme="dark"] .invoice-card,
html[data-theme="dark"] .payment-order-card {
  border-color: var(--apex-line);
  color: var(--apex-ink);
  background: #10261e;
}

html[data-theme="dark"] .key-output code,
html[data-theme="dark"] .signal-type-summary strong { color: #d9eee3; }

html[data-theme="dark"] .gateway-credential-card legend { color: #d9eee3; }
html[data-theme="dark"] .brand-logo-preview-box img {
  border-color: var(--apex-line);
  background: #0a1d16;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}
html[data-theme="dark"] .signal-mini-button {
  border: 1px solid var(--apex-line-strong);
  color: #c9d9d1;
  background: #152d24;
}
html[data-theme="dark"] .signal-mini-button:hover { border-color: #4b6b5c; background: #1a382c; }
html[data-theme="dark"] .signal-mini-button.danger-button {
  border-color: rgba(255, 129, 121, .35);
  color: #ff9c95;
  background: #321c19;
}
html[data-theme="dark"] .signal-mini-button.danger-button:hover { background: #43231f; }
html[data-theme="dark"] .signal-card.win { border-left-color: #61dca3; background: rgba(19, 70, 50, .42); }
html[data-theme="dark"] .signal-card.loss { border-left-color: #ff8179; background: rgba(82, 31, 29, .42); }
html[data-theme="dark"] .signal-card.breakeven { border-left-color: #93a79d; background: rgba(45, 61, 53, .38); }
html[data-theme="dark"] .signal-card em.active,
html[data-theme="dark"] .signal-embed-badge.win { color: #78e4b1; background: rgba(63, 190, 131, .15); }
html[data-theme="dark"] .signal-card em.closed { color: #91baff; background: rgba(77, 126, 218, .17); }
html[data-theme="dark"] .signal-card em.danger,
html[data-theme="dark"] .signal-embed-badge.loss { color: #ff9c95; background: rgba(218, 72, 64, .16); }
html[data-theme="dark"] .badge.bullish { color: #69dfa8; background: rgba(55, 185, 126, .15); }
html[data-theme="dark"] .badge.bearish { color: #ff9891; background: rgba(213, 71, 63, .16); }
html[data-theme="dark"] .badge.neutral { color: #bdccc4; background: rgba(145, 166, 155, .14); }
html[data-theme="dark"] .signal-card .context-gate-note { color: #c6d7ce; }
html[data-theme="dark"] .signal-card .context-gate-note.caution,
html[data-theme="dark"] .signal-card .context-gate-note.unavailable { color: #efbd70; }
html[data-theme="dark"] .portal-metric-card span,
html[data-theme="dark"] .portal-metric-card small,
html[data-theme="dark"] .card-meta { color: var(--apex-muted); }
html[data-theme="dark"] .clickable-metric:hover { border-color: #3b6854; background: #132a21; box-shadow: var(--apex-shadow-soft); }
html[data-theme="dark"] .customer-key-card.active {
  border-color: #2f815e;
  background: linear-gradient(90deg, #133d2d, #0d241b 62%);
}

html[data-theme="dark"] .summary-block { color: #c8d8d0; }
html[data-theme="dark"] .context-section h3 { color: #eff7f2; }
html[data-theme="dark"] .context-section p { color: #b4c5bc; }
html[data-theme="dark"] .context-meta span {
  border-color: var(--apex-line);
  color: #b8c9c0;
  background: #132a21;
}
html[data-theme="dark"] .level-list > div {
  color: #adbbb4;
  background: #142a21;
}
html[data-theme="dark"] .level-list dd { color: #edf6f0; }
html[data-theme="dark"] .reason-list { color: #bdccc4; }
html[data-theme="dark"] .bias-badge small {
  color: #bacbc2;
  background: rgba(8, 27, 20, .82);
}
html[data-theme="dark"] .bias-badge.bullish { color: #72e2ad; background: rgba(40, 160, 105, .17); }
html[data-theme="dark"] .bias-badge.bearish { color: #ff9992; background: rgba(194, 61, 54, .17); }
html[data-theme="dark"] .signal-embed-badge { color: #c4d4cc; background: #173027; }
html[data-theme="dark"] .status-box,
html[data-theme="dark"] .key-output,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .rich-empty { color: #aebfb6; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #355347; border: 2px solid #0c1f18; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #0c1f18; }

/* Light theme adjusts the public dark surfaces as well as the workspace. */
html[data-theme="light"] .admin-shell > .app-nav,
html[data-theme="light"] .portal-shell > .portal-section-nav {
  border-color: var(--apex-line);
  background: rgba(248, 250, 247, .96);
  box-shadow: var(--apex-shadow-soft);
}
html[data-theme="light"] .admin-shell > .app-nav::before,
html[data-theme="light"] .portal-shell > .portal-section-nav::before { color: #74837b; }
html[data-theme="light"] .app-nav-button,
html[data-theme="light"] .portal-section-button { color: #40534a; }
html[data-theme="light"] .app-nav-button::before,
html[data-theme="light"] .portal-section-button::before { color: #38775c; }
html[data-theme="light"] .app-nav-button:hover,
html[data-theme="light"] .portal-section-button:hover { color: #153b2c; background: #e9f1eb; }
html[data-theme="light"] .app-nav-button.active,
html[data-theme="light"] .portal-section-button.active {
  border-color: rgba(11,107,73,.2);
  color: #fff;
  background: linear-gradient(100deg, #14734f, #0b5b40);
  box-shadow: inset 3px 0 #77e8b3, 0 8px 18px rgba(11,91,64,.14);
}
html[data-theme="light"] .app-nav-button.active::before,
html[data-theme="light"] .portal-section-button.active::before { color: #a3f2c9; }
html[data-theme="light"] .shell > .hero {
  border-color: rgba(15,77,55,.13);
  color: var(--apex-ink);
  background:
    radial-gradient(circle at 82% 20%, rgba(192,158,75,.13), transparent 18rem),
    linear-gradient(112deg, #f8faf7, #eef3ee 62%, #e5ece6);
  box-shadow: var(--apex-shadow);
}
html[data-theme="light"] .shell > .hero::before {
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(17,104,72,.09) 50%, transparent 50.5%),
    linear-gradient(transparent 49.5%, rgba(17,104,72,.07) 50%, transparent 50.5%);
  background-size: 38px 38px;
}
html[data-theme="light"] .shell > .hero::after { border-color: rgba(178,142,55,.24); }
html[data-theme="light"] .shell > .hero h1 { color: var(--apex-deep); }
html[data-theme="light"] .shell > .hero .eyebrow { color: var(--apex-green); }
html[data-theme="light"] .shell > .hero .lede { color: var(--apex-muted); }
html[data-theme="light"] .shell > .hero .hero-card {
  border-color: var(--apex-line);
  color: var(--apex-ink);
  background: rgba(255,255,255,.72);
}
html[data-theme="light"] .shell > .hero .hero-card strong { color: var(--apex-deep); }
html[data-theme="light"] .shell > .hero .hero-card small,
html[data-theme="light"] .shell > .hero .hero-card .metric-label { color: var(--apex-muted); }
html[data-theme="light"] .shell > .hero .logout-link { color: var(--apex-green); }
html[data-theme="light"] .shell > .hero .theme-toggle { border-color: var(--apex-line); color: #3e554b; background: #fff; }
html[data-theme="light"] .commerce-body {
  color: var(--apex-ink);
  background:
    radial-gradient(circle at 86% 4%, rgba(193,158,77,.14), transparent 28rem),
    linear-gradient(150deg, #eef2ed, #f8f7f1 52%, #e8eee9);
}
html[data-theme="light"] .commerce-body::before {
  background:
    linear-gradient(90deg, rgba(19,89,62,.035) 1px, transparent 1px),
    linear-gradient(rgba(19,89,62,.03) 1px, transparent 1px);
  background-size: 46px 46px;
}
html[data-theme="light"] .commerce-header { border-color: rgba(15,77,55,.12); background: rgba(250,252,249,.84); }
html[data-theme="light"] .commerce-header .secondary,
html[data-theme="light"] .commerce-header .theme-toggle { border-color: var(--apex-line); color: #355047; background: #fff; }
html[data-theme="light"] .secure-label { color: var(--apex-muted); }
html[data-theme="light"] .commerce-hero h1,
html[data-theme="light"] .checkout-copy h1 { color: var(--apex-deep); }
html[data-theme="light"] .commerce-hero > p:last-of-type,
html[data-theme="light"] .checkout-copy > p { color: var(--apex-muted); }
html[data-theme="light"] .commerce-hero::after { color: rgba(15,92,61,.5); }
html[data-theme="light"] .commerce-proof { border-color: var(--apex-line); background: rgba(255,255,255,.5); }
html[data-theme="light"] .commerce-proof > div { border-color: var(--apex-line); }
html[data-theme="light"] .commerce-proof strong { color: var(--apex-ink); }
html[data-theme="light"] .commerce-proof span { color: var(--apex-muted); }
html[data-theme="light"] .commerce-footer { color: var(--apex-muted); }
html[data-theme="light"] .checkout-steps li { border-color: var(--apex-line); color: #819088; }
html[data-theme="light"] .checkout-steps li span { color: #6b8176; background: #eef2ed; }
html[data-theme="light"] .checkout-steps li.active { color: var(--apex-ink); }
html[data-theme="light"] .order-summary { border-color: var(--apex-line); color: var(--apex-ink); background: rgba(255,255,255,.55); }
html[data-theme="light"] .order-summary small { color: var(--apex-muted); }
html[data-theme="light"] .trust-row span { border-color: var(--apex-line); color: var(--apex-muted); }
html[data-theme="light"] .login-intro {
  color: var(--apex-ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(194,158,74,.14), transparent 25rem),
    linear-gradient(145deg, #eef2ed, #faf9f4);
}
html[data-theme="light"] .login-intro h1 { color: var(--apex-deep); }
html[data-theme="light"] .login-intro p { color: var(--apex-muted); }
html[data-theme="light"] .login-capabilities span { border-color: var(--apex-line); color: #4d6258; }
html[data-theme="light"] .login-form-wrap { background: #e4eae5; }

@media (max-width: 720px) {
  .theme-toggle-label { display: none; }
  .theme-toggle { width: 38px; padding-inline: 8px; }
  .shell > .hero .theme-toggle { width: 100%; }
  .shell > .hero .theme-toggle-label { display: inline; }
  .commerce-header .theme-toggle { width: 38px; }
  .commerce-brand { width: 142px; }
  .commerce-brand .apex-logo { width: 142px; }
  .commerce-brand .apex-logo-image { width: 100%; }
  .login-form-wrap > .theme-toggle { top: 12px; right: 12px; }
}
.reading-details { padding: .75rem 0; border-top: 1px solid var(--apex-line); }
.reading-details summary { cursor: pointer; font-weight: 650; }
.reading-details p { margin: .55rem 0; }
#waveFibLevels[aria-pressed="true"] { border-color: var(--apex-green, #16845f); }

.scheduler-box { flex-wrap: wrap; }
.analysis-publication { flex: 1 1 100%; min-width: 0; padding: .65rem; }
#analysisSchedule { max-width: 100%; overflow-x: auto; }
#analysisSchedule table { width: 100%; border-collapse: collapse; font-size: .84rem; }
#analysisSchedule th, #analysisSchedule td { padding: .45rem .2rem; text-align: center; }
#analysisSchedule th:first-child { text-align: left; }
#analysisSchedule input[type=checkbox] { width: 1.1rem; height: 1.1rem; min-height: 0; cursor: pointer; }

.chart-layer-menu summary { cursor: pointer; border-radius: 10px; min-height: 40px; font-weight: 650; }
.chart-layer-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 8px; }
.chart-layer-options label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: .82rem; }
.chart-layer-options select { width: auto; min-height: 32px; padding: 4px 7px; }
.chart-layer-options input[type=checkbox] { width: 1rem; min-height: 0; margin: 0; }
.structure-timeline { display: grid; gap: .65rem; padding-left: 1.2rem; }
.structure-timeline small { display: block; }
