/* theme_33.css — v33 additions: light theme, colour-blind-safe palette,
   dashboard widgets, calculation panels. Loaded after theme_30.css.
   Green = up and red = down in every theme. */

.widget30.wide { grid-column: 1 / -1; }
#h-widgets > .widget30 { margin-bottom: 0; }

/* calculation trail under assistant answers */
.calc30 { margin-top: 6px; font-size: 12px; }
.calc30 summary { cursor: pointer; color: var(--accent); }
.calcstep { margin: 6px 0; }
.calcstep pre { white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto;
  background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
  font: 11px ui-monospace, Menlo, Consolas, monospace; color: var(--text-dim); margin: 4px 0 0; }

/* light theme */
body.theme-light {
  --bg: #f5f7fb; --bg-elev: #ffffff; --bg-card: #ffffff; --border: #dbe2ee;
  --text: #111827; --text-dim: #5b6475; --accent: #2563eb;
  --green: #15803d; --red: #dc2626; --amber: #b45309;
  color-scheme: light;
}
body.theme-light .topbar { background: rgba(245,247,251,.9); }
body.theme-light .tabbar { background: rgba(255,255,255,.95); }
body.theme-light .msg30.me { background: #dbeafe; }
body.theme-light .calcstep pre { background: #f1f5f9; }
body.theme-light input, body.theme-light select, body.theme-light textarea { background: #fff; color: var(--text); }
body.theme-light svg.c30 text { fill: #5b6475; }
body.theme-light .cmdk30 .box { background: #fff; }

/* colour-blind-safe: keep the meaning (green up, red down) but use the
   most separable green/red pair and add arrows so colour is never the only cue */
body.cb-safe { --green: #1b9e77; --red: #d95f02; }
body.cb-safe .up30::before { content: '▲ '; font-size: .8em; }
body.cb-safe .dn30::before { content: '▼ '; font-size: .8em; }

/* stock page: full Inspector analysis */
.sp-insp { grid-column: 1 / -1; padding: 0 12px 24px; }
.ins-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.ins-head .card-title { margin: 0; }
.ins-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ins-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 1100px) { .ins-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.ins-s { margin: 0; }
.ins-s > summary { cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; list-style: none; }
.ins-s > summary::-webkit-details-marker { display: none; }
.ins-s > summary::before { content: '▸'; color: var(--text-dim); transition: transform .15s; }
.ins-s[open] > summary::before { transform: rotate(90deg); }
.ins-s > summary + * { margin-top: 8px; }
.ins-b { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
.ins-b.pend { color: var(--accent); border-color: var(--accent); }
.ins-l { font-size: 13px; line-height: 1.45; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.ins-l.ind { color: var(--text-dim); padding-left: 12px; }
.ins-l.h { font-weight: 600; margin-top: 8px; color: var(--accent); }
.ins-tw { overflow-x: auto; margin-top: 6px; }
.ins-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ins-t th, .ins-t td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.ins-t thead th { color: var(--text-dim); font-weight: 500; white-space: nowrap; }
.ins-t tbody th { font-weight: 500; color: var(--text-dim); white-space: nowrap; }
.ins-t td.up30 { color: var(--green); }
.ins-t td.dn30 { color: var(--red); }

/* assistant: Claude-style chat list */
.chatwrap33 { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.chatlist33 { position: sticky; top: 0; max-height: calc(100vh - 150px); overflow-y: auto; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.chatlist33 input { margin: 0; padding: 6px 10px; }
.grp33 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin: 10px 4px 2px; }
.th33 { display: flex; align-items: center; gap: 4px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.th33:hover { background: rgba(127,127,127,.12); }
.th33.on { background: rgba(59,130,246,.18); }
.th33 .tt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th33 .acts { display: none; gap: 2px; }
.th33:hover .acts, .th33.on .acts { display: flex; }
.th33 .acts button { background: none; border: 0; padding: 2px 4px; cursor: pointer; font-size: 12px; border-radius: 6px; color: inherit; }
.th33 .acts button:hover { background: rgba(127,127,127,.2); }
.chathead33 { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.chathead33 .t { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chathead33 button:disabled { opacity: .4; cursor: default; }
#as-menu { display: none; }
@media (max-width: 899px) {
  .chatwrap33 { grid-template-columns: 1fr; }
  #as-menu { display: inline-flex; }
  .chatlist33 { display: none; position: fixed; z-index: 60; left: 8px; right: 8px; top: 70px; max-height: 70vh;
    box-shadow: 0 12px 40px rgba(0,0,0,.45); }
  .chatlist33.open { display: flex; }
  .th33 .acts { display: flex; }          /* no hover on touch screens */
}

/* tables in assistant answers */
.mdt-wrap { overflow-x: auto; margin: 6px 0; }
.mdt30 { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.mdt30 th, .mdt30 td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.mdt30 th:first-child, .mdt30 td:first-child { text-align: left; }
.mdt30 thead th { color: var(--text-dim); font-weight: 500; }
.mdt30 td.up30 { color: var(--green); }
.mdt30 td.dn30 { color: var(--red); }

/* ═══ Home 33.1 — dashboard layout ═══════════════════════════════════════ */
@media (min-width: 768px) { #content { max-width: 1680px; } }        /* use the whole window */
.home33 { --gap33: 14px; }
.hh33 { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin: 2px 0 16px; }
.hello33 .hi { font-size: 24px; font-weight: 750; letter-spacing: -.3px; }
.hello33 .sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.stale33 { color: var(--amber, #f59e0b); font-weight: 600; }
.qa33 { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; justify-content: center; }
.qbtn33 { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s; }
.qbtn33:hover { border-color: var(--accent); background: rgba(59,130,246,.10); }
.qbtn33.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.hact33 { margin: 0 !important; gap: 6px !important; }
.hact33 .pill30 { font-size: 11px; }

.dash33 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap33); align-items: start; }
.dash33 > [data-w] { grid-column: span 12; min-width: 0; }
.dash33 > [data-w].hidden { display: none; }
@media (min-width: 1180px) {
  .dash33 > [data-w="brief"] { grid-column: span 5; }
  .dash33 > [data-w="moves"] { grid-column: span 4; }
  .dash33 > [data-w="pulse"] { grid-column: span 3; }
  .dash33 > [data-w="news"]  { grid-column: span 5; }
  .dash33 > [data-w="earn"]  { grid-column: span 3; }
  .dash33 > [data-w="watch"] { grid-column: span 4; }
}
@media (min-width: 768px) and (max-width: 1179px) {
  .dash33 > [data-w]:not([data-w="tiles"]) { grid-column: span 6; }
}

/* cards */
.home33 .card { margin: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)) , var(--bg-card); }
.home33 .h30 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 650; margin-bottom: 10px; }
.home33 .h30 .pill30, .home33 .h30 .btn30 { text-transform: none; letter-spacing: 0; }
.home33 .btn30.sm, .home33 .h30 .btn30 { padding: 3px 9px; font-size: 12px; }
.home33 .empty30 { padding: 14px 4px; font-size: 13px; }
.home33 .note30 { font-size: 11.5px; }
.home33 .plain30 { font-size: 12px; }

/* number tiles */
.tiles33 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap33); }
.home33 .tile30 { position: relative; overflow: hidden; padding: 14px 16px 12px; border-radius: 14px; }
.home33 .tile30::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border); }
.home33 .tile30.up::before { background: var(--green); }
.home33 .tile30.dn::before { background: var(--red); }
.home33 .tile30 .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.home33 .tile30 .v { font-size: 24px; letter-spacing: -.3px; margin-top: 4px; }
.home33 .tile30 .s { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skel33 { min-height: 78px; animation: pulse33 1.2s ease-in-out infinite; }
@keyframes pulse33 { 50% { opacity: .5; } }

/* briefing */
#h-brief .list30, #h-brief ul { margin: 0; padding-left: 18px; }
#h-brief li { font-size: 13.5px; line-height: 1.5; margin: 0 0 8px; }
#h-brief { font-size: 13.5px; line-height: 1.5; }

/* why it moved: one line each, tap to expand */
.mv33 { border-bottom: 1px solid var(--border); }
.mv33:last-of-type { border-bottom: 0; }
.mv33 > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 9px 2px; cursor: pointer; font-size: 14px; }
.mv33 > summary::-webkit-details-marker { display: none; }
.mv33 > summary .sym { min-width: 54px; }
.mv33 > summary .sp { flex: 1; }
.mv33 > summary .why { font-size: 12px; }
.mv33 > summary::after { content: '›'; color: var(--text-dim); transition: transform .15s; }
.mv33[open] > summary::after { transform: rotate(90deg); }
.mvtxt { font-size: 12.5px; line-height: 1.5; color: var(--text-dim); padding: 0 2px 10px; }

/* market pulse */
.quad33 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.quad33 .q { border-radius: 10px; padding: 8px 10px; font-size: 12.5px; background: rgba(127,127,127,.08); }
.quad33 .ql { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 2px; }
.quad33 .leading { box-shadow: inset 3px 0 0 var(--green); }
.quad33 .improving { box-shadow: inset 3px 0 0 #60a5fa; }
.quad33 .weakening { box-shadow: inset 3px 0 0 var(--amber, #f59e0b); }
.quad33 .lagging { box-shadow: inset 3px 0 0 var(--red); }
.sub33 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin: 8px 0 2px; }
.pr33 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
.pr33 span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* earnings ahead */
.er33 { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.er33:last-child { border-bottom: 0; }
.er33:hover b { color: var(--accent); }
.er33 .d { font-size: 11px; min-width: 64px; text-align: center; padding: 2px 6px; border-radius: 999px; background: rgba(127,127,127,.12); }
.er33 .d.soon { background: rgba(245,158,11,.18); color: var(--amber, #f59e0b); font-weight: 600; }
.er33 .dim30 { margin-left: auto; font-size: 12px; }

/* news */
.home33 .news30 { padding: 9px 0; }
.home33 .news30 a { font-size: 13.5px; line-height: 1.4; }
.home33 .news30:last-of-type { border-bottom: 0; }
body.theme-light .home33 .card { background: var(--bg-card); }
.qbtn33 { white-space: nowrap; }
@media (max-width: 1179px) {
  .qa33 { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .hello33 { flex: 1; }
}
/* wide: tiles on top, then three columns 5 / 4 / 3 */
.dash33.cols33 { grid-template-columns: 5fr 4fr 3fr; }
.dash33.cols33 > [data-w="tiles"] { grid-column: 1 / -1; }
.col33 { display: flex; flex-direction: column; gap: var(--gap33); min-width: 0; }
.col33 > [data-w] { grid-column: auto !important; }
.er33 .dim30 { white-space: nowrap; }

/* stock page: the side panel must not float over the Full analysis below */
.sp-side { position: static !important; }
.sp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-dim); margin: 8px 2px 4px; }
.sp-legend b { font-weight: 700; margin-right: 3px; }

/* stock page: 1-minute volume analysis */
.sp-flow { margin: 10px 2px 6px; font-size: 13px; }
.sp-flow:empty { display: none; }
.flow-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 6px; }
.flow-risk { border: 1px solid; border-radius: 999px; padding: 2px 10px; font-weight: 700; text-transform: capitalize; }
.flow-why { margin: 4px 0 6px 18px; padding: 0; color: var(--text-dim); font-size: 12.5px; }
.flow-watch { background: rgba(127,127,127,.08); border-radius: 10px; padding: 8px 10px; margin: 6px 0; display: grid; gap: 3px; }
.flow-ev { display: grid; gap: 3px; margin: 6px 0; font-size: 12.5px; }
.flow-ev .up { color: var(--green); } .flow-ev .down { color: var(--red); }
.flow-note { font-size: 11px; margin-top: 4px; }

/* ═══ stock page 33.3 — trade plan, evidence, polish ═══════════════════ */
.stock-page .card { border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0)), var(--bg-card); }
.stock-page .card-title, .plan-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim);
  font-weight: 650; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.plan-h .sp { flex: 1; }
.plan-h .note30, .plan-h .pill30 { text-transform: none; letter-spacing: 0; }
.plan33 { margin-bottom: 12px; }
.plan-verdict { font-size: 16px; font-weight: 700; line-height: 1.35; padding: 10px 12px; border-radius: 10px;
  background: rgba(127,127,127,.10); margin-bottom: 10px; }
.plan-verdict.up30 { background: rgba(47,208,122,.12); color: var(--green); }
.plan-verdict.dn30 { background: rgba(255,93,93,.12); color: var(--red); }
.plan-verdict.warn33, .warn33 { background: rgba(245,158,11,.12); color: var(--amber, #f59e0b); }
.pl-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin: 12px 0 4px; }
.pl-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.pl-row:last-child { border-bottom: 0; }
.pl-k { font-weight: 650; font-size: 14px; display: flex; flex-direction: column; gap: 1px; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 2px 12px; font-size: 13px; margin: 4px 0; }
.pl-grid b { font-variant-numeric: tabular-nums; }
.pl-sell { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.pl-ai { margin: 12px 0 6px; }
.pl-ai-text { font-size: 13.5px; line-height: 1.5; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(127,127,127,.07); }
.sp-evid { grid-column: 1 / -1; padding: 0 12px; }
.evid33 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 12px 0; }
.evid33 .card { margin: 0; }
.evid33 .ev-main { grid-column: 1 / -1; }
.ev-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.45; }
.ev-row:last-child { border-bottom: 0; }
.ev-dot { color: var(--text-dim); }
.ev-dot.up30 { color: var(--green); } .ev-dot.dn30 { color: var(--red); }
.vchk { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; margin-left: 6px; font-weight: 600; }
.vchk.ok { background: rgba(47,208,122,.15); color: var(--green); }
.vchk.no { background: rgba(127,127,127,.15); color: var(--text-dim); }
.ev-ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.ev-ul li { margin-bottom: 4px; }
.ev-ul.heads { list-style: none; padding-left: 0; margin-top: 8px; }
.ev-ul li.up30 { color: var(--green); } .ev-ul li.dn30 { color: var(--red); }
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 500px) { .stock-page .sp-body { grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr); } }

/* broker row (All / HSBC HK / IBHK) + IBHK tab */
.broker-bar { margin-bottom: 8px; }
.broker-bar button { font-weight: 650; }
.broker-note { font-size: 11.5px; margin: -4px 2px 10px; }
.ibhk-card .ibhk-status { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-top: 6px; }
.ibhk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); display: inline-block; }
.ibhk-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(47,208,122,.2); }
.ibhk-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }

.ibhk-ccy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.ibhk-ccy > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: rgba(127,127,127,.08); }
.ibhk-ccy b { font-size: 16px; font-variant-numeric: tabular-nums; }
.ibhk-ccy .muted { font-size: 11px; }

/* ═══ v33.4 UI polish ═══════════════════════════════════════════════════ */
/* Numbers never jump sideways when prices refresh. */
body, .card, table, .val, .num, .pill, .yf-total { font-variant-numeric: tabular-nums; }

/* Compact summary: headline left, figures right on wide screens. */
.yf-summary { padding: 14px 16px 10px; }
.yf-total { font-size: 34px; }
.yf-grid { margin-top: 10px; }
.yf-cell { padding: 6px 0; font-size: 12.5px; }
@media (min-width: 900px) {
  .yf-summary { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); column-gap: 28px; align-items: start; }
  .yf-summary .yf-grid { margin-top: 0; grid-template-columns: 1fr 1fr; }
  .yf-summary > p, .yf-summary .yf-foot { grid-column: 1 / -1; }
}
@media (max-width: 599px) {
  .yf-total { font-size: 30px; }
  .yf-grid { column-gap: 12px; }
  .yf-cell { font-size: 12px; padding: 5px 0; }
}

/* Needs-a-look strip. */
.attn33 { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); }
.attn33.calm { font-size: 12.5px; color: var(--text-dim); }
.attn-ok { color: var(--green); font-weight: 700; margin-right: 4px; }
.attn-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
.attn-groups { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.attn-g { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.attn-k { font-size: 12px; font-weight: 600; padding-left: 8px; border-left: 3px solid var(--text-dim); }
.attn-g.tone-down .attn-k { border-color: var(--red); }
.attn-g.tone-warn .attn-k { border-color: var(--amber, #f5b53d); }
.attn-g.tone-up .attn-k { border-color: var(--green); }
.attn-g.tone-info .attn-k { border-color: var(--accent); }
.attn-chip { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 999px;
             padding: 3px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.attn-chip:hover { border-color: var(--accent); }
.attn-chip small { font-weight: 500; color: var(--text-dim); }
.attn-chip small.up { color: var(--green); } .attn-chip small.down { color: var(--red); }
.attn-note { font-size: 10.5px; margin-top: 6px; }

/* Allocation card: donut + largest positions side by side. */
.alloc-top { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.alloc-top-h { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.alloc-bar { display: grid; grid-template-columns: 56px 1fr 48px; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; cursor: pointer; }
.alloc-bar .sym { font-weight: 700; }
.alloc-bar .bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.alloc-bar .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4c8dff, #7b5dff); border-radius: 4px; }
.alloc-bar .num { text-align: right; color: var(--text-dim); }
@media (min-width: 900px) {
  .alloc-card { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); column-gap: 28px; }
  .alloc-card > .card-title { grid-column: 1 / -1; }
  .alloc-top { margin-top: 0; padding-top: 0; border-top: 0; padding-left: 24px; border-left: 1px solid var(--border); }
}

/* Holdings table view. */
.hold-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.htable-wrap { overflow-x: auto; margin: 0 -4px; }
.htable { width: 100%; border-collapse: collapse; font-size: 13px; }
.htable th { font-size: 11px; font-weight: 600; color: var(--text-dim); text-align: left; padding: 6px 8px;
             border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none; }
.htable th.on { color: var(--accent); }
.htable th.num, .htable td.num { text-align: right; }
.htable tr.hrow { cursor: pointer; }
.htable td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.htable tr.hrow:hover td { background: rgba(76,141,255,.06); }
.htable tr.sub td { font-size: 12px; color: var(--text-dim); padding-top: 4px; padding-bottom: 4px; background: rgba(0,0,0,.12); }
.htable td.sym { font-weight: 700; font-size: 14px; }
.htable td .sl { font-size: 10.5px; font-weight: 500; color: var(--text-dim); margin-left: 4px; }
.htable td .sm { font-size: 10.5px; }
.htable td.spk, .htable th.spk { width: 70px; cursor: default; }
.htable .hg { background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 0 6px 0 0; font-size: 12px; }
.htable .hg-pad { display: inline-block; width: 18px; }
.htable .warn-t { color: #e67e22; font-size: 10px; }
.wbar { height: 3px; background: var(--bg); border-radius: 2px; margin-top: 3px; margin-left: auto; width: 56px; overflow: hidden; }
.wbar i { display: block; height: 100%; background: var(--accent); }
@media (max-width: 599px) {
  .htable td.spk, .htable th.spk, .htable th:nth-child(2), .htable td:nth-child(2) { display: none; }
  .htable { font-size: 12px; }
  .htable td { padding: 7px 5px; }
}

/* Rotation map: tails only for the sector in focus. */
.rrg-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.rrg33 .rrg-tail { opacity: 0; transition: opacity .15s ease; pointer-events: none; }
.rrg33.all .rrg-tail { opacity: .7; }
.rrg33 .rrg-s.on .rrg-tail { opacity: 1; }
.rrg33.has-focus .rrg-s:not(.on) { opacity: .25; }
.rrg33 .rrg-s { transition: opacity .15s ease; }
.mfsum33 { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.mfsum33 div::before { content: '◆ '; color: var(--accent); font-size: 10px; }

/* Sidebar: small icons on sub-screens too, and count badges. */
@media (orientation: landscape) and (min-width: 700px) and (min-height: 500px) {
  .tabbar .tab.sub { padding-left: 26px; }
  .tabbar .tab.sub .ico { display: inline-block; font-size: 12px; width: 18px; margin-right: 6px; opacity: .75; filter: saturate(.6); }
  .tabbar .tab.sub.active .ico { opacity: 1; filter: none; }
  .tabbar .tab { position: relative; }
  .tabbar .tab .nb30 { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
}
.nb30 { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px;
        font-size: 10.5px; font-weight: 700; text-align: center; color: #fff; background: var(--accent); }
.nb30.red { background: var(--red); } .nb30.amber { background: var(--amber); color: #111; }
@media not all and (orientation: landscape) and (min-width: 700px) and (min-height: 500px) {
  .tabbar .tab { position: relative; }
  .tabbar .tab .nb30 { position: absolute; top: 2px; right: calc(50% - 22px); transform: scale(.85); }
}

/* Skeleton placeholders while a card loads (instead of "Loading…"). */
.skel30 { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.skel30 i { display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(100deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.10) 50%, rgba(255,255,255,.04) 70%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.skel30 i:nth-child(1) { width: 85%; } .skel30 i:nth-child(2) { width: 65%; } .skel30 i:nth-child(3) { width: 45%; }
body.theme-light .skel30 i { background: linear-gradient(100deg, rgba(0,0,0,.05) 30%, rgba(0,0,0,.10) 50%, rgba(0,0,0,.05) 70%); background-size: 200% 100%; }

/* Phone stock page: plan summary above the chart. */
.sp-planstrip:empty { display: none; }
.sp-planstrip { margin: 4px 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-card); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.sp-planstrip .ps-v { font-weight: 700; font-size: 13.5px; grid-column: 1; }
.sp-planstrip .ps-n { font-size: 12.5px; grid-column: 1; color: var(--text-dim); }
.sp-planstrip .ps-n b { color: var(--text); }
.sp-planstrip .ps-sep { margin: 0 6px; opacity: .5; }
.sp-planstrip .ps-go { grid-column: 2; grid-row: 1 / span 2; background: rgba(91,156,255,.12); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
@media (orientation: landscape) and (min-width: 1000px) and (min-height: 500px) { .sp-planstrip { display: none !important; } }

/* Live prices (33.6) */
.lv-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: var(--text-dim); }
.lv-dot.live { background: var(--green); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: lvpulse 2s infinite; }
.lv-dot.ext { background: var(--amber, #f59e0b); }
@keyframes lvpulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.tick-up { animation: tickup .9s ease-out; } .tick-down { animation: tickdn .9s ease-out; }
@keyframes tickup { 0% { background: rgba(34,197,94,.35); } 100% { background: transparent; } }
@keyframes tickdn { 0% { background: rgba(239,68,68,.35); } 100% { background: transparent; } }
.sp-src .lv-dot { margin-left: 0; }
.sp-ext { font-size: 13px; margin-top: 2px; }

/* Records (33.7) */
.quickadd { display: flex; gap: 8px; margin: -4px 0 10px; flex-wrap: wrap; }
.quickadd button { flex: 1 1 0; min-width: 96px; background: var(--bg-card); border: 1px solid var(--border); color: var(--accent);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.quickadd button:hover { border-color: var(--accent); }
.rec-seg { margin-bottom: 12px; }
.recgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.recgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-dim); font-weight: 600; }
.recgrid label.wide { grid-column: 1 / -1; }
.recgrid input, .recgrid select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 10px; font-size: 15px; font-weight: 500; width: 100%; box-sizing: border-box; }
.recrow { display: grid; grid-template-columns: 84px 1fr auto 28px; gap: 8px; align-items: center; padding: 9px 2px;
  border-bottom: 1px solid var(--border); font-size: 13px; }
.recrow .rd { color: var(--text-dim); font-size: 12px; }
.recrow .rtag { white-space: nowrap; margin-left: 8px; font-size: 10.5px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.recrow .ra { text-align: right; font-weight: 600; }
.recdel { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.recdel:hover { color: var(--red); }
.link-btn { background: none; border: 0; color: var(--accent); font-size: 12px; cursor: pointer; float: right; font-weight: 500; }
@media (max-width: 599px) { .recrow { grid-template-columns: 70px 1fr auto 24px; font-size: 12.5px; } }

/* Plan horizons (33.7) */
.hz-seg { margin: 6px 0 10px; }
.hz-seg button { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 6px 4px; }
.hz-seg button small { font-size: 10px; opacity: .7; font-weight: 500; }
.lt-tr { display: grid; grid-template-columns: 24px 80px 36px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.lt-n { width: 22px; height: 22px; border-radius: 50%; background: rgba(91,156,255,.15); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.lt-sh { color: var(--text-dim); font-size: 12px; }
.rec-kind { background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.rec-kind:hover { color: var(--accent); }
.rec-kind-sel { background: var(--bg); color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 3px 6px; font-size: 13px; }
.rec-fixfees { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 4px 0 10px;
  padding: 10px 12px; border: 1px solid var(--amber, #f59e0b); border-radius: 10px; background: rgba(245,158,11,.08); font-size: 13px; }

/* Bottom ticker (33.11) */
#ticker34 { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; height: 30px; display: flex; align-items: center;
  background: rgba(14,18,28,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); font-size: 12.5px; font-variant-numeric: tabular-nums; }
body.theme-light #ticker34 { background: rgba(255,255,255,.95); }
#ticker34 .tk-mode, #ticker34 .tk-x { flex: none; background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 0 8px; height: 100%; font-size: 14px; }
#ticker34 .tk-mode { border-right: 1px solid var(--border); }
#ticker34 .tk-x { font-size: 12px; border-left: 1px solid var(--border); }
#ticker34 .tk-view { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center;
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
#ticker34 .tk-track { display: flex; white-space: nowrap; animation: tk34 40s linear infinite; will-change: transform; }
#ticker34:hover .tk-track, #ticker34.paused .tk-track { animation-play-state: paused; }
#ticker34 .tk-run { display: inline-flex; align-items: center; padding-right: 24px; }
#ticker34 .tk-it { cursor: pointer; padding: 0 2px; }
#ticker34 .tk-it b { font-weight: 700; margin-right: 2px; }
#ticker34 .tk-sep { color: var(--text-dim); opacity: .5; margin: 0 10px; }
#ticker34 .tk-dim { color: var(--text-dim); }
#ticker34 .up { color: var(--green); } #ticker34 .down { color: var(--red); }
#ticker34 .tk-dot { font-size: 9px; margin-right: 5px; color: var(--text-dim); vertical-align: 1px; }
@keyframes tk34 { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { #ticker34 .tk-track { animation: none; } #ticker34 .tk-view { overflow-x: auto; } }
body.has-ticker #content { padding-bottom: 130px; }
body.has-ticker .fab30 { bottom: calc(env(safe-area-inset-bottom, 0px) + 116px); }
@media (orientation: landscape) and (min-width: 700px) and (min-height: 500px) {
  body.has-ticker #content { padding-bottom: 46px; }
  body.has-ticker .fab30 { bottom: 44px; }
}

/* ── iPhone portrait pass (33.11) ───────────────────────────────────────
   One screen used to show only the controls and the summary: two full-height
   switch rows, a half-width figure grid that wrapped ("$98.20 ($49.89 /
   $48.31)" on two lines), a tall attention strip. Everything here is the
   phone-portrait layout only; landscape / iPad / desktop are untouched. */
@media (max-width: 599px) and (orientation: portrait) {
  #content { padding: 10px 10px 96px; }
  .topbar h2, #screen-title { font-size: 22px; }
  .segmented { margin-bottom: 8px; padding: 3px; border-radius: 12px; }
  .segmented button { padding: 7px 4px; font-size: 13px; min-height: 0; border-radius: 9px; }
  .broker-bar, .scope-bar { margin-bottom: 6px; }
  #subnav30 { padding-top: 6px; }
  #subnav30 .chip30 { padding: 5px 10px; font-size: 12.5px; }

  .yf-summary { padding: 12px 14px 8px; }
  .yf-label { font-size: 12px; }
  .yf-total { font-size: 31px; margin: 0 0 2px; }
  .yf-day { font-size: 14px; } .yf-gain { font-size: 12.5px; }
  .yf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 10px; row-gap: 2px; margin-top: 8px; }
  .yf-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 0; border-top: 1px solid var(--border); }
  .yf-cell .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
  .yf-cell .val { text-align: left; font-size: 13.5px; max-width: 100%; line-height: 1.25; }
  .yf-cell .val span { display: block; font-size: 11.5px; }
  .yf-cell .val .muted { display: none; }               /* sleeve split: shown on the sleeve tabs */
  .yf-foot { font-size: 10.5px; margin-top: 6px; }
  .yf-foot .yf-mt5 { display: none; }                    /* MT5 badge: desktop detail */

  .quickadd { gap: 6px; margin: 0 0 8px; }
  .quickadd button { padding: 7px 6px; font-size: 12.5px; min-width: 0; border-radius: 9px; }
  .broker-note { font-size: 10.5px; margin: 0 2px 8px; }

  .attn33 { padding: 8px 10px; }
  .attn-groups { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
  .attn-g { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .attn-g::-webkit-scrollbar { display: none; }
  .attn-k { flex: none; font-size: 11.5px; }
  .attn-chip { flex: none; padding: 3px 9px; font-size: 11.5px; }
  .attn-note { display: none; }

  .alloc-card { padding: 12px 14px; }
  .alloc-card svg { width: 96px; height: 96px; }
  .alloc-top { margin-top: 8px; padding-top: 8px; }
  .holdings-head { flex-wrap: wrap; gap: 6px; }
  .hold-tools { width: 100%; justify-content: space-between; }
  .holdings-list .yf-row { padding: 10px 2px; column-gap: 8px; grid-template-columns: minmax(0, 1fr) 60px auto; }
  body .holdings-list .yf-row .spark { margin-right: 14px; }
  .yf-left .sym { font-size: 15px; }
  .pill { min-width: 62px; font-size: 12.5px; padding: 3px 7px; }
  .card { margin-bottom: 10px; }
  .fab30 { width: 46px; height: 46px; font-size: 20px; right: 12px; }
}

/* IBHK orders (33.11) */
.ib-mode { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; margin-left: 4px; background: var(--bg); color: var(--text-dim); border: 1px solid var(--border); }
.ib-mode.ib-paper { color: #111; background: var(--amber, #f59e0b); border-color: transparent; }
.ib-mode.ib-live { color: #fff; background: var(--red); border-color: transparent; }
.ib-ord { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ib-ord .btn30 { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.ib-pv { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--amber, #f59e0b); border-radius: 10px; background: rgba(245,158,11,.07); font-size: 13px; }
.ib-pv.live { border-color: var(--red); background: rgba(239,68,68,.08); }
.ib-pv-h { font-weight: 700; margin-bottom: 4px; }
.ib-pin { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.ib-pin input { width: 130px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-size: 16px; letter-spacing: .2em; }
.ib-refuse { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(239,68,68,.1); color: var(--red); font-size: 13px; }
.ib-ok { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(34,197,94,.1); color: var(--green); font-size: 13px; font-weight: 600; }

/* Sparkline away from the price (33.12): it sat right against the price
   pill and read as part of it. A gap on its right moves it left, into the
   space between the name and the price. */
.holdings-list .yf-row { column-gap: 10px; }
.holdings-list .yf-row .spark { justify-self: start; margin-right: 22px; }

/* ── 33.13 Scanner & Auto (pages_35.js) ─────────────────────────────── */
.seg35 { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.seg35 button { flex: 1 0 auto; white-space: nowrap; }
.pill30.ok { color: var(--green); border-color: rgba(34,197,94,.4); }
.pill30.bad { color: var(--red); border-color: rgba(239,68,68,.4); }
.pill30.st-lead { color: var(--green); border-color: rgba(34,197,94,.5); background: rgba(34,197,94,.08); }
.pill30.st-imp { color: #60a5fa; border-color: rgba(96,165,250,.5); }
.pill30.st-weak { color: var(--amber); border-color: rgba(245,158,11,.5); }
.pill30.st-lag { color: var(--red); border-color: rgba(239,68,68,.5); }
.warn35 { color: var(--amber); }
.plan35 .h30 { gap: 8px; flex-wrap: wrap; }
.plan35.is-blocked { opacity: .78; }
.sym35 { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; font-size: 16px; }
.tag35 { font-size: 12px; color: var(--text-dim); text-transform: none; letter-spacing: 0; }
.score35 { font-weight: 700; font-variant-numeric: tabular-nums; border: 1px solid var(--border); border-radius: 8px; padding: 1px 7px; }
.lv35 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.lv35 > div { background: rgba(127,127,127,.08); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; min-width: 0; }
.lv35 small { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.lv35 b { font-size: 15px; font-variant-numeric: tabular-nums; }
.lv35 i { font-style: normal; font-size: 11px; color: var(--text-dim); }
.meta35 { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.blk35 { font-size: 12px; color: var(--red); background: rgba(239,68,68,.07); border-radius: 8px; padding: 6px 8px; margin-top: 6px; line-height: 1.45; }
.ev35 { font-size: 11px; margin-top: 6px; }
.fib35 { display: inline-block; font-size: 12px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); margin: 1px 0; }
.fib35.gold { border-color: rgba(245,158,11,.7); color: var(--amber); }
.tblwrap35 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rot35 td { vertical-align: middle; }
.heat35 { white-space: nowrap; }
.heat35 i { display: inline-block; width: 9px; height: 18px; margin-right: 1px; border-radius: 2px; vertical-align: middle; }
.ladder35 { display: grid; gap: 4px; margin: 8px 0; }
.lad35 { border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 13px; color: var(--text-dim); }
.lad35 b { display: inline-block; width: 16px; }
.lad35.on { border-color: var(--accent); color: var(--text); background: rgba(59,130,246,.1); }
.lad35.done { color: var(--text); }
.lad35 small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.btn30.danger { background: rgba(239,68,68,.15); color: var(--red); border-color: rgba(239,68,68,.5); width: 100%; margin-top: 6px; }
@media (max-width: 480px) {
  .lv35 { grid-template-columns: repeat(2, 1fr); }
  .heat35 i { width: 5px; height: 16px; }
  .rot35 .c1m35 { display: none; }
  .rot35 td, .rot35 th { padding-left: 4px; padding-right: 4px; }
}
.evl35 { margin-top: 6px; font-size: 12px; }
.evl35 summary { cursor: pointer; color: var(--text-dim); }
.evl35 > div { padding: 1px 0 1px 4px; }

.warn-card35 { border-color: rgba(245,158,11,.5); }

/* 33.20: selected paper account */
.lv35 > div.on35 { outline: 1px solid var(--accent, #6c8cff); border-radius: 8px; }

/* 34.7: landscape on a phone — charts take the screen's height, the bottom bar steps aside */
@media (orientation: landscape) and (max-height: 520px) {
  #content svg[viewBox][style*="height:1"] { height: 62vh !important; }   /* the big charts only, not sparklines */
  #content .tv-lightweight-charts, #content canvas { max-height: 70vh; }
  .tabbar { transform: translateY(100%); opacity: 0; pointer-events: none; transition: transform .2s, opacity .2s; }
  #content { padding-bottom: 16px; }
}
