/* v3_global_search_1018: header stock search + the stock page */
html,body{overflow-x:hidden}
/* The search form is not a label: the input itself must receive the tap. */
.topbar .topbar-search{min-height:46px}
.topbar .topbar-search input{min-height:44px}
.search-drop-panel .search-clear{min-width:44px;min-height:44px}
.topbar .tbs-cancel,.stock-page .stock-ai-chips .su-chip{min-width:44px;min-height:44px}
/* v3_search_dropdown_1018: the box lives in the topbar itself (never a full-screen takeover) and widens in place on
   focus; results drop down full-width right under the (sticky) topbar, sized from JS off window.visualViewport so
   they always end above the iOS keyboard. html.search-lock blocks page scroll without moving anything, so the
   topbar — and the input inside it — never shifts while the dropdown is open. */
.topbar-search{flex:1 1 auto;min-width:0;max-width:340px;min-height:40px;display:inline-flex;align-items:center;gap:var(--space-2);padding:0 var(--space-3);border:1px solid var(--border);border-radius:var(--radius-pill);background:var(--surface);transition:max-width .15s ease}
.topbar-search .icon{width:18px;height:18px;flex:none;color:var(--muted)}
.topbar-search input{flex:1 1 auto;min-width:0;border:0;background:none;color:var(--ink);font:inherit;font-size:var(--text-sm);outline:0}
.topbar-search input::placeholder{color:var(--muted)}
.topbar-search input:focus-visible{outline:0}
.tbs-cancel{flex:none;min-height:40px;padding:0 0 0 var(--space-2);background:none;border:0;color:var(--accent);font:inherit;font-weight:600;cursor:pointer}
.tbs-cancel:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.topbar.search-active .topbar-search{max-width:none}
.topbar.search-active .topbar-actions{display:none}
.topbar.search-active{width:100%;max-width:100%;min-width:0;justify-content:flex-start}
.topbar.search-active .brand{flex:0 0 auto;white-space:nowrap}
.topbar.search-active .topbar-search{width:0;flex:1 1 0;min-width:0}
@media (max-width:440px){.topbar{gap:6px;padding-inline:var(--space-2)}.topbar-actions{flex:none;gap:var(--space-1)}.topbar-search{gap:var(--space-1);padding:0 6px}.topbar.search-active .brand{gap:var(--space-2)}}
.search-drop-backdrop{position:fixed;left:0;right:0;bottom:0;background:var(--hs-scrim);z-index:15}
.search-drop-panel{position:fixed;left:0;right:0;z-index:21;overflow-y:auto;-webkit-overflow-scrolling:touch;background:var(--surface);color:var(--ink);box-shadow:0 12px 24px -8px var(--hs-shadow);border-bottom:1px solid var(--border);padding:var(--space-3) var(--space-4) var(--space-6)}
.search-drop-head{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2)}
.search-clear{min-height:36px;padding:0 var(--space-2);border:0;background:none;color:var(--accent);font-size:var(--text-xs);font-weight:600}
.search-drop-panel .iv-find-row{width:100%;min-width:0}
.search-drop-panel .iv-find-row[aria-selected="true"]{background:var(--surface-2);outline:2px solid var(--focus);outline-offset:-2px}
.search-drop-panel .iv-find-row mark{background:var(--soft-green);color:var(--up);border-radius:var(--radius-sm);padding:0 1px;font-weight:700}
.search-drop-panel :is(button):focus-visible{outline:3px solid var(--focus);outline-offset:3px}
html.search-lock,html.search-lock body{overflow:hidden;height:100%}
.stock-page{display:flex;flex-direction:column;gap:var(--space-4)}
.stock-head h1{margin:0}
.stock-head p{margin:2px 0 0}
.stock-card{display:flex;flex-direction:column;gap:var(--space-3)}
.stock-card .section-head h2{margin:0}
.stock-quote{display:flex;flex-direction:column;gap:2px}
.stock-sub{font-size:var(--text-sm);color:var(--muted);font-weight:600;margin:var(--space-2) 0 0;text-transform:none}
.stock-pos{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-2)}
.stock-pos .row-main,.stock-pos .row-line,.stock-pos .row-title{width:100%;min-width:0}
.stock-pos .row-line{flex-direction:column;align-items:flex-start;gap:var(--space-1)}
.stock-pos .row-title{overflow-wrap:normal;word-break:normal}
.stock-pos .row-line .row-value{max-width:none;text-align:left}
.stock-pos .su-button{justify-self:start;flex:none}
.stock-held{margin:0}
.stock-held a{color:var(--accent);font-weight:600}
.stock-more>summary{cursor:pointer;color:var(--accent);font-weight:600;min-height:44px;display:flex;align-items:center}
.stock-q{margin:0;font-weight:600}
.stock-acts{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.stock-acts .iv-more{flex:1 1 auto}
.stock-ai-chips{display:flex;flex-wrap:wrap;gap:var(--space-2)}
.stock-ai-chips .su-chip{min-height:40px;text-align:left;cursor:pointer;border:1px solid var(--border)}
.stock-ai-chips .su-chip.selected,.stock-ai-chips .su-chip[aria-pressed="true"]{background:var(--hs-accent-soft);color:var(--accent);border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.stock-ai-form{display:flex;gap:var(--space-2)}
.stock-ai-form button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:84px}
.stock-ai-spinner{width:15px;height:15px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:stock-ai-spin .7s linear infinite}
@keyframes stock-ai-spin{to{transform:rotate(360deg)}}
.stock-ai-progress{font-weight:650;margin:var(--space-3) 0 var(--space-1)}
.stock-ai-step{color:var(--muted);margin:0 0 var(--space-3)}
.stock-ai-form input{flex:1;min-width:0;min-height:44px;padding:0 var(--space-3);border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);color:var(--ink);font:inherit}
.stock-ai-q{margin:var(--space-2) 0}

/* candlestick_charts_1108 (Andy TG113891): Line / Candles toggle and the fixed O/H/L/C readout on the shared chart.
   Row 1 = bar time + toggle; row 2 (Candles only) = Open/High/Low/Close, small labels over values. Both rows have fixed
   heights, so scrubbing never moves anything outside the chart. */
.v3-chart.has-style { height:274px; }
.v3-chart.has-style.is-candles { height:320px; }
.v3-chart-head { display:flex; align-items:center; justify-content:space-between; gap:var(--space-2); height:46px; margin-bottom:10px; }
.v3-chart-head .v3-chart-style { flex:0 0 auto; flex-wrap:nowrap; gap:2px; padding:2px; }
.v3-chart-head .v3-chart-style button { flex:0 0 auto; min-width:0; padding:0 var(--space-3); font-size:var(--text-xs); line-height:16px; font-weight:600; letter-spacing:0; }
.v3-ohlc-when { flex:1 1 auto; min-width:0; margin:0; color:var(--muted); font-size:var(--text-2xs); line-height:16px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-variant-numeric:tabular-nums; }
.v3-chart-ohlc { height:36px; margin:0 0 10px; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); column-gap:var(--space-2); overflow:hidden; }
.v3-ohlc-cell { display:flex; flex-direction:column; min-width:0; overflow:hidden; white-space:nowrap; }
.v3-ohlc-cell i { font-style:normal; color:var(--muted); font-size:11px; line-height:14px; }
.v3-ohlc-cell b { color:var(--ink); font-size:var(--text-2xs); line-height:18px; font-weight:600; font-variant-numeric:tabular-nums; }
.v3-chart.is-candles .v3-wick { stroke-width:1; vector-effect:non-scaling-stroke; }
.v3-chart.is-candles .v3-body.is-doji { stroke-width:1; vector-effect:non-scaling-stroke; }
.v3-chart.is-candles .v3-chart-cross i { display:none; }

/* redesign_v2_stock_1110: one joined detail surface, scoped to this route.
   Light mode inherits the shared palette; dark mode uses the design's exact tokens. */
.ia-comp.stock-page{
  --radius:14px; --pad-card:16px;
  
  gap:0; min-width:0; padding:0;
  background:var(--surface); color:var(--ink);
  border:1px solid var(--border); border-radius:var(--radius);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif;
  font-size:15px; line-height:1.4; font-variant-numeric:tabular-nums;
}
:root:root .stock-page{
    
     
     
    
    
    
}
.stock-page .stock-card{
  min-width:0; margin:0; padding:24px 16px 16px; gap:10px;
  border:0; border-top:1px solid var(--border); border-radius:0;
  background:none; box-shadow:none;
}
/* Stock-chart landscape: let the price surface escape the portrait content column.
   Everything else stays in normal document flow and returns on rotation back. */
@media (orientation:landscape) and (max-height:500px) and (max-width:950px){
  .ia-comp.stock-page{
    position:relative;width:100vw;max-width:100vw;box-sizing:border-box;
    left:50%;transform:translateX(-50%);
  }
  .stock-page .stock-card[data-sec="price"]{
    width:100%;max-width:100%;box-sizing:border-box;
    padding:8px max(14px,env(safe-area-inset-right)) 12px max(14px,env(safe-area-inset-left));
  }
  /* The four-tab Stocks route redirects #/stock/TICKER to #/stocks?symbol=TICKER.
     Its live chart sits in .rs, not in the older .stock-page component. */
  #app.tb-stock-open .rs.rd-page{max-width:none!important;width:100%!important;box-sizing:border-box}
  #app.tb-stock-open .rs.rd-page :is(.rs-hero,.tb-stock-detail,.tb-stock-card){max-width:none!important;width:100%;box-sizing:border-box}
  html.rd-shell:has(#app.tb-stock-open) nav#navigation.navigation:not([hidden]),
  html.rd-shell:has(.stock-page) nav#navigation.navigation:not([hidden]){display:none!important}
  html.rd-shell:has(#app.tb-stock-open),html.rd-shell:has(.stock-page){--shell-tabs:0px}
  .stock-page [data-sec="price"] .stock-overview{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .stock-page [data-sec="price"] .stock-head h1,
  .stock-page [data-sec="price"] .stock-quote .account-value{font-size:20px}
  .stock-page [data-sec="price"] .chart-wrap{margin-top:2px}
  .stock-page [data-sec="price"] .segment button{min-height:38px}
}
.stock-page .stock-card[hidden],.stock-page .section-head[hidden]{display:none}
.stock-page .stock-card[data-sec="price"]{border-top:0;padding-top:16px}
.stock-page .stock-overview{
  display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:start; gap:10px;
}
.stock-page .stock-head{min-width:0}
.stock-page .stock-head h1{font-size:24px;font-weight:700;line-height:1.2;letter-spacing:-.02em;overflow-wrap:anywhere}
.stock-page .stock-head p{font-size:13px;line-height:1.4;overflow-wrap:anywhere}
.stock-page .stock-quote{min-width:0;align-items:flex-end;text-align:right;gap:4px}
.stock-page .stock-quote .account-value{
  max-width:100%;margin:0;font-size:24px;line-height:1.2;font-weight:700;
  letter-spacing:-.02em;overflow-wrap:anywhere;
}
.stock-page .stock-quote .account-change{font-size:13px;line-height:1.4}
.stock-page .stock-quote .stock-missing{font-size:17px;color:var(--muted)}
.stock-page [data-stock-asof]{color:var(--amber)}
.stock-page .stock-card .section-head{margin:0}
.stock-page .stock-card .section-head h2{font-size:17px;font-weight:650;line-height:1.4;letter-spacing:0}
.stock-page .stock-sub{font-size:13px;font-weight:600;margin:24px 0 10px;color:var(--muted)}
.stock-page [data-body] > .stock-sub:first-child{margin-top:0}
.stock-page .stock-unavailable{margin:0;font-size:13px;line-height:1.5}
.stock-page .chart-wrap{min-width:0;margin-top:6px}
.stock-page .stock-chart-status,.stock-page .v3-chart-empty{
  min-height:120px;display:grid;align-content:center;gap:10px;
  padding-block:16px;font-size:13px;color:var(--muted);
}
.stock-page :is([data-stock-note],[data-stock-live]){margin:0;font-size:12px;line-height:1.5}
.stock-page :is([data-stock-note],[data-stock-live]):empty{display:none}
.stock-page .segment{background:var(--surface-2);border:0;border-radius:10px;padding:3px;gap:2px;box-shadow:none}
.stock-page .segment button{
  min-width:0;min-height:44px;padding:6px;font-size:13px;line-height:1.3;
  white-space:normal;color:var(--muted);border:0;border-radius:8px;box-shadow:none;
}
.stock-page .segment button[aria-pressed="true"]{background:var(--bg);color:var(--ink);box-shadow:none}
.stock-page [data-ctl]{display:grid;gap:10px}
.stock-page .stock-q{font-size:15px;font-weight:400}
.stock-page .row{min-height:44px;padding-block:14px;border-color:var(--border);background:none;box-shadow:none}
.stock-page .row-title{font-size:17px;font-weight:650;overflow-wrap:anywhere}
.stock-page .row-meta{font-size:13px;color:var(--muted)}
.stock-page .stock-pos .row-line{flex-direction:row;align-items:flex-start;justify-content:space-between;gap:10px}
.stock-page .stock-pos .row-title{width:auto;flex:1}
.stock-page .stock-entry{display:block;margin-top:4px;font-weight:400}
.stock-page .stock-position-return{flex:0 1 52%;min-width:0;text-align:right}
.stock-page .stock-pos .row-value{
  display:block;max-width:none;white-space:normal;overflow-wrap:anywhere;
  text-align:right;font-size:17px;font-weight:650;
}
.stock-page .stock-pos .su-button{justify-self:end}
.stock-page .stock-held{font-size:13px}
.stock-page :is(.btn,.su-chip,input){box-shadow:none;min-height:44px}
.stock-page .stock-ai-chips .su-chip{background:none;color:var(--muted);font-size:13px;border-radius:10px}
.stock-page .stock-ai-chips .su-chip[aria-pressed="true"]{border-color:var(--accent);color:var(--ink);box-shadow:none}
.stock-page :is(button,a,input,summary):focus-visible{outline:2px solid var(--focus);outline-offset:3px}
.stock-page [data-sec="ai"] [data-body]{display:grid;gap:10px}
.stock-page [data-sec="ideas"] :is(.card,.ia-card){background:none;box-shadow:none;border-radius:0}
/* Inner sections deliberately omit .card: ui.css loads later and otherwise restores
   a rounded border around each one, creating a seam inside the joined surface. */
.stock-page .stock-card > [data-body]{min-width:0}
.stock-page [data-sec="ideas"] [data-body]{display:grid;gap:10px}
.stock-page :is(.iv-answer,.iv-tune-bar,.iv-nbody){
  min-width:0;margin:0;padding:16px 0;border:0;border-radius:0;
  background:none;box-shadow:none;
}
.stock-page .iv-answer{border-top:1px solid var(--border)}
.stock-page .iv-answer.idea-skel{min-height:44px}
.stock-page .iv-tune-bar{border-block:1px solid var(--border);gap:0}
.stock-page .iv-name{padding:0}
.stock-page :is(.iv-name h3,.iv-rn){font-size:17px;line-height:1.4;font-weight:650;overflow-wrap:anywhere}
.stock-page .iv-rw{gap:16px;padding-block:10px;border-block:1px solid var(--border)}
.stock-page .iv-rw > div{min-width:0;padding:0;background:none;border-radius:0}
.stock-page .iv-rw b{font-size:24px;overflow-wrap:anywhere}
.stock-page .iv-rw :is(span,small){line-height:1.5}
.stock-page .iv-dots{font-size:12px;color:var(--muted)}
.stock-page .iv-dots::before{content:attr(aria-label)}
.stock-page .iv-dots i{display:none}
.stock-page .iv-h{margin:14px 0 0;font-size:13px;color:var(--muted);font-weight:600}
.stock-page .iv-nrow{min-width:0;border-bottom:1px solid var(--border)}
.stock-page .iv-row{
  min-height:44px;padding:14px 24px 14px 0;border:0;border-radius:0;
  background:none;box-shadow:none;gap:4px;
}
.stock-page :is(.iv-row,.row):hover{background:var(--surface-2);border-radius:0}
.stock-page .iv-nbody{padding-top:0}
.stock-page .iv-rule > summary{display:flex;align-items:center;gap:6px;min-height:44px}
.stock-page .iv-more{min-height:44px;text-align:left;white-space:normal}
.stock-page .ip-fine{margin:0;font-size:12px;line-height:1.5;color:var(--muted)}
.stock-page .stock-ai-form input{font-size:16px}
@media (min-width:768px){
  .stock-page [data-ctl]{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stock-page .stock-q{grid-column:1 / -1}
  .stock-page .stock-pos{grid-template-columns:minmax(0,1fr) auto;column-gap:16px}
  .stock-page .stock-pos .row-main{grid-column:1;grid-row:1}
  .stock-page .stock-pos .su-button{grid-column:2;grid-row:1;align-self:center}
  .stock-page .stock-pos [data-position-stamp]{grid-column:1 / -1}
  .stock-page .iv-nrow .iv-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:24px}
  .stock-page .iv-nrow .iv-rn{grid-row:1 / 3}
  .stock-page .iv-nrow .iv-rv{grid-column:2;text-align:right}
}
@media (prefers-reduced-motion:reduce){
  .stock-page *{animation:none!important;transition:none!important}
}
