/* HedgeHood engine pages: /app (the scanner desk) and /markets (consensus prices).
 * zkedge terminal look on the shared panels of base.css: flat dark panels, a small square and a mono caps title per
 * panel, mono numbers. Robinhood green is the only accent; red only marks a pool priced below its consensus. */

/* ================================================================ shared */
body.term [hidden] { display: none !important; }
.term-head .term-head__crumb { margin-top: 0; font-size: 11px; }
.term-head__crumb b { white-space: nowrap; }
.app .os-window__title, .mk .os-window__title, .app-pop .os-window__title, .app-modal .os-window__title { font: inherit; font-weight: 500; letter-spacing: 0.1em; margin: 0; }
.app .os-window__title { white-space: nowrap; }
.pn { color: var(--muted); font-weight: 400; }
.pn-meta { color: var(--muted); font-weight: 400; }
.pn-meta::before { content: '·'; margin-right: 10px; color: var(--faint); }

.app .up, .mk .up, .app-pop .up { color: var(--green-hi); }
.app .down, .app-pop .down { color: var(--muted); }

/* stock logo and name */
.app-logo { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; overflow: hidden; background: var(--panel-3); border: 1px solid var(--line); font: 500 12px/1 var(--mono); color: var(--ink); text-transform: uppercase; }
.app-logo img { width: 100%; height: 100%; object-fit: cover; }
.app-logo--lg { width: 40px; height: 40px; font-size: 15px; }
.stk, .stk__btn { display: flex; align-items: center; gap: 12px; min-width: 0; text-align: left; }
.stk__btn { width: 100%; min-height: 40px; color: inherit; }
.stk__text { display: grid; min-width: 0; line-height: 1.3; }
.stk__sym { font: 500 14px/1.3 var(--font); color: var(--ink); letter-spacing: 0.01em; }
.stk__name { font: 400 12px/1.35 var(--font); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 15em; }
.stk__btn:hover .stk__sym { color: var(--green-hi); }

/* sortable table head (Scan and Markets) */
.scan th, .otable th {
  height: 42px; padding: 0 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap;
  font: 400 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); text-align: left;
}
.scan th.n, .otable th.n { text-align: right; }
.scan th button, .otable th button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; transition: color 0.15s; }
.scan th button:hover, .otable th button:hover { color: var(--ink); }
.scan th button, .otable th button { min-width: 40px; }
.scan th.n button, .otable th.n button { flex-direction: row-reverse; justify-content: flex-start; }
.scan th button::after, .otable th button::after { content: ''; width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4px solid var(--faint); opacity: 0; transition: opacity 0.15s; }
.scan th button:hover::after, .otable th button:hover::after { opacity: 1; }
.scan th[aria-sort='descending'] button, .scan th[aria-sort='ascending'] button,
.otable th[aria-sort='descending'] button, .otable th[aria-sort='ascending'] button { color: var(--ink); }
.scan th[aria-sort='descending'] button::after, .otable th[aria-sort='descending'] button::after { opacity: 1; border-top-color: var(--green); }
.scan th[aria-sort='ascending'] button::after, .otable th[aria-sort='ascending'] button::after { opacity: 1; border-top: 0; border-bottom: 4px solid var(--green); }

.app-fine { font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.app-fine--pad { padding: 14px 20px; border-top: 1px solid var(--line); }
.app-fine--risk { border-left: 2px solid var(--amber); padding: 2px 0 2px 12px; }

/* ================================================================ /app */
.app-head { margin-bottom: 26px; }
.app-head h1 { font-size: clamp(30px, 3vw, 40px); }
.app-head p:not(.term-head__crumb) { margin-top: 10px; font-size: 15px; }

/* ---------------------------------------------------------------- market row */
.mkt { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-bottom: 18px; }
.app-pick {
  display: inline-flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 14px 6px 6px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); text-align: left; transition: border-color 0.2s, background 0.2s;
}
.app-pick:hover, .app-pick[aria-expanded='true'] { border-color: var(--green-line); background: var(--panel-2); }
.app-pick__logo { display: inline-grid; flex: none; }
.app-pick__logo:empty { display: none; }
.app-pick__text { display: grid; min-width: 0; line-height: 1.2; }
.app-pick__sym { font: 500 20px/1.2 var(--font); letter-spacing: -0.02em; color: var(--ink); }
.app-pick__sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-pick__caret { width: 16px; height: 16px; flex: none; margin-left: 6px; color: var(--muted); transition: transform 0.2s; }
.app-pick[aria-expanded='true'] .app-pick__caret { transform: rotate(180deg); color: var(--green); }

.mkt__stat { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: baseline; column-gap: 8px; row-gap: 2px; min-width: 0; }
.mkt__label { grid-column: 1 / -1; font: 400 12px/18px var(--font); color: var(--muted); }
.mkt__big { font: 500 26px/1.1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--ink); }
.mkt__big.is-loading { font-size: 16px; }
.mkt__meta { display: grid; grid-template-columns: auto auto; justify-content: start; column-gap: 16px; row-gap: 5px; font: 400 12px/16px var(--mono); }
.mkt__meta > div { display: contents; }
.mkt__meta dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.mkt__meta dd { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink); white-space: nowrap; }
.mkt__meta .engine-pill { font-size: 11.5px; line-height: 16px; }
.mkt__blk.is-tick { color: var(--green-hi); }
.mkt__ago { font-size: 11px; color: var(--muted); }
.mkt__feed-dot { width: 6px; height: 6px; flex: none; background: var(--faint); }
.mkt[data-source='live'] .mkt__feed-dot { background: var(--green); }
.mkt[data-source='stale'] .mkt__feed-dot, .mkt[data-source='snapshot'] .mkt__feed-dot { background: var(--amber); }
.mkt[data-source='snapshot'] .mkt__feed { color: var(--amber); }

.mkt__strip { display: grid; gap: 4px; width: 210px; }
.mkt__strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mkt__strip-head .mkt__label { grid-column: auto; }
.mkt__spread { font: 400 12px/18px var(--mono); color: var(--ink); white-space: nowrap; }
.strip { position: relative; height: 18px; }
.strip__line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-3); }
.strip__mark { position: absolute; top: 3px; bottom: 3px; width: 2px; margin-left: -1px; background: var(--ink); opacity: 0.7; }
.strip__mid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--green); }
.strip__mid::after { content: ''; position: absolute; left: -3px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; background: var(--green); }
.strip__ends { display: flex; justify-content: space-between; gap: 10px; font: 400 11px/1.3 var(--mono); color: var(--muted); }

.engine-pill { display: inline-flex; align-items: center; gap: 8px; font: 400 12px/18px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink); white-space: nowrap; }
.engine-pill__dot { width: 6px; height: 6px; flex: none; background: var(--green); }
.engine-pill[data-mode='paused'] .engine-pill__dot { background: var(--amber); }
.engine-pill[data-mode='preview'] .engine-pill__dot { background: var(--muted); }

/* ---------------------------------------------------------------- grid */
.app-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.app-col { display: grid; gap: 16px; min-width: 0; align-content: start; }
@media (min-width: 1280px) { .app-grid { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (min-width: 700px) and (max-width: 1279px) { .app-col--side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- desk */
.desk { container: desk / inline-size; }
.app-tabs-row { display: flex; align-items: stretch; justify-content: space-between; gap: 12px; padding: 0 8px 0 4px; border-bottom: 1px solid var(--line); }
.app-tabs { display: flex; min-width: 0; }
.app-tab { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; font: 500 14px/1 var(--font); color: var(--muted); transition: color 0.2s; }
.app-tab__n { font: 400 10.5px/1 var(--mono); color: var(--faint); }
.app-tab:hover { color: var(--ink); }
.app-tab[aria-selected='true'] { color: var(--ink); }
.app-tab[aria-selected='true']::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 2px; background: var(--green); }
.app-tab[aria-selected='true'] .app-tab__n { color: var(--green); }
.app-tab:focus-visible { outline-offset: -2px; }
.app-tabs-note { align-self: center; padding-right: 12px; font: 400 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); text-align: right; }

/* scan */
.scan-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; padding: 8px 20px; border-bottom: 1px solid var(--line); }
.scan-sum { font-size: 13px; color: var(--text); }
.scan-sum__n { font: 500 13px/1 var(--mono); color: var(--ink); }
.app-check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; user-select: none; font: 400 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text); }
.app-check:hover { color: var(--ink); }
.app-check input { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 0; border: 1px solid var(--line-3); background: transparent; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.app-check input:checked { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px var(--panel-solid); }

.scan-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.scan { width: 100%; }
.scan th:first-child, .scan td:first-child { padding-left: 20px; }
.scan th:last-child, .scan td:last-child { padding-right: 20px; }
.scan td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; font: 400 13px/1.4 var(--mono); color: var(--text); }
.scan td.c-stock, .scan td:first-child { font-family: var(--font); min-width: 160px; }
.scan tbody tr:last-child td { border-bottom: 0; }
.scan tbody tr[data-sym] { cursor: pointer; transition: background 0.15s; }
.scan tbody tr[data-sym]:hover { background: rgba(236, 242, 239, 0.03); }
.scan tbody tr.is-sel { background: var(--green-dim); }
.scan tbody tr.is-sel td:first-child { box-shadow: inset 2px 0 0 var(--green); }
.scan .c-pools, .scan .c-spread, .scan .c-edge { text-align: right; }
.scan td.c-edge { color: var(--ink); font-weight: 500; }
.scan td.c-edge.down { color: var(--muted); font-weight: 400; }
.scan td.c-route { white-space: normal; }
.scan .rl { display: block; max-width: 170px; font-size: 11.5px; line-height: 1.5; color: var(--text); }
.scan__loading td { padding: 26px 20px; color: var(--muted); font-family: var(--font); white-space: normal; }
.mini { position: relative; display: block; width: 56px; height: 7px; margin: 5px 0 0 auto; overflow: hidden; background: linear-gradient(var(--line-2), var(--line-2)) 0 50% / 100% 1px no-repeat; }
.mini__mark { position: absolute; top: 0; width: 2px; height: 7px; margin-left: -1px; background: var(--ink); }
.mini__mark::before { content: ''; position: absolute; right: 2px; top: 2px; width: 60px; height: 3px; background: var(--green-line); }

@container desk (max-width: 840px) { .scan .c-pools { display: none; } }
@container desk (max-width: 680px) { .scan .c-route { display: none; } }
@container desk (max-width: 560px) {
  .app-tabs-note { display: none; }
  .scan-head { padding: 8px 14px; }
  .scan th:first-child, .scan td:first-child { padding-left: 14px; }
  .scan th:last-child, .scan td:last-child { padding-right: 14px; }
  .scan th, .scan td { padding-left: 8px; padding-right: 8px; }
  .scan td:first-child { min-width: 0; }
  .stk__name { max-width: 8.5em; }
  .app-fine--pad { padding: 12px 14px; }
}
@container desk (max-width: 430px) {
  .scan .c-spread { display: none; }
  .app-tab { padding: 0 12px; }
  .app-tab[aria-selected='true']::after { left: 12px; right: 12px; }
}
@container desk (max-width: 330px) {
  .scan .app-logo { display: none; }
  .scan .chip { font-size: 0; gap: 0; padding: 6px; }
  .app-tab__n { display: none; }
}

/* route */
.app-panel--route, .app-panel--run { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 20px; }
.route-stock { display: flex; align-items: center; gap: 14px; min-width: 0; min-height: 40px; }
.route-stock__sym { font: 500 26px/1 var(--font); letter-spacing: -0.02em; color: var(--ink); }
.route-stock__meta { display: grid; gap: 4px; min-width: 0; }
.route-stock__name { font-size: 14px; color: var(--ink); }
.route-stock__sub { font: 400 12px/1.45 var(--mono); color: var(--muted); }
.route-stock__empty { font-size: 14px; color: var(--muted); }
.route-block { display: grid; gap: 12px; min-width: 0; align-content: start; }
.route-block__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.app-sub { margin: 0; font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink); }
.app-sub--muted { font-weight: 400; text-transform: none; letter-spacing: 0.02em; color: var(--muted); }
.app-sub label { cursor: pointer; }

.routes { display: grid; border: 1px solid var(--line); }
.routes:empty { display: none; }
.routes .app-empty { border: 0; }
.route { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 56px; padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--line); transition: background 0.15s; }
.route:last-child { border-bottom: 0; }
.route:hover { background: rgba(236, 242, 239, 0.03); }
.route[aria-checked='true'] { background: var(--green-dim); box-shadow: inset 2px 0 0 var(--green); }
.route:focus-visible { outline-offset: -2px; }
.route__radio { width: 14px; height: 14px; border: 1px solid var(--line-3); }
.route[aria-checked='true'] .route__radio { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px #08140a; }
.route__main { display: grid; gap: 3px; min-width: 0; }
.route__label { font-size: 14px; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
.route__sub { font: 400 11.5px/1.4 var(--mono); color: var(--muted); }
.route__edge { font: 500 13px/1 var(--mono); white-space: nowrap; }
.app-more { justify-self: start; min-height: 40px; padding: 0 2px; font: 400 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 4px; }
.app-more:hover { color: var(--ink); text-decoration-color: var(--green); }

.size-row { display: flex; flex-wrap: wrap; gap: 8px; }
.size-field { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 50px; padding: 0 14px; background: var(--panel-2); border: 1px solid var(--line-2); transition: border-color 0.2s, box-shadow 0.2s; }
.size-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.size-field__cur { font: 400 16px/1 var(--mono); color: var(--muted); }
.size-field__input { flex: 1; width: 100%; min-width: 0; padding: 12px 0; background: transparent; border: 0; outline: 0; font: 500 18px/1 var(--mono); color: var(--ink); }
.size-field__input:focus-visible { outline: 0; }
.size-field__unit { font: 400 11px/1 var(--mono); letter-spacing: 0.1em; color: var(--muted); }
.size-best { min-height: 50px; padding: 0 22px; }
.size-best[disabled] { opacity: 0.6; cursor: progress; }
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip { flex: 1 1 56px; max-width: 96px; min-height: 40px; min-width: 56px; padding: 0 10px; font: 400 12px/1 var(--mono); color: var(--text); border: 1px solid var(--line-2); transition: border-color 0.15s, color 0.15s, background 0.15s; }
.size-chip:hover { border-color: var(--line-3); color: var(--ink); }
.size-chip[aria-pressed='true'] { border-color: var(--green-line); background: var(--green-dim); color: var(--green); }

.quote { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); background: rgba(236, 242, 239, 0.015); }
.quote__cell { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 16px 18px; }
.quote__cell + .quote__cell { border-left: 1px solid var(--line); }
.quote__label { font: 400 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.quote__big { font: 500 30px/1.15 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.025em; color: var(--ink); overflow-wrap: anywhere; transition: opacity 0.2s; }
.quote .quote__big.up { color: var(--green-hi); }
.quote__sub { min-height: 1.45em; font: 400 12px/1.45 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.quote__note { grid-column: 1 / -1; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.55; color: var(--text); }
.quote__note b { font-weight: 500; color: var(--ink); }
.quote[data-kind='estimate'] .quote__note b { color: var(--amber); }
.quote[data-state='loading'] .quote__big { opacity: 0.4; }

.app-chart { background: rgba(236, 242, 239, 0.012); }
.chart { position: relative; height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart__empty { display: grid; place-items: center; height: 100%; padding: 20px; text-align: center; font-size: 13px; color: var(--muted); }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-zero { stroke: var(--line-3); stroke-width: 1; stroke-dasharray: 3 3; }
.c-axis { stroke: var(--line-2); stroke-width: 1; }
.c-tick { stroke: var(--line-3); stroke-width: 1; }
.ax-label { fill: var(--muted); font: 400 10.5px var(--mono); }
.c-line { fill: none; stroke: var(--green); stroke-width: 1.6; stroke-linejoin: round; }
.c-line--est { stroke-dasharray: 5 4; }
.c-pt { fill: var(--green); }
.c-pt--neg { fill: var(--panel-solid); stroke: var(--muted); stroke-width: 1; }
.c-bad { fill: none; stroke: var(--red); stroke-width: 1.3; }
.c-best { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.c-best-t { fill: var(--ink); font: 400 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.c-cur { fill: none; stroke: var(--green-hi); stroke-width: 1.5; }

.bd-guard { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@container desk (max-width: 640px) { .bd-guard { grid-template-columns: minmax(0, 1fr); } }
.bd { display: grid; border: 1px solid var(--line); }
.bd__row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.bd__row:last-child { border-bottom: 0; }
.bd dt { flex: 0 1 auto; font-size: 13px; color: var(--muted); }
.bd dd { min-width: 0; font: 400 13px/1.45 var(--mono); color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.bd dd small { display: block; font-size: 11px; color: var(--muted); }
.bd__row--total { background: rgba(0, 200, 5, 0.06); }
.bd__row--total dt { color: var(--ink); font-weight: 500; }
.bd__row--total dd { font-size: 14px; font-weight: 500; color: var(--green-hi); }
.bd__row--muted dt, .bd__row--muted dd { color: var(--muted); }
.guard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line); }
.guard__opt { min-height: 40px; font: 500 13px/1 var(--mono); color: var(--muted); transition: color 0.15s, background 0.15s; }
.guard__opt:hover { color: var(--ink); }
.guard__opt[aria-checked='true'] { background: var(--green-dim); color: var(--green); box-shadow: inset 0 0 0 1px rgba(0, 200, 5, 0.3); }

/* run */
.run-sum dd { max-width: 70%; }
.run-log__body { min-height: 120px; max-height: 380px; overflow-y: auto; padding: 16px 20px; background: rgba(2, 3, 2, 0.5); font: 400 12.5px/1.7 var(--mono); scrollbar-width: thin; }
.run-line { color: var(--text); overflow-wrap: anywhere; }
.run-line::before { content: '>'; margin-right: 10px; color: var(--faint); }
.run-line + .run-line, .run-big + .run-line { margin-top: 4px; }
.run-line--ok { color: var(--green-hi); }
.run-line--err { color: var(--red); }
.run-line--muted { color: var(--muted); }
.run-line a, .app-item__tx { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.run-line a:hover, .app-item__tx:hover { color: var(--green); text-decoration-color: var(--green); }
.run-big { margin: 10px 0; font: 500 34px/1.1 var(--font); letter-spacing: -0.03em; color: var(--green-hi); }

/* action */
.app-action { display: grid; gap: 10px; padding: 16px 20px 20px; border-top: 1px solid var(--line); background: rgba(4, 6, 5, 0.45); }
.app-run { gap: 12px; }
.app-run:not([disabled]) { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.app-run:not([disabled]):hover { background: var(--green-hi); border-color: var(--green-hi); color: var(--green-ink); }
.app-run[disabled], .app-run[disabled]:hover { opacity: 1; background: var(--panel-3); border-color: var(--line-2); color: var(--muted); }
.app-run[data-state='checking-quote'], .app-run[data-state='confirm-in-wallet'], .app-run[data-state='cycle-pending'] { color: var(--ink); border-color: var(--green-line); }
.app-action__note { font: 400 12px/1.55 var(--mono); color: var(--muted); text-align: center; text-wrap: balance; }
.spin { display: inline-block; flex: none; width: 12px; height: 12px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: app-spin 0.8s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

@container desk (max-width: 560px) {
  .app-panel--route, .app-panel--run { padding: 16px 14px; gap: 22px; }
  .app-action { padding: 14px; }
  .quote__cell { padding: 14px; }
  .quote__big { font-size: 24px; }
  .quote__note { padding: 12px 14px; }
  .chart { height: 210px; }
  .route { padding: 10px 12px; gap: 12px; }
  .run-log__body { padding: 14px; }
  .run-big { font-size: 28px; }
}
@container desk (max-width: 360px) {
  .quote { grid-template-columns: minmax(0, 1fr); }
  .quote__cell + .quote__cell { border-left: 0; border-top: 1px solid var(--line); }
  .size-best { flex: 1 1 100%; }
  .bd__row { padding: 10px 12px; }
}

/* ---------------------------------------------------------------- side column */
.app-side-win { container: side / inline-size; }
.pools-wrap { overflow-x: auto; scrollbar-width: thin; }
.pools { width: 100%; }
.pools th { padding: 10px 8px; border-bottom: 1px solid var(--line); font: 400 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.pools td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; font: 400 12px/1.45 var(--mono); color: var(--text); }
.pools th:first-child, .pools td:first-child { padding-left: 16px; }
.pools th:last-child, .pools td:last-child { padding-right: 16px; }
.pools tbody tr:last-child td { border-bottom: 0; }
.pool-name { color: var(--ink); }
.pools .tag { margin-left: 6px; padding: 0 5px; font-size: 9.5px; line-height: 16px; vertical-align: 1px; }
.pools .tag::before { width: 4px; height: 4px; }
.pools tr.is-thin td { color: var(--faint); }
.pools tr.is-thin .pool-name { color: var(--muted); }
.pools .depth { display: block; }
.pools .depth + .depth { font-size: 11px; color: var(--muted); }
.pools-note { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.55; color: var(--muted); }
@container side (max-width: 330px) { .pools .tag { display: block; width: max-content; margin: 4px 0 0; } }

.app-list { display: grid; max-height: 340px; overflow-y: auto; scrollbar-width: thin; }
.app-empty { padding: 16px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.app-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.app-item:last-child { border-bottom: 0; }
.app-item.is-new { background: var(--green-dim); box-shadow: inset 2px 0 0 var(--green); }
.app-item__sym { min-width: 52px; padding: 6px 7px; border: 1px solid var(--line-2); font: 500 11px/1 var(--mono); letter-spacing: 0.04em; color: var(--ink); text-align: center; }
.app-item__main { display: grid; gap: 2px; min-width: 0; }
.app-item__amt { font: 500 13px/1.35 var(--mono); color: var(--green-hi); }
.app-item__sub { font: 400 11px/1.4 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-item__tx { display: inline-flex; align-items: center; min-height: 40px; font: 400 11px/1 var(--mono); white-space: nowrap; }

.app-side-win .os-window__body { padding: 6px 16px; }
.eng-kv > div { padding: 9px 0; }
.eng-kv dt { font-size: 13px; color: var(--muted); }
.eng-kv dd { font-size: 12.5px; }

.app-foot { margin-top: 28px; max-width: 62em; font-size: 13px; line-height: 1.65; color: var(--muted); }
.app-foot a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.app-foot a:hover { text-decoration-color: var(--green); }

/* ---------------------------------------------------------------- wallet chip in the bar */
.os-window__meta[data-user-address] { text-transform: none; letter-spacing: 0.04em; }
.term-bar [data-shell='wallet'][data-user-address] { text-transform: none; letter-spacing: 0.02em; border-color: var(--green-line); background: var(--green-dim); color: var(--ink); }
.term-bar [data-shell='wallet'][data-user-address] svg { color: var(--green); }
.term-bar [data-shell='wallet'][data-user-address]:hover { border-color: var(--green); }

/* ---------------------------------------------------------------- popovers and the wallet modal */
.app-pop { position: absolute; z-index: 80; width: min(380px, calc(100vw - 20px)); }
.app-pop--wallet { width: min(320px, calc(100vw - 20px)); }
.app-pop > .os-window, .app-modal__win { border-color: var(--line-2); }
.app-pop .os-window__bar, .app-modal .os-window__bar { padding-right: 8px; }
.app-x { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; margin: -10px 0; color: var(--muted); transition: color 0.15s; }
.app-x:hover { color: var(--ink); }
.app-x svg { width: 16px; height: 16px; }

.pick { display: grid; }
.pick__search { width: auto; min-height: 44px; margin: 12px; padding: 0 14px; background: var(--panel-2); border: 1px solid var(--line-2); outline: 0; font: 400 14px/1 var(--font); color: var(--ink); }
.pick__search::placeholder { color: var(--faint); }
.pick__search:focus { border-color: var(--green); }
.pick__list { max-height: min(380px, 55vh); overflow-y: auto; border-top: 1px solid var(--line); scrollbar-width: thin; }
.pick__item { display: grid; grid-template-columns: 28px auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 14px; text-align: left; border-bottom: 1px solid var(--line); transition: background 0.15s; }
.pick__item:last-child { border-bottom: 0; }
.pick__item:hover { background: rgba(236, 242, 239, 0.04); }
.pick__item:focus-visible { outline: 0; background: rgba(236, 242, 239, 0.06); box-shadow: inset 2px 0 0 var(--ink); }
.pick__item[aria-selected='true'] { background: var(--green-dim); box-shadow: inset 2px 0 0 var(--green); }
.pick__sym { font: 500 14px/1.2 var(--font); color: var(--ink); }
.pick__name { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick__edge { font: 400 12px/1 var(--mono); white-space: nowrap; }
.pick__none { padding: 16px; font-size: 13px; color: var(--muted); }

.app-modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; }
.app-modal__back { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.64); }
@supports (backdrop-filter: blur(2px)) { .app-modal__back { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); } }
.app-modal__win { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.wallets { display: grid; gap: 14px; }
.wallets__list { display: grid; gap: 8px; }
.wallet-opt { justify-content: flex-start; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px; font: 500 14px/1 var(--font); text-transform: none; letter-spacing: 0; }
.wallet-opt img { width: 24px; height: 24px; flex: none; }
.wallet-opt__ph { width: 24px; height: 24px; flex: none; background: var(--panel-3); border: 1px solid var(--line-2); }
.wallet-opt[disabled] { cursor: progress; }
.wallets__msg { font-size: 13px; line-height: 1.55; color: var(--text); }
.wallets__msg:empty { display: none; }
.wallets__msg.is-err { color: var(--red); }
.wallets__list .wallets__msg { padding: 14px 16px; border: 1px dashed var(--line-3); color: var(--ink); }
.wallets__fine { font-size: 12px; line-height: 1.6; color: var(--muted); }

.wallet-menu { display: grid; gap: 10px; }
.wallet-menu__addr { padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); font: 400 12.5px/1.5 var(--mono); color: var(--ink); word-break: break-all; }
.wallet-menu__meta { font-size: 12.5px; color: var(--muted); }
.wallet-menu .os-button { width: 100%; }

/* ---------------------------------------------------------------- /app small screens */
@media (max-width: 760px) {
  .mkt { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: end; gap: 16px; }
  .app-pick { grid-column: 1 / -1; width: 100%; }
  .app-pick__caret { margin-left: auto; }
  .mkt__strip { width: auto; }
  .mkt__meta { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
  .mkt__big { font-size: 24px; }
}
@media (max-width: 699px) { .app-col--side { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================ /markets */
.mk-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 16px; font: 400 11px/1.5 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.mk-kicker span { display: inline-flex; align-items: center; gap: 8px; }
.mk-kicker .live-dot { width: 5px; height: 5px; }

.mk-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin-bottom: 16px; background: var(--line); border: 1px solid var(--line); }
.mk-stat { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 16px 18px; background: var(--panel-solid); }
.mk-stat__k { display: flex; align-items: center; gap: 8px; font: 400 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.mk-stat__k::before { content: ''; width: 5px; height: 5px; flex: none; background: var(--faint); }
.mk-stat:first-child .mk-stat__k::before { background: var(--green); }
.mk-stat__v { font: 500 22px/1.15 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--ink); overflow-wrap: anywhere; }
.mk-stat__v.is-loading { font-size: 15px; }
.mk-stat__s { font-size: 12px; line-height: 1.45; color: var(--muted); }
@media (max-width: 1200px) { .mk-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .mk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mk-stat { padding: 14px; } .mk-stat__v { font-size: 19px; } }

.mk-sec { margin-top: 16px; }
.mk-sec + .mk-sec { margin-top: 28px; }
.mk .os-window__bar { flex-wrap: wrap; row-gap: 4px; }
.mk-note { margin-top: 12px; max-width: 72em; font-size: 13px; line-height: 1.65; color: var(--muted); }
.mk-note b { font-weight: 500; color: var(--ink); }
.mk-note a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.mk-note a:hover { text-decoration-color: var(--green); }

/* consensus table */
.mk-table { container: mktable / inline-size; }
.otable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.otable { width: 100%; }
.otable th:first-child, .otable td:first-child { padding-left: 20px; }
.otable th:last-child, .otable td:last-child { padding-right: 20px; }
.otable td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; font: 400 13px/1.4 var(--mono); color: var(--ink); }
.otable td.c-stock { font-family: var(--font); }
.otable tbody tr:last-child td { border-bottom: 0; }
.otable tbody tr[data-sym] { transition: background 0.15s; }
.otable tbody tr[data-sym]:hover { background: rgba(236, 242, 239, 0.025); }
.otable td.c-twapdev, .otable td.c-depth, .otable td.c-pools { color: var(--text); }
.otable .sub { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.otable .c-tag { width: 1%; }
.th-sm { display: none; }
@container mktable (max-width: 980px) { .otable .c-twapdev { display: none; } }
@container mktable (max-width: 820px) { .otable .c-pools { display: none; } }
@container mktable (max-width: 680px) { .otable .c-twap { display: none; } }
@container mktable (max-width: 560px) {
  .otable .c-depth { display: none; }
  .otable th, .otable td { padding-left: 8px; padding-right: 8px; }
  .otable th:first-child, .otable td:first-child { padding-left: 14px; }
  .otable th:last-child, .otable td:last-child { padding-right: 14px; }
  .otable .stk__name { max-width: 8.5em; }
  .th-lg { display: none; }
  .th-sm { display: inline; }
}
@container mktable (max-width: 380px) { .otable .app-logo { display: none; } }
@container mktable (max-width: 330px) { .otable .chip { font-size: 0; gap: 0; padding: 6px; } }

/* heat table */
.heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.heat { width: 100%; border-collapse: separate; border-spacing: 2px; padding: 8px 10px 10px; font: 400 12px/1 var(--mono); }
.os-window .heat th, .os-window .heat td { border: 0; }
.heat thead th { padding: 8px 6px 10px; font: 400 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); text-align: center; white-space: nowrap; }
.heat thead th:first-child { text-align: left; padding-left: 8px; }
.heat th small { display: block; margin-top: 2px; font-size: 10px; letter-spacing: 0.04em; color: var(--faint); }
.heat .heat__sym { padding: 0 14px 0 8px; font: 500 12px/1 var(--mono); color: var(--ink); text-align: left; white-space: nowrap; }
.heat td { height: 30px; min-width: 62px; padding: 0 6px; text-align: center; vertical-align: middle; color: var(--ink); font-variant-numeric: tabular-nums; }
.h-none { background: rgba(236, 242, 239, 0.015); }
.h-thin { font-size: 10.5px; color: var(--faint); background: repeating-linear-gradient(135deg, rgba(236, 242, 239, 0.07) 0 2px, transparent 2px 6px); }
.h-0 { background: rgba(236, 242, 239, 0.06); color: var(--text); }
.h-p1 { background: rgba(0, 200, 5, 0.1); }
.h-p2 { background: rgba(0, 200, 5, 0.2); }
.h-p3 { background: rgba(0, 200, 5, 0.34); }
.h-p4 { background: rgba(0, 200, 5, 0.55); color: #fff; }
.h-n1 { background: rgba(255, 91, 79, 0.1); }
.h-n2 { background: rgba(255, 91, 79, 0.2); }
.h-n3 { background: rgba(255, 91, 79, 0.32); }
.h-n4 { background: rgba(255, 91, 79, 0.5); color: #fff; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font: 400 11px/1.4 var(--mono); color: var(--muted); }
.heat-legend span { display: inline-flex; align-items: center; gap: 8px; }
.heat-legend i { display: inline-block; width: 16px; height: 10px; }
.l-n4 { background: rgba(255, 91, 79, 0.5); }
.l-n2 { background: rgba(255, 91, 79, 0.2); }
.l-0 { background: rgba(236, 242, 239, 0.1); }
.l-p2 { background: rgba(0, 200, 5, 0.2); }
.l-p4 { background: rgba(0, 200, 5, 0.55); }
.l-thin { background: repeating-linear-gradient(135deg, rgba(236, 242, 239, 0.22) 0 2px, transparent 2px 5px); border: 1px solid var(--line-2); }

/* how to read it */
.mk-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mk-card .os-window__body { display: grid; gap: 10px; }
.mk-card h3 { font: 500 17px/1.3 var(--font); letter-spacing: -0.01em; color: var(--ink); }
.mk-card p { font-size: 14px; line-height: 1.65; color: var(--text); }
@media (max-width: 1100px) { .mk-cards { grid-template-columns: minmax(0, 1fr); } }

/* read it yourself */
.mk-code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font: 400 12.5px/1.75 var(--mono); color: var(--text); scrollbar-width: thin; tab-size: 2; }
.mk-code .c { color: var(--faint); }
.mk-code .k { color: var(--green); }

@media (max-width: 640px) {
  .mk .os-window__meta { flex: 1 1 100%; text-align: left; white-space: normal; }
  .mk .os-window__bar { padding: 12px 14px; }
  .mk-card .os-window__body, .mk-code pre { padding: 16px 14px; }
  .heat { padding: 6px; }
}

/* the wallet button is an app control: 40px tall like every other tap target (base .term-bar .btn is 38px) */
.term-bar [data-shell='wallet'] { min-height: 40px; }

/* Ask Orbio (js/orbio.js) */
.orbio { border-color: rgba(0, 200, 5, 0.28); }
.orbio__by { color: var(--muted); text-decoration: none; }
.orbio__by:hover { color: var(--green); }
.orbio__body { padding: 16px 18px 16px; display: grid; gap: 12px; }
.orbio__presets { display: flex; flex-wrap: wrap; gap: 6px; }
.orbio__chip { min-height: 32px; padding: 0 10px; border: 1px solid var(--line-2); font: 400 12px/1 var(--font); color: var(--text); background: transparent; }
.orbio__chip:hover:not([disabled]) { border-color: var(--green-line); color: var(--ink); }
.orbio__chip[disabled], .orbio__send[disabled] { opacity: 0.5; cursor: wait; }
.orbio__form { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.orbio__q, .orbio__model { min-height: 40px; min-width: 0; padding: 0 10px; background: rgba(4, 6, 5, 0.8); border: 1px solid var(--line-2); color: var(--ink); font: 400 13px/1 var(--font); }
.orbio__q:focus, .orbio__model:focus { outline: none; border-color: var(--green-line); }
.orbio__model { font: 400 11.5px/1 var(--mono); }
.orbio__send { min-height: 40px; }
.orbio__answer { max-height: 340px; overflow-y: auto; font-size: 13.5px; line-height: 1.6; color: var(--text); border-top: 1px solid var(--line); padding-top: 12px; }
.orbio__answer p + p, .orbio__answer ul + p, .orbio__answer p + ul { margin-top: 8px; }
.orbio__answer ul { padding-left: 16px; list-style: square; }
.orbio__answer li + li { margin-top: 4px; }
.orbio__answer b { color: var(--ink); font-weight: 500; }
.orbio__answer a { color: var(--green); }
.orbio__answer code { font: 400 12px/1 var(--mono); color: var(--ink); }
.orbio__hint { color: var(--muted); }
.orbio__thinking { color: var(--muted); }
.orbio__status { font: 400 11px/1.5 var(--mono); color: var(--muted); }
.orbio__status[data-kind="ok"] { color: var(--green); }
.orbio__status[data-kind="warn"] { color: var(--amber); }
@media (max-width: 420px) { .orbio__form { grid-template-columns: 1fr 1fr; } .orbio__q { grid-column: 1 / -1; } }
