/* Palantir Blueprint, dark theme: its gray scale, intent colors and system type. */
:root {
  --black: #111418;
  --dg1: #1c2127; --dg2: #252a31; --dg3: #2f343c; --dg4: #383e47; --dg5: #404854;
  --g1: #5f6b7c; --g2: #738091; --g3: #8f99a8; --g4: #abb3bf; --g5: #c5cbd3;
  --lg5: #f6f7f9;
  --blue1: #184a90; --blue2: #215db0; --blue3: #2d72d2; --blue4: #4c90f0; --blue5: #8abbff;
  --green3: #238551; --green4: #32a467; --green5: #72ca9b;
  --orange3: #c87619; --orange4: #ec9a3c; --orange5: #fbb360;
  --red3: #cd4246; --red4: #e76a6e; --red5: #fa999c;
  --text: var(--lg5); --text-2: var(--g5); --muted: var(--g4); --faint: var(--g3);
  --divider: rgba(255,255,255,.1);
  --font: -apple-system, "BlinkMacSystemFont", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Open Sans", "Helvetica Neue", sans-serif;
  --mono: monospace, "SF Mono", Menlo, Consolas, "Liberation Mono";
  --r: 2px;
  --elev1: 0 0 0 1px rgba(17,20,24,.4), 0 1px 1px rgba(17,20,24,.4);
  --elev3: 0 0 0 1px rgba(17,20,24,.4), 0 2px 4px rgba(17,20,24,.4), 0 8px 24px rgba(17,20,24,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--dg2); color: var(--text); font: 400 14px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; } .grow { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green5); } .neg { color: var(--red5); }
:focus-visible { outline: 2px solid rgba(76,144,240,.6); outline-offset: 2px; }
kbd { font: 11px var(--mono); color: var(--g4); background: var(--dg3); border-radius: var(--r); padding: 1px 5px; box-shadow: inset 0 0 0 1px var(--dg5); }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- navbar ---------- */
.navbar { position: sticky; top: 0; z-index: 10; height: 50px; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--dg4); box-shadow: 0 0 0 1px rgba(17,20,24,.2), 0 1px 1px rgba(17,20,24,.4); }
.nav-group { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.nav-group.right { margin-left: auto; gap: 6px; }
.logo { width: 26px; height: 26px; display: block; }
.nav-title { font: 600 19px/1 "Outfit", var(--font); letter-spacing: -.01em; color: #fff; }
.nav-divider { width: 1px; height: 20px; background: var(--divider); }
.nav-sub { color: var(--muted); }
.omnibar { position: relative; flex: 0 1 440px; display: flex; align-items: center; }
.omnibar .icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--g4); }
.omnibar input { width: 100%; height: 30px; padding: 0 40px 0 34px; border: 0; border-radius: var(--r); background: rgba(17,20,24,.3); color: var(--text); box-shadow: inset 0 0 0 1px rgba(17,20,24,.2), inset 0 1px 1px rgba(17,20,24,.5); outline: none; }
.omnibar input::placeholder { color: var(--g3); }
.omnibar input:focus { box-shadow: inset 0 0 0 1px var(--blue4), 0 0 0 2px rgba(76,144,240,.3); }
.omnibar kbd { position: absolute; right: 8px; }
.nav-run { height: 30px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; border: 0; border-radius: var(--r); background: rgba(200,118,25,.25); color: var(--orange5); cursor: pointer; font-weight: 500; }
.nav-run:hover { background: rgba(200,118,25,.35); }
/* Phase Orb (dotm-circular-6): 5×5 dots, corners masked, opacities set by app.js */
.orb { --s: 14px; display: inline-grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: calc(var(--s) * .1); width: var(--s); height: var(--s); flex: none; vertical-align: middle; color: currentColor; }
.orb i { border-radius: 50%; background: currentColor; opacity: .08; }
.orb i.off { visibility: hidden; }

/* ---------- buttons, tags, controls ---------- */
.bp-btn { height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 0; border-radius: var(--r); background: var(--dg3); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), 0 1px 2px rgba(17,20,24,.2); cursor: pointer; white-space: nowrap; font-size: 14px; }
.bp-btn:hover { background: var(--dg2); }
.bp-btn:active { background: var(--black); }
.bp-btn svg { width: 16px; height: 16px; }
.bp-btn.primary { background: var(--blue3); color: #fff; box-shadow: inset 0 0 0 1px rgba(17,20,24,.2), 0 1px 2px rgba(17,20,24,.2); }
.bp-btn.primary:hover { background: var(--blue2); }
.bp-btn.primary:active { background: var(--blue1); }
.bp-btn.primary svg { fill: currentColor; stroke: none; }
.bp-btn.danger { background: var(--red3); color: #fff; }
.bp-btn.minimal { background: none; box-shadow: none; color: var(--g5); }
.bp-btn.minimal:hover { background: rgba(143,153,168,.15); color: var(--text); }
.bp-btn.minimal.danger { color: var(--red5); }
.bp-btn.small { height: 24px; padding: 0 8px; font-size: 12px; }
.bp-btn.large { height: 40px; padding: 0 18px; font-size: 16px; }
.bp-btn.icon-only { width: 30px; padding: 0; }
.bp-btn:disabled { opacity: .5; cursor: not-allowed; }
.bp-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--g3); }
.bp-btn .dot.ok { background: var(--green4); } .bp-btn .dot.bad { background: var(--orange4); }

.bp-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r); font-size: 12px; font-weight: 500; background: var(--g1); color: var(--lg5); white-space: nowrap; }
.bp-tag.minimal { background: rgba(143,153,168,.2); color: var(--g5); }
.bp-tag.primary { background: var(--blue3); color: #fff; } .bp-tag.primary.minimal { background: rgba(45,114,210,.25); color: var(--blue5); }
.bp-tag.success { background: var(--green3); color: #fff; } .bp-tag.success.minimal { background: rgba(35,133,81,.25); color: var(--green5); }
.bp-tag.warning { background: var(--orange3); color: #fff; } .bp-tag.warning.minimal { background: rgba(200,118,25,.25); color: var(--orange5); }
.bp-tag.danger { background: var(--red3); color: #fff; } .bp-tag.danger.minimal { background: rgba(205,66,70,.25); color: var(--red5); }

.seg { display: inline-flex; border-radius: var(--r); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); background: var(--dg3); overflow: hidden; }
.seg button, .seg label span { display: block; padding: 0 12px; height: 30px; line-height: 30px; border: 0; background: none; color: var(--g5); cursor: pointer; font-size: 14px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg button + button, .seg label + label span { box-shadow: -1px 0 0 rgba(255,255,255,.08); }
.seg button:hover, .seg label:hover span { background: rgba(143,153,168,.15); color: var(--text); }
.seg button.on, .seg input:checked + span { background: var(--blue3); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid rgba(76,144,240,.6); outline-offset: -2px; }
.seg.small button { height: 24px; line-height: 24px; padding: 0 9px; font-size: 12px; }

input[type=date], .form-group input:not([type=checkbox]):not([type=radio]), .key-form input, .add-row input {
  height: 30px; padding: 0 10px; border: 0; border-radius: var(--r); background: rgba(17,20,24,.3); color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(17,20,24,.2), inset 0 1px 1px rgba(17,20,24,.5); outline: none; color-scheme: dark; }
input[type=date]:focus, .form-group input:not([type=checkbox]):not([type=radio]):focus, .key-form input:focus, .add-row input:focus { box-shadow: inset 0 0 0 1px var(--blue4), 0 0 0 2px rgba(76,144,240,.3); }
input::placeholder { color: var(--g3); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--blue3); width: 16px; height: 16px; margin: 0; }
.check small { color: var(--muted); margin-left: 2px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - 50px); }
/* the whole sidebar scrolls on its own, so past analyses stay reachable below a long watchlist */
.sidebar { position: sticky; top: 50px; height: calc(100vh - 50px); background: var(--dg1); box-shadow: 1px 0 0 rgba(17,20,24,.6); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--dg5) transparent; }
.side-section { display: flex; flex-direction: column; flex: none; padding: 12px 8px 8px; }
.side-section.grow { flex: none; border-top: 1px solid var(--divider); padding-bottom: 16px; }
.side-head { position: sticky; top: 0; z-index: 1; background: var(--dg1); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 6px; }
.side-head h2 { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.add-row { display: flex; gap: 6px; padding: 0 8px 8px; }
.add-row input { flex: 1; min-width: 0; text-transform: uppercase; }
.menu { list-style: none; margin: 0; padding: 0; }
.menu li { position: relative; }
.menu .item { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; min-height: 32px; border: 0; border-radius: var(--r); background: none; color: var(--text); text-align: left; cursor: pointer; }
.menu .item:hover { background: rgba(143,153,168,.15); }
.menu .item.active { background: var(--blue3); color: #fff; }
.menu .item.active .pos, .menu .item.active .neg, .menu .item.active .sub { color: #fff; }
.menu .sym { font-weight: 600; }
.menu .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.menu .right { text-align: right; font-variant-numeric: tabular-nums; }
.menu .rm { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.menu .empty { color: var(--muted); padding: 6px 8px; font-size: 13px; }
.menu .orb { color: var(--orange5); margin-left: 7px; vertical-align: 0; }
.menu .item.active .orb { color: #fff; }

.main { padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- object header ---------- */
.object { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id price" "act act"; gap: 14px 24px; align-items: end; padding-bottom: 16px; border-bottom: 1px solid var(--divider); }
.obj-id { grid-area: id; min-width: 0; }
.obj-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.obj-line h1 { font-size: 28px; font-weight: 600; letter-spacing: -.01em; }
.obj-name { color: var(--g5); font-size: 16px; }
.obj-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.obj-price { grid-area: price; text-align: right; }
.obj-price .px { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.obj-price .chg { font-size: 14px; font-variant-numeric: tabular-nums; margin-left: 8px; }
.obj-price .asof { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.analyze { grid-area: act; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }
#run-btn { margin-left: auto; min-width: 180px; }
#stop-btn { min-width: 0; }

.callout { padding: 12px 14px 12px 16px; border-radius: var(--r); background: rgba(143,153,168,.15); color: var(--text); border-left: 3px solid var(--g3); display: flex; gap: 12px; align-items: center; }
.callout.primary { background: rgba(45,114,210,.15); border-left-color: var(--blue4); }
.callout.warning { background: rgba(200,118,25,.15); border-left-color: var(--orange4); }
.callout.danger { background: rgba(205,66,70,.15); border-left-color: var(--red4); }
.callout .bp-btn { margin-left: auto; }

/* ---------- cards ---------- */
/* chart and decision share one fixed height, side by side */
.row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 12px; height: 360px; }
.row > .card { min-height: 0; }
.card { background: var(--dg3); border-radius: var(--r); box-shadow: var(--elev1); min-width: 0; display: flex; flex-direction: column; }
.card-head { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--divider); }
.card-head h2 { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px; min-width: 0; }
.chart-body { padding: 6px 10px 8px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* one fixed-height line: a wrapping legend would resize the chart under the pointer */
.legend { flex: none; height: 22px; display: flex; align-items: center; gap: 16px; overflow: hidden; white-space: nowrap; font-size: 12px; color: var(--muted); padding: 0 4px 4px; font-variant-numeric: tabular-nums; }
.legend .ohlc { display: flex; gap: 14px; min-width: 0; overflow: hidden; }
.legend .keys { display: flex; gap: 14px; margin-left: auto; flex: none; }
.legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; }
.chart { flex: 1; min-height: 0; }

/* ---------- verdict ---------- */
.verdict .card-body { display: flex; flex-direction: column; gap: 9px; padding: 12px 14px; flex: 1; min-height: 0; overflow: auto; }
.v-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.v-word { font-size: 28px; font-weight: 700; letter-spacing: .01em; line-height: 1; }
.v-status { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--orange5); line-height: 1.3; }
.v-status.stopped { color: var(--red5); }
.err-detail summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.err-detail pre { white-space: pre-wrap; word-break: break-word; font: 11.5px/1.5 var(--mono); color: var(--muted); background: var(--dg2); padding: 8px 10px; border-radius: var(--r); max-height: 160px; overflow: auto; margin: 6px 0 0; }
.v-actions a.bp-btn { text-decoration: none; }
.v-word.buy { color: var(--green5); } .v-word.sell { color: var(--red5); } .v-word.hold { color: var(--blue5); } .v-word.wait { color: var(--orange5); } .v-word.none { color: var(--g3); }
.v-en { color: var(--muted); }
.v-mean { font-size: 13px; color: var(--g5); margin: -3px 0 0; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.scale span { text-align: center; font-size: 11px; font-weight: 600; padding: 3px 0; background: var(--dg2); color: var(--g2); }
.scale span:first-child { border-radius: var(--r) 0 0 var(--r); } .scale span:last-child { border-radius: 0 var(--r) var(--r) 0; }
.scale span.on { background: var(--c); color: #fff; }
.props { display: grid; grid-template-columns: 92px minmax(0, 1fr); margin: 0; }
.props dt, .props dd { padding: 5px 0; border-top: 1px solid var(--divider); margin: 0; }
.props dt { color: var(--muted); font-size: 12px; }
.props dd { color: var(--text); font-size: 12.5px; line-height: 1.45; }
.voices { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.v-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.progress { height: 8px; border-radius: 4px; background: var(--dg2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--orange4); border-radius: 4px; transition: width .5s; }
.progress.stripes i { background-image: linear-gradient(-45deg, rgba(255,255,255,.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.2) 50%, rgba(255,255,255,.2) 75%, transparent 75%); background-size: 16px 16px; animation: stripes .8s linear infinite; }
@keyframes stripes { to { background-position: 16px 0; } }
.empty-state { text-align: center; padding: 8px 6px; color: var(--muted); font-size: 13px; }
.empty-state svg { width: 28px; height: 28px; color: var(--g2); margin-bottom: 4px; }
.empty-state h3 { color: var(--text); font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.empty-state p { margin: 0 auto 10px; max-width: 38ch; line-height: 1.45; }

/* ---------- stepper ---------- */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stepper li { position: relative; padding-top: 12px; border-top: 3px solid var(--dg5); }
.stepper li.done { border-top-color: var(--green4); }
.stepper li.run { border-top-color: var(--orange4); }
.stepper .st { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.stepper .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--dg5); color: var(--g5); flex: none; }
.stepper li.done .ic { background: var(--green3); color: #fff; }
.stepper li.run .ic { background: rgba(200,118,25,.25); color: var(--orange5); }
.stepper .d { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; line-height: 1.45; }
.stepper .t { color: var(--g3); font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- report tabs ---------- */
.tabs-head { padding: 0 16px; }
.tabs { display: flex; gap: 20px; overflow-x: auto; }
.tabs button { position: relative; height: 40px; padding: 0; border: 0; background: none; color: var(--g5); cursor: pointer; font-size: 14px; white-space: nowrap; }
.tabs button:hover:not(:disabled) { color: var(--blue5); }
.tabs button[aria-selected="true"] { color: var(--blue5); box-shadow: inset 0 -3px 0 var(--blue4); }
.tabs button:disabled { color: var(--g1); cursor: default; }
.tabs .orb { color: var(--orange5); margin-left: 7px; vertical-align: 0; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subtabs button { height: 26px; padding: 0 12px; border: 0; border-radius: 13px; background: var(--dg2); color: var(--g5); cursor: pointer; font-size: 13px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.subtabs button[aria-selected="true"] { background: var(--blue3); color: #fff; box-shadow: none; }
.subtabs button:disabled { color: var(--g1); cursor: default; }

.md { max-width: 80ch; color: var(--g5); font-size: 14px; line-height: 1.65; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); font-weight: 600; line-height: 1.3; margin: 1.4em 0 .5em; }
.md h1 { font-size: 18px; } .md h2 { font-size: 16px; } .md h3, .md h4 { font-size: 14px; }
.md p { margin: 0 0 .9em; } .md ul, .md ol { margin: 0 0 .9em; padding-left: 22px; }
.md li { margin: 2px 0; } .md li::marker { color: var(--g3); }
.md strong { color: var(--text); font-weight: 600; }
.md a { color: var(--blue5); }
.md code { font: 12.5px var(--mono); background: var(--dg2); padding: 1px 4px; border-radius: var(--r); }
.md blockquote { margin: 0 0 .9em; padding: 8px 14px; background: rgba(200,118,25,.12); border-left: 3px solid var(--orange4); color: var(--g5); }
.md table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; font-size: 13px; }
.md th, .md td { padding: 6px 11px; border-bottom: 1px solid var(--divider); text-align: left; }
.md th { color: var(--muted); font-weight: 600; }
.md tr:nth-child(even) td { background: rgba(143,153,168,.06); }
.md hr { border: 0; border-top: 1px solid var(--divider); }

.turn { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--r); background: var(--dg2); border-left: 3px solid var(--g1); }
.turn.bull { border-left-color: var(--green4); } .turn.bear { border-left-color: var(--red4); }
.turn.aggressive { border-left-color: var(--orange4); } .turn.conservative { border-left-color: var(--blue4); }
.turn-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.section-h { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 20px 0 10px; }

.bp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bp-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--divider); }
.bp-table td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--divider); vertical-align: top; }
.bp-table td.m { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-word; }
.bp-table td.t { font-variant-numeric: tabular-nums; color: var(--g3); white-space: nowrap; }

.foot { color: var(--g2); font-size: 12px; margin: 4px 0 0; }

/* ---------- dialogs ---------- */
.bp-dialog { width: min(520px, 94vw); padding: 0; border: 0; border-radius: 4px; background: var(--dg2); color: var(--text); box-shadow: var(--elev3); }
.bp-dialog::backdrop { background: rgba(17,20,24,.7); }
.dlg-head { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; background: var(--dg3); border-radius: 4px 4px 0 0; box-shadow: 0 1px 0 rgba(17,20,24,.4); }
.dlg-head h2 { font-size: 16px; font-weight: 600; }
.dlg-body { padding: 18px 20px; display: grid; gap: 14px; max-height: 70vh; overflow: auto; }
.dlg-body p { margin: 0; line-height: 1.5; }
.dlg-foot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--divider); }
.key-form { display: flex; gap: 8px; }
.key-form input { flex: 1; min-width: 0; font-family: var(--mono); }
.key-state { display: flex; align-items: center; gap: 8px; }
.msg { font-size: 13px; min-height: 1.2em; } .msg.ok { color: var(--green5); } .msg.err { color: var(--red5); }
.form-group { display: grid; gap: 6px; }
.form-group .label { font-size: 13px; font-weight: 600; }
.form-group .label small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.form-group input:not([type=checkbox]):not([type=radio]) { width: 100%; font-family: var(--mono); font-size: 13px; }
.help-text { font-size: 12px; color: var(--muted); min-height: 1.3em; }
/* one aligned row per analyst: box · name · note */
.checks { display: grid; gap: 2px; }
.checks .check { display: grid; grid-template-columns: 18px auto minmax(0, 1fr); align-items: center; column-gap: 10px; padding: 7px 8px; border-radius: var(--r); }
.checks .check:hover { background: rgba(143,153,168,.12); }
.checks .check input { width: 16px; height: 16px; margin: 0; }
.checks .check small { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.help h3 { font-size: 14px; font-weight: 600; margin-top: 4px; }
.help-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.help .bp-table td:first-child { width: 80px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .row { grid-template-columns: minmax(0, 1fr); height: auto; }
  .row > .card { height: 360px; }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-sub, .nav-divider { display: none; }
}
.menu-btn { display: none; }
.scrim { position: fixed; inset: 0; z-index: 29; background: rgba(17,20,24,.6); }

/* ---------- phones and small tablets ---------- */
@media (max-width: 820px) {
  body { font-size: 14px; }
  .menu-btn { display: inline-flex; margin-left: -6px; }
  .navbar { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 8px; gap: 8px; }
  .nav-sub, .nav-divider { display: none; }
  .nav-group.right { gap: 2px; }
  #key-btn .lbl { display: none; }
  #key-btn { width: 30px; padding: 0; }
  .nav-run { order: 6; flex: 1 1 100%; justify-content: center; }
  .omnibar { order: 5; flex: 1 1 100%; margin: 0; }
  .omnibar kbd { display: none; }

  .layout { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  /* sidebar becomes a slide-in drawer */
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh; width: min(86vw, 320px); z-index: 30;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--elev3); padding-top: env(safe-area-inset-top); }
  body.drawer-open { overflow: hidden; }
  body.drawer-open .sidebar { transform: none; }

  .main { padding: 14px 12px 24px; gap: 12px; }
  .object { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "price" "act"; gap: 10px; padding-bottom: 12px; }
  .obj-line h1 { font-size: 24px; }
  .obj-price { text-align: left; }
  .obj-price .px { font-size: 24px; }
  .analyze { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
  .analyze .field:first-child { grid-column: 1 / -1; }
  .analyze .field:first-child input { width: 100%; }
  .analyze .field:nth-child(2) { grid-column: 1 / 2; min-width: 0; }
  .analyze .seg { width: 100%; display: flex; }
  .analyze .seg label { flex: 1; min-width: 0; }
  .analyze .seg label span { padding: 0 4px; text-align: center; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #adv-btn { grid-column: 2 / 3; }
  #run-btn { grid-column: 1 / -1; margin-left: 0; width: 100%; min-width: 0; }
  #stop-btn { grid-column: 1 / -1; width: 100%; }

  .row { grid-template-columns: minmax(0, 1fr); height: auto; gap: 12px; }
  .row > .card { height: auto; }
  .row > .card:first-child { height: 360px; }
  .verdict .card-body { overflow: visible; }
  .card-head { padding: 0 12px; flex-wrap: wrap; row-gap: 6px; min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
  .card-body { padding: 12px; }
  .chart-tools { flex-wrap: wrap; justify-content: flex-end; }
  .legend .ohlc span:nth-child(n+2):nth-child(-n+4) { display: none; }   /* keep date + close on narrow screens */
  .v-word { font-size: 26px; }
  .props { grid-template-columns: 84px minmax(0, 1fr); }
  .stepper { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stepper li { border-top: 0; border-left: 3px solid var(--dg5); padding: 8px 0 8px 12px; }
  .stepper li.done { border-left-color: var(--green4); } .stepper li.run { border-left-color: var(--orange4); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 18px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs-head { padding: 0 12px; }
  .md { font-size: 14px; }
  .bp-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 8px 8px 0 0; max-height: 92dvh; }
  .dlg-head { border-radius: 8px 8px 0 0; }
  .dlg-body { max-height: 70dvh; padding: 16px; }
  .key-form { flex-direction: column; }
  .callout { flex-wrap: wrap; }
  .callout .bp-btn { margin-left: 0; }
}
@media (max-width: 380px) {
  .nav-title { font-size: 17px; }
  .analyze .seg label span { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* chart toolbar: indicator toggles + range */
.chart-tools { display: flex; gap: 8px; align-items: center; }
.seg .sw { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; }
.seg button[aria-pressed="false"] .sw { opacity: .35; }
.chart.sub { flex: 0 0 78px; min-height: 78px; border-top: 1px solid var(--divider); }
.menu .group { padding: 8px 8px 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--g3); text-transform: uppercase; }

.chart-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.chart-wrap .chart { flex: 1; }
.chart-loading { position: absolute; inset: 0; background: var(--dg3); display: grid; place-items: center; }
.chart-loading .skeleton { width: 70%; height: 55%; border-radius: var(--r); background: linear-gradient(90deg, rgba(143,153,168,.08), rgba(143,153,168,.18), rgba(143,153,168,.08)); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* company logos: shown as they are; a monogram tile only when no logo loads */
.co-logo { --z: 22px; position: relative; flex: none; display: inline-grid; place-items: center; width: var(--z); height: var(--z); border-radius: calc(var(--z) * .24); background: var(--dg4); color: var(--g5); overflow: hidden; vertical-align: middle; }
.co-logo b { font-size: calc(var(--z) * .38); font-weight: 700; letter-spacing: -.02em; }
.co-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .15s; }
.co-logo.has-img { background: none; border-radius: 0; }
.co-logo.has-img b { visibility: hidden; }
.co-logo.has-img img { opacity: 1; }
.sym-wrap { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.obj-line { align-items: center; }
#o-logo:empty { display: none; }

/* sidebar rows never clip their tag: text shrinks and truncates instead */
.menu .item { grid-template-columns: minmax(0, 1fr) auto; }
.menu .item > .bp-tag { flex: none; }
.sym-wrap .txt { display: flex; flex-direction: column; min-width: 0; }
.menu .sym { display: inline-flex; align-items: center; white-space: nowrap; }
.menu .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* sign-in gate */
.bp-dialog.login { width: min(360px, 92vw); }
.bp-dialog.login::backdrop { background: var(--dg1); }
.login-body { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 28px 24px 22px; max-height: none; }
.login-body h2 { font: 600 22px "Outfit", var(--font); color: #fff; }
.login-body input { width: 100%; height: 36px; padding: 0 12px; border: 0; border-radius: var(--r); background: rgba(17,20,24,.3); color: var(--text); box-shadow: inset 0 0 0 1px rgba(17,20,24,.2), inset 0 1px 1px rgba(17,20,24,.5); outline: none; }
.login-body input:focus { box-shadow: inset 0 0 0 1px var(--blue4), 0 0 0 2px rgba(76,144,240,.3); }
.login-body .bp-btn { width: 100%; }
@media (max-width: 820px) {
  /* the sign-in card stays centred on phones (other dialogs become bottom sheets) */
  .bp-dialog.login { width: calc(100vw - 32px); max-width: 400px; margin: auto; border-radius: 6px; max-height: none; }
  .login-body { padding: 28px 20px 22px; max-height: none; }
  .login-body input { height: 44px; font-size: 16px; }   /* 16px stops iOS from zooming the field */
  .login-body .bp-btn.large { height: 44px; }
}

.key-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v-actions a.bp-btn svg { width: 14px; height: 14px; }

/* phones: no sideways panning, and no iOS auto-zoom (inputs under 16px zoom the page) */
html, body { max-width: 100%; overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
.main, .row, .card, .object, .layout > * { min-width: 0; max-width: 100%; }
img, svg, canvas { max-width: 100%; }
@media (max-width: 820px) {
  input, select, textarea, .omnibar input { font-size: 16px !important; }
  .chart-tools .seg button { padding: 0 7px; }
  .legend { gap: 10px; }
  .obj-tags { overflow: hidden; }
  .md pre, .md table { max-width: 100%; }
  .props dd { word-break: break-word; }
}
#v-tag { display: inline-flex; align-items: center; gap: 8px; }
.pdf-btn { text-decoration: none; }
.pdf-btn svg { width: 14px; height: 14px; }

/* ---------- phones with the keyboard open ---------- */
@media (max-width: 820px) {
  .navbar { position: relative; }                 /* a sticky bar jumps under the iOS keyboard */
  .sidebar { top: 0; }
  .bp-dialog { margin: 12px auto auto; border-radius: 8px; max-height: calc(var(--vvh, 100dvh) - 24px); overflow: auto; }
  .bp-dialog .dlg-body { max-height: none; }
  .bp-dialog .dlg-head { position: sticky; top: 0; z-index: 1; border-radius: 8px 8px 0 0; }
  .bp-dialog .dlg-foot { position: sticky; bottom: 0; background: var(--dg2); }
  .bp-dialog.login { margin: max(12px, calc((var(--vvh, 100dvh) - 330px) / 2)) auto auto; }
  body { padding-bottom: env(safe-area-inset-bottom); }
}

/* Any touch device: iOS zooms the page into a focused field under 16px and leaves it
   zoomed. Keep every field at 16px there (pinch zoom stays available). */
@media (pointer: coarse), (hover: none) {
  input, select, textarea, .omnibar input, .login-body input, .key-form input, .form-group input:not([type=checkbox]):not([type=radio]), input[type=date] { font-size: 16px !important; }
  .omnibar input { height: 36px; }
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
