/* OptionAlgo Screen Lab — FBT_v2 (standalone page module)
   Self-contained: carries the grid / tile / chip primitives it needs, themed
   through the --ms-* tokens which map onto the page's own palette. */

.ms-root{
  --ms-pri: var(--purple, var(--brand, #7b52ff));
  --ms-green: var(--green, var(--up, #16b979));
  --ms-red: var(--red, var(--dn, #f0446c));
  --ms-amber: var(--orange, var(--warn, #f5a524));
  --ms-card: var(--card, var(--bg2, #12101c));
  --ms-border: var(--border, var(--line, rgba(255,255,255,.08)));
  --ms-text: var(--text, var(--t1, #e8e6f0));
  --ms-muted: var(--muted, #8a869c);
  --ms-mono: 'JetBrains Mono', ui-monospace, monospace;
  font-family: inherit;
  color: var(--ms-text);
}
html[data-theme="light"] .ms-root{
  --ms-card: var(--card, var(--bg2, #ffffff));
  --ms-border: var(--border, var(--line, rgba(20,10,60,.10)));
  --ms-text: var(--text, var(--t1, #1a1730));
  --ms-muted: var(--muted, #6b6785);
  --ms-green:#068a45; --ms-red:#e0113a; --ms-amber:#b26a00;
}

/* ── primitives (subset of the Market Screener workspace) ───────────── */
.ms-root .ms-chip{
  background:transparent; color:var(--ms-muted); border:1px solid var(--ms-border);
  border-radius:20px; padding:5px 12px; font-size:11.5px; font-weight:600;
  cursor:pointer; font-family:inherit; transition:all .12s;
}
.ms-root .ms-chip:hover{ color:var(--ms-text); }
.ms-root .ms-chip.on{ background:var(--ms-pri); border-color:var(--ms-pri); color:#fff; }
.ms-root .ms-gridwrap{ overflow-x:auto; border:1px solid var(--ms-border); border-radius:10px; background:var(--ms-card); }
.ms-root table.ms-grid{ width:100%; border-collapse:collapse; font-size:12px; }
.ms-root table.ms-grid thead th{
  position:sticky; top:0; z-index:2; background:var(--ms-card);
  text-align:right; padding:9px 12px; font-size:10.5px; font-weight:700;
  letter-spacing:.05em; text-transform:uppercase; color:var(--ms-muted);
  border-bottom:1px solid var(--ms-border); white-space:nowrap; cursor:pointer; user-select:none;
}
.ms-root table.ms-grid thead th:first-child{ text-align:left; }
.ms-root table.ms-grid thead th.ms-sorted{ color:var(--ms-pri); }
.ms-root table.ms-grid thead th .ms-arr{ font-size:9px; margin-left:3px; }
.ms-root table.ms-grid tbody td{
  text-align:right; padding:8px 12px; border-bottom:1px solid var(--ms-border);
  font-family:var(--ms-mono); white-space:nowrap; color:var(--ms-text);
}
.ms-root table.ms-grid tbody td:first-child{ text-align:left; font-family:inherit; font-weight:600; }
.ms-root table.ms-grid tbody tr:last-child td{ border-bottom:none; }
.ms-root table.ms-grid tbody tr:hover td{ background:rgba(123,82,255,.06); }
.ms-root .ms-pos{ color:var(--ms-green); }
.ms-root .ms-neg{ color:var(--ms-red); }
html[data-theme="light"] .ms-root table.ms-grid .ms-pos,
html[data-theme="light"] .ms-root table.ms-grid .ms-neg{ padding:1px 7px; border-radius:6px; font-weight:700; }
html[data-theme="light"] .ms-root table.ms-grid .ms-pos{ background:rgba(6,138,69,.11); }
html[data-theme="light"] .ms-root table.ms-grid .ms-neg{ background:rgba(224,17,58,.10); }
.ms-root .ms-sym{ color:var(--ms-text); }
.ms-root .ms-sym small{ color:var(--ms-muted); font-weight:400; font-size:10px; display:block; }
.ms-root .ms-tiles{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; margin-bottom:12px; }
.ms-root .ms-tile{ background:var(--ms-card); border:1px solid var(--ms-border); border-radius:10px; padding:11px 13px; }
.ms-root .ms-tile .lbl{ font-size:10.5px; color:var(--ms-muted); text-transform:uppercase; letter-spacing:.05em; margin-bottom:5px; }
.ms-root .ms-tile .val{ font-size:19px; font-weight:700; font-family:var(--ms-mono); }
.ms-root .ms-tile .sub{ font-size:10.5px; color:var(--ms-muted); margin-top:3px; }
.ms-root .ms-empty,.ms-root .ms-loading{ padding:32px; text-align:center; color:var(--ms-muted); font-size:12.5px; }
.ms-root .spin{
  display:inline-block; width:15px; height:15px; border:2px solid var(--ms-border);
  border-top-color:var(--ms-pri); border-radius:50%; animation:ms-spin .7s linear infinite; vertical-align:-3px; margin-right:7px;
}
@keyframes ms-spin{ to{ transform:rotate(360deg); } }
.ms-root .ms-h{ font-size:13px; font-weight:700; margin:0 0 9px; display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.ms-root .ms-h svg{ width:15px; height:15px; color:var(--ms-pri); }

/* ── the module ─────────────────────────────────────────────────────── */
.ms-root .fbt{ display:flex; flex-direction:column; gap:10px; }
.ms-root .fbt-head{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; font-size:12px; color:var(--ms-muted); }
.ms-root .fbt-kicker{ display:inline-flex; align-items:center; gap:6px; font-weight:700; color:var(--ms-text); }
.ms-root .fbt-kicker svg{ width:15px; height:15px; color:var(--ms-pri); }
.ms-root .fbt-cov{ font-family:var(--ms-mono); font-size:10.5px; }
.ms-root .fbt-badge{ display:inline-flex; align-items:center; gap:5px; margin-left:auto; padding:3px 8px; border:1px solid var(--ms-border); border-radius:999px; font-size:11px; cursor:pointer; }
.ms-root .fbt-badge:hover{ border-color:var(--ms-pri); color:var(--ms-text); }
.ms-root .fbt-badge svg{ width:12px; height:12px; }

.ms-root .fbt-presets{ display:flex; gap:6px; flex-wrap:wrap; }
.ms-root .fbt-blurb{ font-size:12px; color:var(--ms-muted); min-height:14px; display:flex; align-items:center; gap:6px; }
.ms-root .fbt-info svg{ width:13px; height:13px; vertical-align:-2px; }

.ms-root .fbt-card{
  background:var(--ms-card); border:1px solid var(--ms-border); border-radius:12px; padding:12px 14px;
  display:flex; flex-direction:column; gap:10px;
}
.ms-root .fbt-row{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ms-root .fbt-condhead{ justify-content:space-between; }
.ms-root .fbt-lbl{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; }
.ms-root .fbt-lbl svg{ width:14px; height:14px; color:var(--ms-pri); }
.ms-root .fbt-cond{ padding:4px 0; border-bottom:1px dashed var(--ms-border); }
.ms-root .fbt-cond:last-of-type{ border-bottom:0; }
.ms-root .fbt-desc{ font-size:11px; color:var(--ms-muted); flex-basis:100%; padding-left:2px; }
@media(min-width:900px){ .ms-root .fbt-desc{ flex-basis:auto; flex:1; min-width:120px; } }

.ms-root .fbt-sel, .ms-root .fbt-val, .ms-root .fbt-expr{
  background:transparent; color:var(--ms-text); border:1px solid var(--ms-border); border-radius:8px;
  padding:6px 9px; font-size:12.5px; font-family:inherit; outline:none;
}
.ms-root .fbt-sel:focus, .ms-root .fbt-val:focus, .ms-root .fbt-expr:focus{ border-color:var(--ms-pri); }
.ms-root .fbt-sel{ max-width:260px; }
.ms-root .fbt-col{ min-width:200px; }
.ms-root .fbt-op{ width:70px; }
.ms-root .fbt-val{ width:96px; font-family:var(--ms-mono); }
.ms-root .fbt-num{ width:78px; }
.ms-root .fbt-date{ width:140px; font-family:inherit; }
.ms-root .fbt-unit{ font-size:11px; color:var(--ms-muted); min-width:22px; }
.ms-root .fbt-expr{ width:100%; box-sizing:border-box; font-family:var(--ms-mono); font-size:12px; resize:vertical; }
.ms-root .fbt-help{ font-size:11px; color:var(--ms-muted); }
.ms-root .fbt-help code{ font-family:var(--ms-mono); background:rgba(128,128,160,.12); padding:1px 4px; border-radius:4px; }
html[data-theme="light"] .ms-root .fbt-sel option{ color:#1a1730; }
html:not([data-theme="light"]) .ms-root .fbt-sel option, html:not([data-theme="light"]) .ms-root .fbt-sel optgroup{ background:#1a1726; color:#e8e6f0; }

.ms-root .fbt-mini{
  display:inline-flex; align-items:center; gap:5px; background:transparent; color:var(--ms-muted);
  border:1px solid var(--ms-border); border-radius:7px; padding:4px 9px; font-size:11.5px; cursor:pointer; font-family:inherit;
}
.ms-root .fbt-mini:hover{ color:var(--ms-text); border-color:var(--ms-pri); }
.ms-root .fbt-mini svg{ width:12px; height:12px; }
.ms-root .fbt-add{ margin-top:6px; }
.ms-root .fbt-icon{ background:transparent; border:0; color:var(--ms-muted); cursor:pointer; padding:4px; display:inline-flex; border-radius:6px; }
.ms-root .fbt-icon:hover{ color:var(--ms-red); background:rgba(240,68,108,.10); }
.ms-root .fbt-icon svg{ width:13px; height:13px; }

.ms-root .fbt-settings{ display:flex; gap:8px 12px; flex-wrap:wrap; align-items:flex-end; padding-top:8px; border-top:1px solid var(--ms-border); }
.ms-root .fbt-field{ display:flex; flex-direction:column; gap:3px; font-size:10.5px; color:var(--ms-muted); }
.ms-root .fbt-field > span{ min-height:12px; }

.ms-root .fbt-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding-top:4px; }
.ms-root .fbt-btn{
  display:inline-flex; align-items:center; gap:6px; background:transparent; color:var(--ms-text);
  border:1px solid var(--ms-border); border-radius:9px; padding:8px 14px; font-size:12.5px; font-weight:700; cursor:pointer; font-family:inherit;
}
.ms-root .fbt-btn:hover{ border-color:var(--ms-pri); }
.ms-root .fbt-btn svg{ width:14px; height:14px; }
.ms-root .fbt-primary{ background:var(--ms-pri); border-color:var(--ms-pri); color:#fff; }
.ms-root .fbt-status{ font-size:12px; color:var(--ms-muted); display:inline-flex; align-items:center; gap:6px; }
.ms-root .fbt-status a, .ms-root .fbt-lock a{ color:var(--ms-pri); font-weight:600; cursor:pointer; text-decoration:underline; }

.ms-root .fbt-results{ display:flex; flex-direction:column; gap:10px; }
.ms-root .fbt-results .ms-h small{ font-weight:500; color:var(--ms-muted); margin-left:6px; font-family:var(--ms-mono); font-size:10.5px; }
.ms-root .fbt-lock{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--ms-muted); padding:8px 2px 0; flex-wrap:wrap; }
.ms-root .fbt-lock svg{ width:13px; height:13px; }

.ms-root .fbt-chartbox{ display:flex; flex-direction:column; gap:6px; }
.ms-root .fbt-legend{ display:flex; gap:14px; flex-wrap:wrap; align-items:center; font-size:11.5px; color:var(--ms-muted); }
.ms-root .fbt-legend span{ display:inline-flex; align-items:center; gap:6px; }
.ms-root .fbt-legend i, .ms-root .fbt-tip i{ display:inline-block; width:10px; height:3px; border-radius:2px; }
.ms-root .fbt-legend .fbt-mini{ margin-left:auto; }
.ms-root .fbt-chart{ position:relative; height:320px; width:100%; }
.ms-root .fbt-bars{ height:170px; }
.ms-root .fbt-chart canvas{ display:block; }
.ms-root .fbt-tip{
  position:absolute; top:8px; display:none; pointer-events:none; min-width:150px;
  background:var(--ms-card); border:1px solid var(--ms-border); border-radius:8px; padding:6px 9px;
  font-size:11px; color:var(--ms-text); box-shadow:0 6px 20px rgba(0,0,0,.25);
}
.ms-root .fbt-tip > div{ font-family:var(--ms-mono); color:var(--ms-muted); margin-bottom:3px; }
.ms-root .fbt-tip span{ display:flex; align-items:center; gap:6px; }
.ms-root .fbt-tip b{ margin-left:auto; font-family:var(--ms-mono); }

.ms-root .fbt-yearly td:first-child{ font-weight:700; }
.ms-root .fbt-details summary{ cursor:pointer; font-size:12.5px; font-weight:700; padding:4px 0; }
.ms-root .fbt-details .fbt-sel{ margin:6px 0; }
.ms-root .fbt-today{ display:flex; flex-direction:column; gap:6px; }
.ms-root .fbt-foot{ display:flex; gap:6px; align-items:flex-start; font-size:11px; color:var(--ms-muted); line-height:1.45; }
.ms-root .fbt-foot svg{ width:13px; height:13px; flex:none; margin-top:2px; }

/* ── section heads ──────────────────────────────────────────────────── */
.ms-root .fbt-sechead{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; margin:8px 0 2px; }
.ms-root .fbt-sechead h3{ margin:0; font-size:17px; font-weight:800; letter-spacing:-.3px; }
.ms-root .fbt-eyebrow{ font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--ms-pri); flex-basis:100%; }
.ms-root .fbt-secnote{ font-size:12px; color:var(--ms-muted); }

/* ── preset cards ───────────────────────────────────────────────────── */
.ms-root .fbt-presetgrid{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
@media(max-width:1100px){ .ms-root .fbt-presetgrid{ grid-template-columns:repeat(2,1fr); } }
@media(max-width:560px){ .ms-root .fbt-presetgrid{ grid-template-columns:1fr; } }
.ms-root .fbt-pcard{
  background:var(--ms-card); border:1px solid var(--ms-border); border-radius:14px; padding:14px 14px 12px; cursor:pointer;
  display:flex; flex-direction:column; gap:6px; position:relative; transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ms-root .fbt-pcard:hover{ transform:translateY(-2px); border-color:var(--ms-pri); box-shadow:0 12px 30px rgba(91,46,255,.14); }
.ms-root .fbt-pcard .n{ font-weight:800; font-size:14px; letter-spacing:-.2px; }
.ms-root .fbt-pcard .b{ font-size:11.5px; color:var(--ms-muted); line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:32px; }
.ms-root .fbt-sparkbox{ position:relative; height:64px; margin:4px -2px 2px; }
.ms-root .fbt-sparkbox canvas{ display:block; }
.ms-root .fbt-sparkbox.is-empty{ display:grid; place-items:center; border:1px dashed var(--ms-border); border-radius:8px; font-size:11px; color:var(--ms-muted); }
.ms-root .fbt-pcard .k{ display:grid; grid-template-columns:1.6fr 1fr 1fr 1fr; gap:6px; align-items:end; }
.ms-root .fbt-pcard .k span{ display:flex; flex-direction:column; gap:1px; }
.ms-root .fbt-pcard .k small{ font-size:9.5px; color:var(--ms-muted); text-transform:uppercase; letter-spacing:.06em; }
.ms-root .fbt-pcard .k b{ font-size:14px; font-weight:700; }
.ms-root .fbt-pcard .k .k-main b{ font-size:22px; font-weight:800; letter-spacing:-.5px; line-height:1.05; }
.ms-root .fbt-pcard .k em{ font-style:normal; font-size:10.5px; font-weight:600; }
.ms-root .fbt-pcard .k em.ms-pos{ color:var(--sl-good, var(--ms-green)); }
.ms-root .fbt-pcard .k em.ms-neg{ color:var(--sl-bad, var(--ms-red)); }
.ms-root .fbt-pcard .kf{ font-size:10.5px; color:var(--ms-muted); font-family:var(--ms-mono); margin-top:2px; }
.ms-root .fbt-pcard.is-empty{ opacity:.85; }

/* ── loading skeleton ───────────────────────────────────────────────── */
.ms-root .fbt-skel{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
@media(max-width:1100px){ .ms-root .fbt-skel{ grid-template-columns:repeat(2,1fr); } }
.ms-root .fbt-skel > div{ height:170px; border-radius:14px; background:linear-gradient(90deg, var(--ms-card) 25%, rgba(128,128,160,.12) 50%, var(--ms-card) 75%); background-size:200% 100%; animation:fbt-shimmer 1.3s infinite; border:1px solid var(--ms-border); }
@keyframes fbt-shimmer{ to{ background-position:-200% 0; } }

/* ── KPI tiles ──────────────────────────────────────────────────────── */
.ms-root .fbt-kpis{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.ms-root .fbt-kpi{ background:var(--ms-card); border:1px solid var(--ms-border); border-radius:12px; padding:10px 12px; }
.ms-root .fbt-kpi.hero{ padding:14px 16px; background:linear-gradient(180deg, rgba(123,82,255,.07), transparent 60%), var(--ms-card); }
.ms-root .fbt-kpi .lbl{ font-size:10.5px; color:var(--ms-muted); text-transform:uppercase; letter-spacing:.06em; margin-bottom:4px; }
.ms-root .fbt-kpi .val{ font-size:18px; font-weight:700; letter-spacing:-.3px; }
.ms-root .fbt-kpi.hero .val{ font-size:28px; font-weight:800; letter-spacing:-.8px; line-height:1.05; }
.ms-root .fbt-kpi .delta{ font-size:11.5px; font-weight:600; margin-top:3px; }
.ms-root .fbt-kpi .delta.up{ color:var(--sl-good, var(--ms-green)); }
.ms-root .fbt-kpi .delta.down{ color:var(--sl-bad, var(--ms-red)); }
.ms-root .fbt-kpi .sub{ font-size:10.5px; color:var(--ms-muted); margin-top:3px; }
.ms-root .fbt-charthead{ display:flex; align-items:baseline; gap:8px; font-size:12.5px; }
.ms-root .fbt-charthead b{ font-weight:700; }
.ms-root .fbt-charthead span{ color:var(--ms-muted); font-size:11.5px; }
.ms-root .fbt-resultcard{ gap:14px; }
.ms-root .fbt-resultcard > .ms-h{ margin-bottom:0; }
.ms-root .fbt-yearly td.ms-pos{ background:rgba(15,157,88,.10); }
.ms-root .fbt-yearly td.ms-neg{ background:rgba(224,72,61,.10); }
.ms-root .fbt-actions .fbt-primary{ background:linear-gradient(135deg,#5B2EFF,#9B6BFF); border-color:transparent; box-shadow:0 6px 18px rgba(91,46,255,.25); }
.ms-root .fbt-actions .fbt-primary:hover{ transform:translateY(-1px); }
.ms-root .fbt-conds{ background:rgba(128,128,160,.05); border:1px solid var(--ms-border); border-radius:10px; padding:8px 10px; }

@media(max-width:900px){ .ms-root .fbt-kpis{ grid-template-columns:repeat(2,1fr); } }
@media(max-width:640px){
  .ms-root .fbt-col{ min-width:0; width:100%; }
  .ms-root .fbt-chart{ height:240px; }
  .ms-root .fbt-bars{ height:140px; }
  .ms-root .fbt-badge{ margin-left:0; }
  .ms-root .fbt-pcard .k{ grid-template-columns:1.6fr 1fr 1fr; }
  .ms-root .fbt-pcard .k span:last-child{ display:none; }
}

/* ── premium gate: full-width preview + CTA bar; the offer is a popup ──────── */
.ms-root .fbt-lockwall{ padding:14px 16px 0; gap:12px; }
.ms-root .fbt-lockwall > .ms-h{ margin-bottom:0; }
.ms-root .lk-kpis{ gap:8px; }
.ms-root .lk-kpis .fbt-kpi{ padding:9px 11px; }
.ms-root .lk-kpis .fbt-kpi .val{ font-size:17px; }
.ms-root .fbt-kpi.is-locked{ position:relative; }
.ms-root .fbt-kpi.is-locked i{ display:block; border-radius:6px; background:linear-gradient(90deg, rgba(128,128,160,.14) 25%, rgba(128,128,160,.28) 50%, rgba(128,128,160,.14) 75%); background-size:200% 100%; animation:fbt-shimmer 1.6s infinite; }
.ms-root .fbt-kpi.is-locked .val i{ height:17px; width:56%; margin:3px 0 5px; }
.ms-root .fbt-kpi.is-locked .sub i{ height:8px; width:78%; }
.ms-root .lk-mini{ position:absolute; top:9px; right:10px; color:var(--ms-muted); opacity:.65; }
.ms-root .lk-mini svg{ width:12px; height:12px; }
.ms-root .lk-chart .fbt-chart{ height:230px; pointer-events:none; }
.ms-root .lk-chart .fbt-legend .fbt-mini{ display:none; }
.ms-root .lk-chartskel{ height:170px; border:1px dashed var(--ms-border); border-radius:12px; display:grid; place-items:center; font-size:12px; color:var(--ms-muted);
  background:repeating-linear-gradient(180deg, transparent 0 41px, var(--ms-border) 41px 42px); }
.ms-root .lk-chartskel span{ background:var(--ms-card); padding:4px 10px; border-radius:999px; }
.ms-root .lk-frost{ position:relative; margin:0 -16px; padding:12px 16px 0; border-top:1px solid var(--ms-border); }
.ms-root .lk-frost::after{ content:""; position:absolute; inset:0; background:linear-gradient(180deg, transparent 10%, var(--ms-card) 88%); pointer-events:none; }
.ms-root .lk-frosthead{ display:flex; gap:4px 8px; flex-wrap:wrap; align-items:baseline; font-size:12px; margin-bottom:6px; }
.ms-root .lk-frosthead b{ font-weight:700; }
.ms-root .lk-frosthead span{ color:var(--ms-muted); font-size:11px; margin-right:10px; }
.ms-root .lk-row{ display:flex; gap:12px; align-items:center; padding:9px 0; border-bottom:1px solid var(--ms-border); }
.ms-root .lk-row i{ display:block; height:9px; border-radius:5px; background:rgba(128,128,160,.16); }
.ms-root .lk-row i:first-child{ background:rgba(128,128,160,.26); }
.ms-root .lk-bar{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:0 -16px; padding:12px 16px; border-top:1px solid var(--ms-border);
  background:linear-gradient(90deg, rgba(123,82,255,.10), transparent 60%); }
.ms-root .lk-baricon{ width:34px; height:34px; border-radius:11px; display:grid; place-items:center; background:rgba(123,82,255,.16); color:var(--ms-pri); flex-shrink:0; }
.ms-root .lk-baricon svg{ width:16px; height:16px; }
.ms-root .lk-bartext{ display:flex; flex-direction:column; gap:1px; font-size:12px; color:var(--ms-muted); min-width:0; flex:1; }
.ms-root .lk-bartext b{ font-size:13px; color:var(--ms-text); }
.ms-root .lk-baractions{ display:flex; gap:8px; flex-wrap:wrap; }
.ms-root .lk-baractions .fbt-primary{ background:linear-gradient(135deg,#5B2EFF,#9B6BFF); border-color:transparent; box-shadow:0 6px 18px rgba(91,46,255,.25); }
@media(max-width:900px){
  .ms-root .lk-kpis .is-locked, .ms-root .lk-frost{ display:none; }
  .ms-root .lk-baractions{ width:100%; }
  .ms-root .lk-baractions .fbt-btn{ flex:1; justify-content:center; }
}

/* ── gate popup: same family as the dashboard sign-in modal ─────────────────── */
.fbt-gate{ position:fixed; inset:0; z-index:310; background:rgba(6,4,18,.78); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); display:none; align-items:center; justify-content:center; padding:16px; animation:lmFadeIn .18s ease; font-family:inherit; }
.fbt-gate.open{ display:flex; }
.fbt-gate .gt-box{ position:relative; width:100%; max-width:440px; background:#0d0a1f; border:1px solid rgba(175,155,255,.34); border-radius:22px; padding:26px 26px 22px; box-shadow:0 24px 72px rgba(4,2,22,.88); animation:lmSlideUp .22s ease; color:rgba(235,232,255,.94); max-height:calc(100dvh - 32px); overflow:auto; scrollbar-width:thin; }
@keyframes lmFadeIn{ from{ opacity:0 } to{ opacity:1 } }
@keyframes lmSlideUp{ from{ transform:translateY(20px); opacity:0 } to{ transform:translateY(0); opacity:1 } }
.fbt-gate .gt-close{ position:absolute; top:14px; right:14px; background:transparent; border:none; color:rgba(160,152,220,.6); font-size:24px; width:30px; height:30px; cursor:pointer; border-radius:50%; line-height:1; display:flex; align-items:center; justify-content:center; font-family:inherit; }
.fbt-gate .gt-close:hover{ color:#fff; background:rgba(123,82,255,.16); }
.fbt-gate .gt-icon{ width:48px; height:48px; border-radius:14px; margin:0 auto 10px; display:grid; place-items:center; background:linear-gradient(135deg,#5B2EFF,#9B6BFF); color:#fff; box-shadow:0 8px 22px rgba(91,46,255,.35); }
.fbt-gate .gt-icon svg{ width:22px; height:22px; }
.fbt-gate .gt-badge{ text-align:center; font-size:10.5px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:#a480ff; margin-bottom:6px; }
.fbt-gate h2{ margin:0 0 6px; font-size:21px; font-weight:800; letter-spacing:-.4px; text-align:center; line-height:1.15; }
.fbt-gate .gt-sub{ margin:0 0 14px; font-size:13px; color:rgba(190,183,255,.66); text-align:center; line-height:1.5; }
.fbt-gate .gt-stats{ display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin:0 0 14px; padding:10px 8px; border:1px solid rgba(148,128,255,.16); border-radius:12px; background:rgba(255,255,255,.03); }
.fbt-gate .gt-stats span{ display:flex; flex-direction:column; align-items:center; gap:2px; }
.fbt-gate .gt-stats small{ font-size:9.5px; color:rgba(160,152,220,.7); text-transform:uppercase; letter-spacing:.06em; }
.fbt-gate .gt-stats b{ font-size:15px; font-weight:800; }
.fbt-gate .gt-stats b.ms-pos{ color:#3DDC84; }
.fbt-gate .gt-stats b.ms-neg{ color:#FF6B5E; }
.fbt-gate .gt-list{ list-style:none; margin:0 0 16px; padding:0; display:flex; flex-direction:column; gap:8px; font-size:12.5px; line-height:1.4; }
.fbt-gate .gt-list li{ display:flex; gap:9px; align-items:flex-start; }
.fbt-gate .gt-list svg{ width:16px; height:16px; flex-shrink:0; margin-top:1px; color:#3DDC84; }
.fbt-gate .gt-actions{ display:flex; gap:8px; }
.fbt-gate .gt-actions .fbt-btn{ flex:1; justify-content:center; display:inline-flex; align-items:center; border:1px solid rgba(148,128,255,.28); background:rgba(255,255,255,.06); color:inherit; border-radius:10px; padding:11px 14px; font-size:13px; font-weight:800; cursor:pointer; font-family:inherit; }
.fbt-gate .gt-actions .fbt-btn:hover{ background:rgba(255,255,255,.10); }
.fbt-gate .gt-actions .fbt-btn.fbt-primary, html[data-theme="light"] .fbt-gate .gt-actions .fbt-btn.fbt-primary{ background:linear-gradient(135deg,#5B2EFF,#9B6BFF); border-color:transparent; color:#fff; box-shadow:0 6px 18px rgba(91,46,255,.3); }
.fbt-gate .gt-actions .fbt-btn.fbt-primary:hover, html[data-theme="light"] .fbt-gate .gt-actions .fbt-btn.fbt-primary:hover{ background:linear-gradient(135deg,#5B2EFF,#9B6BFF); transform:translateY(-1px); }
.fbt-gate .gt-fine{ margin-top:12px; font-size:11px; color:rgba(160,152,220,.6); text-align:center; line-height:1.45; }
html[data-theme="light"] .fbt-gate{ background:rgba(40,30,90,.35); }
html[data-theme="light"] .fbt-gate .gt-box{ background:#FFFFFF; border-color:rgba(91,46,255,.18); box-shadow:0 24px 72px rgba(60,40,140,.22); color:#1a1233; }
html[data-theme="light"] .fbt-gate .gt-close{ color:rgba(60,50,110,.55); }
html[data-theme="light"] .fbt-gate .gt-close:hover{ color:#1a1233; background:rgba(91,46,255,.10); }
html[data-theme="light"] .fbt-gate .gt-badge{ color:#4c2fd6; }
html[data-theme="light"] .fbt-gate .gt-sub{ color:rgba(60,50,110,.7); }
html[data-theme="light"] .fbt-gate .gt-stats{ background:#FAF9FF; border-color:rgba(91,46,255,.16); }
html[data-theme="light"] .fbt-gate .gt-stats small{ color:rgba(60,50,110,.7); }
html[data-theme="light"] .fbt-gate .gt-stats b.ms-pos{ color:#0F9D58; }
html[data-theme="light"] .fbt-gate .gt-stats b.ms-neg{ color:#E0483D; }
html[data-theme="light"] .fbt-gate .gt-list svg{ color:#0F9D58; }
html[data-theme="light"] .fbt-gate .gt-actions .fbt-btn{ background:#FFFFFF; border-color:rgba(91,46,255,.22); }
html[data-theme="light"] .fbt-gate .gt-actions .fbt-btn:hover{ background:#F7F5FF; }
html[data-theme="light"] .fbt-gate .gt-fine{ color:rgba(60,50,110,.65); }

/* ── date placeholder (native date inputs only show dd-mm-yyyy) ─────────── */
.ms-root .fbt-datewrap{ position:relative; display:inline-flex; }
.ms-root .fbt-datewrap .ph{ display:none; position:absolute; left:1px; top:1px; bottom:1px; right:34px; padding:0 8px; align-items:center; border-radius:7px;
  background:var(--ms-card); color:var(--ms-muted); font-style:normal; font-size:12.5px; pointer-events:none; }
.ms-root .fbt-datewrap.is-empty .ph{ display:flex; }
.ms-root .fbt-datewrap.is-empty input:focus + .ph{ display:none; }
.ms-root .fbt-datewrap.is-empty input::-webkit-datetime-edit{ color:transparent; }
.ms-root .fbt-datewrap.is-empty input:focus::-webkit-datetime-edit{ color:inherit; }
.ms-root .fbt-num::placeholder{ color:var(--ms-muted); font-family:inherit; }

/* ── query builder (Screener-style expression editor) ─────────────────── */
.ms-root .fbt-qbuild{ display:flex; flex-direction:column; gap:8px; }
.ms-root .fbt-qhead{ display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }
.ms-root .fbt-qtitle{ display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:700; }
.ms-root .fbt-qtitle svg{ width:14px; height:14px; color:var(--ms-pri); }
.ms-root .fbt-qlinks{ display:inline-flex; gap:16px; }
.ms-root .fbt-qlink{ background:transparent; border:0; color:var(--ms-pri); font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; cursor:pointer; font-family:inherit; padding:0; }
.ms-root .fbt-qlink:hover,.ms-root .fbt-qlink.on{ text-decoration:underline; }
.ms-root .fbt-qtools{ display:flex; align-items:center; gap:5px; flex-wrap:wrap; padding:7px 9px; border:1px solid var(--ms-border); border-bottom:0; border-radius:9px 9px 0 0; background:rgba(128,128,160,.05); }
.ms-root .fbt-op-btn{ min-width:30px; height:28px; padding:0 8px; display:inline-flex; align-items:center; justify-content:center; background:var(--ms-card); color:var(--ms-text); border:1px solid var(--ms-border); border-radius:7px; font-family:var(--ms-mono); font-size:13px; line-height:1; cursor:pointer; }
.ms-root .fbt-op-btn.wide{ font-family:inherit; font-weight:700; font-size:11.5px; letter-spacing:.03em; }
.ms-root .fbt-op-btn:hover{ border-color:var(--ms-pri); color:var(--ms-pri); }
.ms-root .fbt-op-info{ color:var(--ms-muted); }
.ms-root .fbt-op-info svg{ width:14px; height:14px; }
.ms-root .fbt-op-div{ width:1px; height:18px; background:var(--ms-border); margin:0 3px; }
.ms-root .fbt-qbox{ width:100%; box-sizing:border-box; min-height:112px; background:var(--ms-card); color:var(--ms-text); border:1px solid var(--ms-border); border-radius:0 0 9px 9px; padding:10px 12px; font-family:var(--ms-mono); font-size:13px; line-height:1.65; resize:vertical; outline:none; }
.ms-root .fbt-qbox:focus{ border-color:var(--ms-pri); }
.ms-root .fbt-qbox::placeholder{ color:var(--ms-muted); }
.ms-root .fbt-qhelp{ padding:8px 10px; border:1px solid var(--ms-border); border-radius:8px; background:rgba(128,128,160,.06); line-height:1.5; }
.ms-root .fbt-qparams,.ms-root .fbt-qcustom{ border:1px solid var(--ms-border); border-radius:10px; padding:10px; background:rgba(128,128,160,.04); display:flex; flex-direction:column; gap:8px; }
.ms-root .fbt-qsearch{ width:100%; box-sizing:border-box; }
.ms-root .fbt-qplist{ max-height:280px; overflow:auto; display:flex; flex-direction:column; gap:1px; }
.ms-root .fbt-qgrp{ font-size:10px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:var(--ms-muted); margin:8px 2px 2px; }
.ms-root .fbt-qitem{ display:flex; align-items:center; gap:10px; width:100%; text-align:left; background:transparent; border:0; border-radius:7px; padding:5px 8px; cursor:pointer; color:var(--ms-text); font-family:inherit; }
.ms-root .fbt-qitem:hover{ background:rgba(123,82,255,.10); }
.ms-root .fbt-qitem code{ font-family:var(--ms-mono); font-size:11.5px; color:var(--ms-pri); background:rgba(123,82,255,.12); padding:2px 6px; border-radius:5px; min-width:132px; }
.ms-root .fbt-qitem .l{ flex:1; font-size:12px; }
.ms-root .fbt-qitem .u{ font-size:10.5px; color:var(--ms-muted); font-family:var(--ms-mono); white-space:nowrap; }
.ms-root .fbt-preview{ color:#fff; background:var(--ms-pri); border-color:var(--ms-pri); }
.ms-root .fbt-preview:hover{ transform:translateY(-1px); }
.ms-root .fbt-save{ color:#fff; background:var(--ms-green); border-color:var(--ms-green); }
.ms-root .fbt-save:hover{ transform:translateY(-1px); border-color:var(--ms-green); }
.ms-root .fbt-preview svg,.ms-root .fbt-save svg{ color:#fff; }
.ms-root .fbt-saverow{ display:flex; align-items:center; gap:6px; flex-basis:100%; margin-top:6px; }
.ms-root .fbt-savename{ min-width:220px; font-family:inherit; }
.ms-root .fbt-savedwrap{ position:relative; display:inline-block; }
.ms-root .fbt-savedmenu{ position:absolute; z-index:20; top:calc(100% + 4px); left:0; min-width:250px; max-height:300px; overflow:auto; background:var(--ms-card); border:1px solid var(--ms-border); border-radius:10px; padding:6px; box-shadow:0 12px 30px rgba(0,0,0,.28); }
.ms-root .fbt-saveditem{ display:flex; align-items:center; gap:4px; }
.ms-root .fbt-saved-load{ flex:1; min-width:0; text-align:left; background:transparent; border:0; color:var(--ms-text); font-family:inherit; font-size:12px; padding:6px 8px; border-radius:6px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ms-root .fbt-saved-load:hover{ background:rgba(123,82,255,.10); color:var(--ms-pri); }
@media(max-width:640px){ .ms-root .fbt-qitem code{ min-width:96px; } .ms-root .fbt-savedmenu{ left:auto; right:0; } }

/* ── type-ahead suggestions ───────────────────────────────────────────── */
.ms-root .fbt-qboxwrap{ position:relative; }
.ms-root .fbt-ac{ position:absolute; z-index:30; left:8px; right:8px; top:40px; max-height:320px; overflow:auto;
  background:var(--ms-card); border:1px solid var(--ms-pri); border-radius:10px; box-shadow:0 16px 40px rgba(0,0,0,.38); padding:4px; }
.ms-root .fbt-acitem{ display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:7px; cursor:pointer; }
.ms-root .fbt-acitem.on{ background:var(--ms-pri); color:#fff; }
.ms-root .fbt-acitem .l{ flex:1; font-size:13px; }
.ms-root .fbt-acitem code{ font-family:var(--ms-mono); font-size:11px; color:var(--ms-muted); white-space:nowrap; }
.ms-root .fbt-acitem.on code{ color:rgba(255,255,255,.85); }
.ms-root .fbt-acitem .pd,.ms-root .fbt-qitem .pd{ font-size:10.5px; color:var(--ms-muted); font-weight:600; }
.ms-root .fbt-acitem.on .pd{ color:rgba(255,255,255,.85); }
.ms-root .fbt-qlegend{ font-size:10.5px; color:var(--ms-muted); line-height:1.5; }
.ms-root .fbt-qlegend b{ color:var(--ms-text); font-family:var(--ms-mono); font-weight:700; }

/* ── company detail page (/stock/<symbol>) ────────────────────────────── */
.ms-root .ms-symlink{ color:var(--ms-text); text-decoration:none; cursor:pointer; }
.ms-root .ms-symlink:hover{ color:var(--ms-pri); text-decoration:underline; }
.ms-root .stk-head{ display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; padding-bottom:8px; border-bottom:1px solid var(--ms-border); }
.ms-root .stk-back{ flex-basis:100%; font-size:12px; color:var(--ms-pri); text-decoration:none; font-weight:600; }
.ms-root .stk-back:hover{ text-decoration:underline; }
.ms-root .stk-title h1{ margin:0; font-size:22px; font-weight:800; letter-spacing:-.4px; }
.ms-root .stk-title .stk-sub{ font-size:12px; color:var(--ms-muted); font-family:var(--ms-mono); }
.ms-root .stk-price{ margin-left:auto; text-align:right; }
.ms-root .stk-price b{ font-size:24px; font-weight:800; letter-spacing:-.5px; }
.ms-root .stk-price span{ display:block; font-size:11px; color:var(--ms-muted); font-family:var(--ms-mono); }
.ms-root .stk-ratios{ display:grid; grid-template-columns:repeat(6,1fr); gap:8px; margin:12px 0 4px; }
@media(max-width:900px){ .ms-root .stk-ratios{ grid-template-columns:repeat(3,1fr); } }
@media(max-width:540px){ .ms-root .stk-ratios{ grid-template-columns:repeat(2,1fr); } }
.ms-root .stk-rt{ background:var(--ms-card); border:1px solid var(--ms-border); border-radius:10px; padding:9px 11px; display:flex; flex-direction:column; gap:3px; }
.ms-root .stk-rt .l{ font-size:10px; color:var(--ms-muted); text-transform:uppercase; letter-spacing:.05em; }
.ms-root .stk-rt .v{ font-size:15px; font-weight:700; font-family:var(--ms-mono); }
.ms-root .stk-px{ position:relative; height:240px; width:100%; }
.ms-root .stk-px canvas{ display:block; }
.ms-root .stk-tbl{ font-variant-numeric:tabular-nums; }
.ms-root .stk-tbl th:first-child, .ms-root .stk-tbl td:first-child{ position:sticky; left:0; background:var(--ms-card); text-align:left; min-width:190px; z-index:1; font-family:inherit; }
.ms-root .stk-tbl td small{ color:var(--ms-muted); font-weight:400; }
.ms-root .stk-tbl tr.stk-strong td{ font-weight:800; }
.ms-root .stk-tbl tbody tr:hover td:first-child{ background:var(--ms-card); }

/* STOCK_PRO_GATE_v1 - lock card on /stock/<SYM> for non-Pro */
.ms-root .stk-lock{ padding-bottom:14px; }
.ms-root .stk-lock .fbt-foot{ margin-top:12px; }
.ms-root .stk-lock .fbt-foot a{ color:var(--ms-pri); font-weight:600; }
