/* BackCom chart app (/{lang}/tools/chart) — T6. Tokens only; full-viewport app chrome. */
body.page-chart { height: 100vh; height: 100dvh; margin: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--color-page); }
body.page-chart > header, body.page-chart > .site-header { flex: none; }
.ch-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ch-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ch-app {
  flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative;
  font-family: var(--font-sans); color: var(--color-ink); background: var(--color-page); font-size: var(--text-sm);
  -webkit-font-smoothing: antialiased;
}
:where(.ch-app) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:where(.ch-app) button:disabled { opacity: .35; cursor: not-allowed; }
:where(.ch-app) :focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.ch-search-in input:focus-visible, .ch-dlg-form textarea:focus-visible, .ch-field input:focus-visible, .ch-field select:focus-visible { outline: none; }
.ch-search-in input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }
.ch-app .ic { width: 18px; height: 18px; flex: none; }
.ch-app .up { color: var(--color-up); }
.ch-app .dn { color: var(--color-down); }
.ch-grow { flex: 1 1 auto; }

/* ---------- top bar ---------- */
.ch-top {
  flex: none; height: 46px; display: flex; align-items: center; gap: 2px; padding: 0 8px;
  background: var(--color-surface-1); border-bottom: 1px solid var(--color-hairline);
}
.ch-sym { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: var(--radius-md); font-size: 15px; letter-spacing: -.01em; }
.ch-sym b { font-weight: 700; }
.ch-sym .ic { width: 15px; height: 15px; color: var(--color-ink-dim); }
.ch-sym:hover { background: var(--color-surface-3); }
.ch-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-inert); flex: none; display: inline-block; }
.ch-live-dot.is-live { background: var(--color-open); box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-open) 22%, transparent); animation: ch-pulse 2.4s ease-in-out infinite; }
@keyframes ch-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in oklab, var(--color-open) 6%, transparent); } }
.ch-tfs { display: flex; gap: 1px; padding-left: 6px; margin-left: 4px; border-left: 1px solid var(--color-hairline); }
.ch-pill { height: 30px; min-width: 32px; padding: 0 8px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; color: var(--color-ink-4); }
.ch-pill:hover { color: var(--color-ink); background: var(--color-surface-3); }
.ch-pill.is-on, .ch-tf-more.is-on { color: var(--color-accent); background: var(--color-accent-soft); }
.ch-vsep { width: 1px; height: 22px; background: var(--color-hairline); margin: 0 6px; flex: none; }
.ch-dd { position: relative; }
.ch-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; color: var(--color-ink-3); white-space: nowrap;
}
.ch-btn:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-btn .ic { width: 17px; height: 17px; }
.ch-btn [href="#i-chev"], .ch-btn .ic:last-child:not(:first-child) { width: 13px; height: 13px; opacity: .7; }
.ch-btn-accent, .ch-app .ch-btn-accent { background: var(--color-cta); color: var(--color-cta-ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--color-cta-edge); }
.ch-btn-accent:hover { background: var(--color-cta); color: var(--color-cta-ink); filter: brightness(1.06); }
.ch-btn-danger, .ch-app .ch-btn-danger { background: var(--color-alert); color: #fff; font-weight: 600; }
.ch-btn-danger:hover { background: var(--color-alert); color: #fff; filter: brightness(1.1); }
.ch-btn-ghost { border: 1px dashed var(--color-edge-soft); justify-content: center; width: 100%; margin-top: 4px; }
.ch-icon { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--radius-md); color: var(--color-ink-4); flex: none; }
.ch-icon:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-icon[aria-pressed="true"] { color: var(--color-accent); }
.ch-icon-sm { width: 28px; height: 28px; }
.ch-icon-sm .ic { width: 16px; height: 16px; }
.ch-rebate {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px 0 11px; margin-right: 6px; border-radius: 999px;
  background: var(--color-accent-soft); border: 1px solid var(--color-accent-edge); color: var(--color-accent);
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s;
}
.ch-rebate:hover { background: var(--color-cta); color: var(--color-cta-ink); border-color: var(--color-cta); }
.ch-rebate .ic { width: 16px; height: 16px; }

/* dropdown menus (positioned with JS, fixed so they never get clipped) */
.ch-menu {
  position: fixed; z-index: 70; min-width: 210px; max-height: min(72vh, 560px); overflow: auto; padding: 6px;
  background: var(--color-surface-2); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -12px var(--color-shade-glow), 0 2px 6px -2px var(--color-shade-glow);
}
.ch-menu[hidden] { display: none; }
.ch-menu-tf { min-width: 180px; }
.ch-mh { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-ink-dim); padding: 10px 10px 4px; list-style: none; }
.ch-mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border-radius: var(--radius-md); color: var(--color-ink-2); font-size: 13px; text-align: left; }
.ch-mi:hover { background: var(--color-surface-3); }
.ch-mi.is-on { color: var(--color-accent); background: var(--color-accent-faint); }
.ch-mi-tf { padding: 0 4px; gap: 4px; }
.ch-mi-main { flex: 1; text-align: left; height: 32px; padding: 0 6px; }
.ch-star { width: 26px; height: 26px; display: inline-grid; place-items: center; color: var(--color-ink-dim); border-radius: var(--radius-sm); flex: none; }
.ch-star .ic { width: 15px; height: 15px; }
.ch-star.is-on { color: var(--color-mark); }
.ch-star.is-on .ic { fill: currentColor; }

/* ---------- body ---------- */
.ch-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 46px minmax(0, 1fr) 5px var(--right-w, 290px); }
.ch-app.side-closed .ch-body { grid-template-columns: 46px minmax(0, 1fr); }
.ch-app.side-closed .ch-side, .ch-app.side-closed .ch-rhandle { display: none; }
.ch-tools {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; overflow-x: hidden;
  background: var(--color-surface-1); border-right: 1px solid var(--color-hairline); scrollbar-width: none;
}
.ch-tool { width: 36px; height: 34px; flex: none; display: grid; place-items: center; border-radius: var(--radius-md); color: var(--color-ink-4); }
.ch-tool:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-tool.is-on { background: var(--color-accent-soft); color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent-edge); }
.ch-tools-sep { width: 22px; height: 1px; background: var(--color-hairline); margin: 6px 0; flex: none; }

.ch-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--color-page); }
.ch-chart { position: absolute; inset: 0; }
.ch-chart.is-drawing canvas, .ch-chart.is-drawing td { cursor: crosshair !important; }
.ch-chart.is-over-draw canvas { cursor: pointer !important; }
.ch-chart.is-over-handle canvas { cursor: move !important; }
.ch-draw-canvas { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; }

/* legend */
.ch-legend, .ch-plg { position: absolute; left: 10px; z-index: 4; pointer-events: none; font-size: 12px; line-height: 1.5; max-width: calc(100% - 90px); }
.ch-legend { top: 6px; }
.ch-legend button, .ch-plg button { pointer-events: auto; }
.ch-lhead { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-ink-3); flex-wrap: wrap; }
.ch-lsym { font-weight: 700; color: var(--color-ink); font-size: 14px; letter-spacing: -.01em; }
.ch-lsym:hover { color: var(--color-accent); }
.ch-ldot { color: var(--color-ink-dim); }
.ch-lsrc { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--color-surface-2); color: var(--color-ink-dim); border: 1px solid var(--color-hairline); pointer-events: auto; cursor: help; }
.ch-lsrc.is-proxy { color: var(--color-warn); border-color: var(--color-warn-edge); background: var(--color-warn-soft); }
.ch-ohlc { display: flex; flex-wrap: wrap; gap: 2px 10px; font-family: var(--font-mono); font-size: 11.5px; color: var(--color-ink-dim); }
.ch-ohlc b { font-weight: 500; margin-left: 3px; color: var(--color-ink-2); }
.ch-ohlc b.up { color: var(--color-up); } .ch-ohlc b.dn { color: var(--color-down); }
.ch-lrow { display: inline-flex; align-items: center; gap: 8px; padding: 1px 6px 1px 4px; margin-left: -4px; border-radius: var(--radius-sm); pointer-events: auto; color: var(--color-ink-3); background: color-mix(in oklab, var(--color-page) 70%, transparent); }
.ch-legend .ch-lrow { display: flex; width: max-content; margin-top: 1px; }
.ch-lrow:hover { background: var(--color-surface-2); }
.ch-lname { font-weight: 500; }
.ch-lv { font-family: var(--font-mono); font-size: 11.5px; }
.ch-lact { display: inline-flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.ch-lrow:hover .ch-lact, .ch-lrow:focus-within .ch-lact { opacity: 1; }
.ch-lact button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--color-ink-4); }
.ch-lact button:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-lact .ic { width: 14px; height: 14px; }
.ch-lrow.is-off .ch-lname, .ch-lrow.is-off .ch-lv { opacity: .45; text-decoration: line-through; }
.ch-pane-legends { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.ch-countdown {
  position: absolute; z-index: 4; pointer-events: none; text-align: center; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  line-height: 16px; background: var(--color-up); color: var(--color-cta-ink); border-radius: 0 2px 2px 0;
}
.ch-countdown.dn { background: var(--color-down); color: #fff; }
.ch-state { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; align-content: center; gap: 12px; background: color-mix(in oklab, var(--color-page) 55%, transparent); color: var(--color-ink-3); font-size: 13px; text-align: center; padding: 16px; }
.ch-state[hidden] { display: none; }
.ch-state.is-loading { background: transparent; pointer-events: none; }
.ch-state.is-loading { display: flex; justify-content: center; align-items: center; gap: 10px; }
.ch-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--color-hairline); border-top-color: var(--color-accent); animation: ch-spin .8s linear infinite; }
@keyframes ch-spin { to { transform: rotate(360deg); } }
.ch-golive { position: absolute; right: 84px; bottom: 44px; z-index: 5; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--color-surface-2); border: 1px solid var(--color-edge-soft); color: var(--color-ink-2); box-shadow: 0 6px 16px -6px var(--color-shade-glow); }
.ch-golive .ic { transform: rotate(-90deg); width: 16px; height: 16px; }
.ch-golive:hover { color: var(--color-accent); border-color: var(--color-accent-edge); }

/* selected-drawing toolbar */
.ch-dtb { position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--color-surface-2); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-lg); box-shadow: 0 10px 28px -10px var(--color-shade-glow); }
.ch-dtb[hidden] { display: none; }
.ch-sw { width: 20px; height: 20px; border-radius: 50%; background: var(--sw); margin: 0 2px; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-ink) 18%, transparent); }
.ch-sw.is-on { box-shadow: 0 0 0 2px var(--color-surface-2), 0 0 0 3.5px var(--color-ink); }
.ch-dtb-sep { width: 1px; height: 20px; background: var(--color-hairline); margin: 0 4px; }
.ch-dtb-w, .ch-dtb-b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--color-ink-3); }
.ch-dtb-w i { display: block; width: 16px; background: currentColor; border-radius: 2px; }
.ch-dtb-w:hover, .ch-dtb-b:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-dtb-w.is-on, .ch-dtb-b.is-on { color: var(--color-accent); background: var(--color-accent-faint); }
.ch-dtb-b svg { width: 16px; height: 16px; }
.ch-dtb-del:hover { color: var(--color-down); }

/* ---------- watchlist side ---------- */
.ch-side { display: flex; flex-direction: column; min-height: 0; background: var(--color-surface-1); border-left: 1px solid var(--color-hairline); }
.ch-side-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 6px 14px; flex: none; }
.ch-side-title { flex: 1; font-weight: 600; font-size: 14px; }
.ch-wl-cols { display: grid; grid-template-columns: 1fr 92px 62px 22px; padding: 0 10px 6px 14px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--color-ink-dim); border-bottom: 1px solid var(--color-hairline); flex: none; }
.ch-wl-cols span:nth-child(n+2) { text-align: right; }
.ch-wl { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 120px; scrollbar-width: thin; }
.ch-wli { display: grid; grid-template-columns: minmax(0, 1fr) 92px 62px 22px; align-items: center; padding: 7px 10px 7px 12px; border-left: 2px solid transparent; border-bottom: 1px solid color-mix(in oklab, var(--color-hairline) 60%, transparent); cursor: pointer; }
.ch-wli:hover { background: var(--color-surface-2); }
.ch-wli.is-on { background: var(--color-accent-faint); border-left-color: var(--color-accent); }
.ch-wli.is-drag { opacity: .4; }
.ch-wli.is-over { box-shadow: inset 0 2px 0 var(--color-accent); }
.ch-wls { min-width: 0; display: flex; flex-direction: column; }
.ch-wls b { font-weight: 700; font-size: 13px; letter-spacing: -.01em; }
.ch-wls small { font-size: 11px; color: var(--color-ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-wlp, .ch-wlc { text-align: right; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; border-radius: 3px; padding: 1px 2px; }
.ch-wlp { color: var(--color-ink-2); }
.ch-wlx { width: 20px; height: 20px; display: grid; place-items: center; margin-left: 2px; color: var(--color-ink-dim); opacity: 0; border-radius: var(--radius-sm); }
.ch-wlx .ic { width: 13px; height: 13px; }
.ch-wli:hover .ch-wlx { opacity: 1; }
.ch-wlx:hover { color: var(--color-down); background: var(--color-surface-3); }
.flash-up { animation: ch-fu .8s ease-out; } .flash-dn { animation: ch-fd .8s ease-out; }
@keyframes ch-fu { from { background: color-mix(in oklab, var(--color-up) 35%, transparent); } }
@keyframes ch-fd { from { background: color-mix(in oklab, var(--color-down) 35%, transparent); } }
.ch-info { flex: none; padding: 12px 14px; border-top: 1px solid var(--color-hairline); font-size: 12px; }
.ch-info-head { display: flex; align-items: center; gap: 8px; }
.ch-info-head b { font-size: 14px; }
.ch-cat { font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--color-nav-soft); color: var(--color-nav); white-space: nowrap; }
.ch-info-name { color: var(--color-ink-dim); margin: 2px 0 6px; }
.ch-info-px { display: flex; align-items: baseline; gap: 8px; }
.ch-info-px span { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ch-info-px em { font-style: normal; font-weight: 600; font-size: 13px; }
.ch-info-dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 0; }
.ch-info-dl dt { color: var(--color-ink-dim); }
.ch-info-dl dd { margin: 0; text-align: right; color: var(--color-ink-3); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-info-note { display: flex; gap: 6px; margin: 8px 0 0; font-size: 11px; line-height: 1.45; color: var(--color-ink-dim); }
.ch-info-note .ic { width: 14px; height: 14px; margin-top: 1px; }
.ch-info-note.is-proxy { color: var(--color-warn); }
.ch-rebate-card {
  flex: none; display: flex; gap: 10px; margin: 0 10px 10px; padding: 12px; border-radius: var(--radius-lg); text-decoration: none; color: var(--color-ink);
  background: linear-gradient(135deg, var(--color-accent-soft), var(--color-accent-faint) 70%); border: 1px solid var(--color-accent-edge);
}
.ch-rebate-card:hover { border-color: var(--color-accent); }
.ch-rebate-ic { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--color-cta); color: var(--color-cta-ink); flex: none; }
.ch-rebate-card b { display: block; font-size: 13.5px; }
.ch-rebate-card small { display: block; font-size: 11.5px; color: var(--color-ink-3); line-height: 1.45; margin: 2px 0 4px; }
.ch-rebate-card em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--color-accent); }

/* ---------- status bar ---------- */
.ch-status { flex: none; height: 26px; display: flex; align-items: center; gap: 12px; padding: 0 10px; font-size: 11px; color: var(--color-ink-dim); background: var(--color-surface-1); border-top: 1px solid var(--color-hairline); white-space: nowrap; overflow: hidden; }
.ch-src { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; }
.ch-src b { color: var(--color-ink-3); font-weight: 500; }
.ch-src em { color: var(--color-warn); font-style: normal; }
.ch-attr { color: var(--color-ink-dim); text-decoration: none; }
.ch-attr:hover { color: var(--color-ink); text-decoration: underline; }
.ch-clock { font-family: var(--font-mono); font-size: 11px; color: var(--color-ink-3); }
.ch-clock small { color: var(--color-ink-dim); font-size: 10px; }
.ch-mnav { display: none; }
.ch-show-m { display: none !important; }

/* ---------- dialogs ---------- */
.ch-scrim { position: fixed; inset: 0; z-index: 55; background: var(--color-scrim); }
.ch-scrim[hidden] { display: none; }
.ch-modal { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px 16px; }
.ch-modal[hidden] { display: none; }
.ch-dlg-box {
  width: min(560px, 100%); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--color-surface-1); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-xl);
  box-shadow: 0 30px 60px -20px var(--color-shade-glow); animation: ch-pop .16s var(--ease-out-expo);
}
@keyframes ch-pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }
.ch-dlg-box.is-sm { width: min(420px, 100%); }
.ch-dlg-box.is-ind { width: min(760px, 100%); }
.ch-dlg-box.is-set { width: min(480px, 100%); }
.ch-dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 10px 18px; flex: none; }
.ch-dlg-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.ch-dlg-form { display: flex; flex-direction: column; gap: 10px; padding: 4px 18px 18px; overflow-y: auto; }
.ch-dlg-form textarea, .ch-field input[type=number], .ch-field select {
  font: inherit; font-size: 13px; color: var(--color-ink); background: var(--color-well); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-md); padding: 8px 10px;
}
.ch-dlg-form textarea { resize: vertical; min-height: 72px; }
.ch-dlg-form textarea:focus, .ch-field input:focus, .ch-field select:focus { outline: none; border-color: var(--color-accent-edge); box-shadow: 0 0 0 3px var(--color-accent-wash); }
.ch-dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--color-hairline); margin-top: 4px; }
.ch-dlg-foot .ch-btn:not(.ch-btn-accent):not(.ch-btn-danger) { border: 1px solid var(--color-edge-soft); }
.ch-confirm { margin: 10px 0 4px; font-size: 14px; line-height: 1.55; color: var(--color-ink-2); }
.ch-field { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 10px; font-size: 13px; color: var(--color-ink-3); }
.ch-field-check { grid-template-columns: auto 1fr; }
.ch-field-check input { width: 16px; height: 16px; accent-color: var(--color-accent); margin: 0; }
.ch-field-style { grid-template-columns: 1fr 44px 80px; }
.ch-field-style:has(> :nth-child(2):last-child) { grid-template-columns: 1fr 44px; }
.ch-field input[type=color] { width: 44px; height: 30px; padding: 2px; border: 1px solid var(--color-edge-soft); border-radius: var(--radius-md); background: var(--color-well); cursor: pointer; }
.ch-tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--color-hairline); flex: none; }
.ch-tab { height: 36px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--color-ink-4); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ch-tab.is-on { color: var(--color-ink); border-bottom-color: var(--color-accent); }
.ch-tabp { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.ch-tabp[hidden] { display: none; }
.ch-search-in { display: flex; align-items: center; gap: 8px; margin: 0 18px; padding: 0 12px; height: 42px; border-radius: var(--radius-lg); background: var(--color-well); border: 1px solid var(--color-edge-soft); flex: none; }
.ch-search-in:focus-within { border-color: var(--color-accent-edge); box-shadow: 0 0 0 3px var(--color-accent-wash); }
.ch-search-in .ic { color: var(--color-ink-dim); }
.ch-search-in input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; color: var(--color-ink); }
.ch-chips { display: flex; gap: 6px; padding: 10px 18px; overflow-x: auto; flex: none; scrollbar-width: none; }
.ch-chip { height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--color-ink-4); border: 1px solid var(--color-hairline); white-space: nowrap; }
.ch-chip:hover { color: var(--color-ink); }
.ch-chip.is-on { color: var(--color-accent); background: var(--color-accent-soft); border-color: var(--color-accent-edge); }
.ch-slist, .ch-ilist { list-style: none; margin: 0; padding: 0 10px 12px; overflow-y: auto; }
.ch-sitem { display: grid; grid-template-columns: 40px minmax(84px, 120px) minmax(0, 1fr) auto 28px; align-items: center; gap: 8px; min-height: 42px; padding: 0 8px; border-radius: var(--radius-md); cursor: pointer; font-size: 13px; }
.ch-sitem:hover, .ch-sitem.is-sel { background: var(--color-surface-3); }
.ch-sitem.is-cur b { color: var(--color-accent); }
.ch-sitem .ch-cat { justify-self: start; }
.ch-sname { color: var(--color-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sprov { font-size: 11px; color: var(--color-ink-dim); }
.ch-sempty { padding: 16px; text-align: center; color: var(--color-ink-dim); list-style: none; }
.ch-ind-cols { display: grid; grid-template-columns: 240px 1fr; gap: 0; min-height: 0; overflow: hidden; margin-top: 10px; border-top: 1px solid var(--color-hairline); }
.ch-ind-cols > div { overflow-y: auto; padding-top: 4px; max-height: 58vh; }
.ch-ind-cols > div:first-child { border-right: 1px solid var(--color-hairline); }
.ch-iitem { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 8px; border-radius: var(--radius-md); cursor: pointer; font-size: 13px; }
.ch-iitem:hover { background: var(--color-surface-3); }
.ch-iitem b { min-width: 44px; font-weight: 700; }
.ch-iitem .ch-iname { flex: 1; color: var(--color-ink-3); }
.ch-iitem > .ic { color: var(--color-accent); width: 16px; height: 16px; }
.ch-iitem.is-act { cursor: default; }
.ch-iitem.is-act .ch-iname { color: var(--color-ink); font-weight: 500; }
.ch-keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; padding: 6px 18px 20px; overflow-y: auto; font-size: 13px; }
.ch-keys dt { white-space: nowrap; }
.ch-keys dd { margin: 0; color: var(--color-ink-3); }
.ch-keys kbd { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--color-surface-3); border: 1px solid var(--color-edge-soft); color: var(--color-ink-2); }
.ch-tfq { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 65; display: grid; gap: 2px; padding: 14px 22px; min-width: 140px; text-align: center; background: var(--color-surface-2); border: 1px solid var(--color-accent-edge); border-radius: var(--radius-xl); box-shadow: 0 20px 50px -16px var(--color-shade-glow); }
.ch-tfq[hidden] { display: none; }
.ch-tfq small { font-size: 11px; color: var(--color-ink-dim); text-transform: uppercase; letter-spacing: .08em; }
.ch-tfq b { font-size: 28px; font-weight: 600; color: var(--color-accent); font-family: var(--font-mono); }
.ch-toast { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 80; padding: 9px 16px; border-radius: 999px; background: var(--color-ink); color: var(--color-page); font-size: 13px; font-weight: 500; box-shadow: 0 10px 30px -10px var(--color-shade-glow); }
.ch-toast[hidden] { display: none; }
.ch-toast.is-in { animation: ch-pop .2s var(--ease-out-expo); }
.ch-nojs { padding: 24px; text-align: center; }
.ch-app.is-full { position: fixed; inset: 0; z-index: 90; }

/* ---------- tablet / mobile ---------- */
@media (max-width: 1100px) {
  .ch-body { grid-template-columns: 46px minmax(0, 1fr) 5px min(var(--right-w, 290px), 250px); }
  .ch-lbl { display: none; }
  .ch-rebate span { display: none; }
  .ch-rebate { padding: 0 9px; }
}
@media (max-width: 820px) {
  .ch-top { height: 44px; gap: 0; padding: 0 4px; overflow-x: auto; scrollbar-width: none; }
  .ch-top::-webkit-scrollbar { display: none; }
  .ch-sym { padding: 0 6px; font-size: 14px; flex: none; }
  .ch-tfs { padding-left: 2px; margin-left: 2px; flex: none; }
  .ch-pill { min-width: 30px; padding: 0 6px; }
  .ch-vsep { margin: 0 2px; }
  .ch-hide-m, .ch-rebate, .ch-disc, .ch-attr { display: none !important; }
  .ch-show-m { display: inline-grid !important; }
  .ch-btn { padding: 0 8px; }
  .ch-icon { width: 32px; }
  .ch-body, .ch-app.side-closed .ch-body { grid-template-columns: minmax(0, 1fr); }
  .ch-tools { display: none; }
  .ch-app.tools-open .ch-tools {
    display: flex; position: absolute; z-index: 30; left: 8px; right: 8px; bottom: calc(56px + 26px + 8px); flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 4px 6px; border: 1px solid var(--color-edge-soft); border-radius: var(--radius-lg); box-shadow: 0 12px 30px -10px var(--color-shade-glow);
  }
  .ch-app.tools-open .ch-tools-sep { width: 1px; height: 22px; margin: 0 4px; }
  .ch-stage { touch-action: none; }
  .ch-side, .ch-app.side-closed .ch-side {
    display: flex; position: fixed; z-index: 58; left: 0; right: 0; bottom: 0; max-height: 78dvh; border: 1px solid var(--color-edge-soft); border-bottom: 0;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; transform: translateY(105%); transition: transform .28s var(--ease-out-expo); box-shadow: 0 -20px 50px -20px var(--color-shade-glow);
  }
  .ch-app.sheet-open .ch-side { transform: none; }
  .ch-side { overflow-y: auto; overscroll-behavior: contain; }
  .ch-wl { flex: none; overflow: visible; min-height: 0; }
  .ch-side-head { position: sticky; top: 0; z-index: 1; background: var(--color-surface-1); }
  .ch-side-head::before { content: ''; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--color-edge-soft); }
  .ch-side-head { padding-top: 16px; position: relative; }
  .ch-wlx { opacity: 1; }
  .ch-legend { left: 8px; top: 4px; max-width: calc(100% - 70px); }
  .ch-ohlc { font-size: 10.5px; gap: 0 7px; }
  .ch-lact { opacity: 1; }
  .ch-golive { right: 64px; }
  .ch-status { height: 26px; gap: 8px; }
  .ch-src { font-size: 10.5px; }
  .ch-mnav {
    display: grid; grid-template-columns: repeat(5, 1fr); flex: none; height: 56px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--color-surface-1); border-top: 1px solid var(--color-hairline);
  }
  .ch-mnav > * { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; color: var(--color-ink-4); text-decoration: none; min-width: 0; }
  .ch-mnav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
  .ch-mnav .ic { width: 20px; height: 20px; }
  .ch-app.tools-open .ch-mnav [data-m=draw], .ch-app.sheet-open .ch-mnav [data-m=wl] { color: var(--color-accent); }
  .ch-mnav-cta { color: var(--color-accent) !important; font-weight: 600; }
  .ch-modal { padding: 0; align-items: flex-end; }
  .ch-dlg-box, .ch-dlg-box.is-sm, .ch-dlg-box.is-ind, .ch-dlg-box.is-set { width: 100%; max-height: 88dvh; border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; border-bottom: 0; }
  .ch-sitem { grid-template-columns: 40px minmax(0, 1fr) 28px; grid-template-rows: auto auto; row-gap: 0; padding: 6px 8px; }
  .ch-sitem .ch-src-tag { grid-row: 1 / 3; }
  .ch-sitem b { grid-column: 2; }
  .ch-sitem .ch-sname { grid-column: 2; grid-row: 2; font-size: 11.5px; }
  .ch-sitem .ch-cat { display: none; }
  .ch-sitem .ch-star { grid-column: 3; grid-row: 1 / 3; }
  .ch-ind-cols { grid-template-columns: 1fr; overflow-y: auto; }
  .ch-ind-cols > div { max-height: none; overflow: visible; }
  .ch-ind-cols > div:first-child { border-right: 0; border-bottom: 1px solid var(--color-hairline); padding-bottom: 6px; }
  .ch-field { grid-template-columns: 1fr 130px; }
  .ch-toast { bottom: 96px; }
  .ch-menu { max-height: 60dvh; }
}
@media (prefers-reduced-motion: reduce) { .ch-app *, .ch-app *::before { animation: none !important; transition: none !important; } }

/* ===================== multi-chart layout, rail, watchlists, alerts, MTF (parity release) ===================== */
.ch-grid { position: absolute; inset: 0; display: flex; }
.ch-grid > * { flex: 1; min-width: 0; min-height: 0; }
.ch-split { display: flex; min-width: 0; min-height: 0; width: 100%; height: 100%; }
.ch-split-row { flex-direction: row; } .ch-split-col { flex-direction: column; }
.ch-slot { position: relative; display: flex; min-width: 0; min-height: 0; overflow: hidden; }
.ch-slot > * { flex: 1; min-width: 0; min-height: 0; }
.ch-div { flex: none; background: var(--color-hairline); position: relative; z-index: 6; touch-action: none; }
.ch-div-row { width: 3px; cursor: col-resize; } .ch-div-col { height: 3px; cursor: row-resize; }
.ch-div:hover, .ch-div:active { background: var(--color-accent-edge); }
.ch-div::after { content: ''; position: absolute; inset: -4px; }
.ch-cell { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--color-page); }
.ch-grid.is-multi .ch-cell { box-shadow: inset 0 0 0 1px transparent; }
.ch-grid.is-multi .ch-cell.is-active { box-shadow: inset 0 0 0 1px var(--color-accent-edge); }
.ch-pdot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-inert); flex: none; display: none; }
.ch-grid.is-multi .ch-pdot { display: inline-block; }
.ch-grid.is-multi .ch-cell.is-active .ch-pdot { background: var(--color-nav); }
.ch-ltf { font-weight: 600; color: var(--color-ink-2); }
.ch-ltype { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: var(--color-accent-faint); color: var(--color-accent); border: 1px solid var(--color-accent-edge); }
.ch-lhead-act { display: inline-flex; gap: 1px; margin-left: 4px; pointer-events: auto; opacity: .55; transition: opacity .12s; }
.ch-cell:hover .ch-lhead-act, .ch-cell.is-active .ch-lhead-act { opacity: 1; }
.ch-lhead-act button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--color-ink-4); }
.ch-lhead-act button:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-lhead-act .ic { width: 14px; height: 14px; }
.ch-grid.is-multi .ch-legend { font-size: 11px; }
.ch-cell .ch-golive { right: 74px; bottom: 36px; }
.ch-badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--color-warn); color: var(--color-cta-ink); font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.ch-badge[hidden] { display: none; }

/* rail groups + flyouts */
.ch-rg { position: relative; display: flex; flex: none; }
.ch-rg .ch-tool { width: 36px; }
.ch-rg-more { position: absolute; right: -2px; bottom: 2px; width: 12px; height: 12px; display: grid; place-items: center; color: var(--color-ink-dim); border-radius: 3px; }
.ch-rg-more .ic { width: 10px; height: 10px; transform: rotate(-45deg); }
.ch-rg-more:hover { color: var(--color-accent); background: var(--color-surface-3); }
.ch-fly { min-width: 240px; }
.ch-fly-row { padding: 0 2px; gap: 2px; }
.ch-fly-pick { flex: 1; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px; text-align: left; border-radius: var(--radius-md); }
.ch-fly-pick:hover { color: var(--color-accent); }
.ch-menu-draw { min-width: 230px; }
.ch-menu-draw .ch-mi .ic, .ch-fly .ic { width: 17px; height: 17px; }

/* floating favourite tools bar */
.ch-favbar { position: absolute; z-index: 8; display: flex; align-items: center; gap: 1px; padding: 3px; background: var(--color-surface-2); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-lg); box-shadow: 0 12px 30px -12px var(--color-shade-glow); }
.ch-favbar[hidden] { display: none; }
.ch-fav-tools { display: flex; gap: 1px; }
.ch-favbar .ch-tool { width: 32px; height: 30px; }
.ch-fav-drag { width: 16px; height: 30px; display: grid; place-items: center; cursor: grab; color: var(--color-ink-dim); touch-action: none; }
.ch-fav-drag .ic { width: 14px; height: 14px; }
.ch-favpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }

/* menus */
.ch-menu-layout { width: min(420px, calc(100vw - 16px)); }
.ch-tpl-grid { display: flex; flex-direction: column; gap: 3px; padding: 4px 4px 6px; }
.ch-tpl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.ch-tpl-n { width: 18px; font-size: 11px; color: var(--color-ink-dim); text-align: right; margin-right: 4px; font-variant-numeric: tabular-nums; }
.ch-tpl { width: 36px; height: 28px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--color-ink-4); }
.ch-tpl:hover { background: var(--color-surface-3); color: var(--color-ink); }
.ch-tpl.is-on { color: var(--color-accent); background: var(--color-accent-soft); }
.ch-tpl-ic { width: 26px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.1; }
#ch-layout-ic .ch-tpl-ic { width: 20px; height: 15px; }
.ch-check { cursor: pointer; }
.ch-check input { width: 15px; height: 15px; accent-color: var(--color-accent); margin: 0; }
.ch-mob-n { display: flex; gap: 6px; padding: 2px 10px 8px; }
.ch-tf-add { display: flex; align-items: center; gap: 6px; padding: 8px 8px 4px; margin-top: 4px; border-top: 1px solid var(--color-hairline); font-size: 12px; color: var(--color-ink-3); }
.ch-tf-add input, .ch-tf-add select { width: 56px; font: inherit; font-size: 12.5px; color: var(--color-ink); background: var(--color-well); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-sm); padding: 4px 6px; }
.ch-tf-add select { width: 52px; }
.ch-tf-add .ch-btn { height: 28px; padding: 0 10px; }
.ch-ctx { min-width: 200px; z-index: 75; }
.ch-ctx kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--color-ink-dim); }
.ch-ctx-flags { display: flex; gap: 6px; padding: 6px 8px 8px; border-bottom: 1px solid var(--color-hairline); margin-bottom: 4px; }

/* watchlist */
.ch-side { min-width: 0; }
.ch-rhandle { cursor: col-resize; background: var(--color-surface-1); border-left: 1px solid var(--color-hairline); touch-action: none; }
.ch-rhandle:hover, .ch-rhandle:active { background: var(--color-accent-faint); }
.ch-wl-pick { flex: 1; min-width: 0; height: 30px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--color-ink); background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); padding: 0 6px; cursor: pointer; }
.ch-wl-pick:hover, .ch-wl-pick:focus { border-color: var(--color-edge-soft); background: var(--color-well); outline: none; }
.ch-wl-flags { display: flex; align-items: center; gap: 6px; padding: 0 12px 8px; flex-wrap: wrap; }
.ch-wl-flags[hidden] { display: none; }
.ch-wl-flags .ch-chip { height: 22px; padding: 0 8px; font-size: 11px; }
.ch-flagf { width: 16px; height: 16px; border-radius: 4px; background: var(--flag); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-ink) 22%, transparent); display: inline-grid; place-items: center; color: var(--color-ink-dim); flex: none; }
.ch-flagf.is-on { box-shadow: 0 0 0 2px var(--color-surface-2), 0 0 0 3.5px var(--color-ink); }
.ch-flagf.is-none { background: transparent; } .ch-flagf .ic { width: 11px; height: 11px; }
.ch-wli[style*="--flag"] { border-left-color: var(--flag); }
.ch-wli.is-on[style*="--flag"] { border-left-color: var(--flag); }
.ch-wli.is-bad { opacity: .6; }
.ch-wlsec { list-style: none; padding: 0; border-bottom: 1px solid var(--color-hairline); background: var(--color-surface-2); }
.ch-wlsec-t { display: flex; align-items: center; gap: 6px; width: 100%; height: 28px; padding: 0 10px 0 calc(10px + var(--lv, 0) * 12px); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--color-ink-3); }
.ch-wlsec-t .ic { width: 13px; height: 13px; }
.ch-app.wl-compact .ch-wl-cols, .ch-app.wl-compact .ch-wls small, .ch-app.wl-compact .ch-info, .ch-app.wl-compact .ch-rebate-card, .ch-app.wl-compact .ch-mtf-note { display: none; }
.ch-app.wl-compact .ch-wli { grid-template-columns: minmax(0, 1fr) 0 auto 0; padding: 6px 6px 6px 8px; }
.ch-app.wl-compact .ch-wlp, .ch-app.wl-compact .ch-wlx { display: none; }
.ch-app.wl-compact .ch-side-head { padding-left: 6px; }
.ch-wl-chips { display: none; }

/* MTF */
.ch-mtf { flex: none; padding: 10px 14px; border-top: 1px solid var(--color-hairline); font-size: 12px; }
.ch-mtf-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ch-mtf-head b { font-size: 12.5px; }
.ch-mtf-sym { flex: 1; color: var(--color-ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-mtf-toggle { height: 22px; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; border: 1px solid var(--color-edge-soft); color: var(--color-ink-dim); }
.ch-mtf-toggle[aria-pressed="true"] { color: var(--color-accent); border-color: var(--color-accent-edge); background: var(--color-accent-faint); }
.ch-mtf-rows { display: grid; gap: 4px; }
.ch-app.mtf-off .ch-mtf-rows, .ch-app.mtf-off .ch-mtf-note { display: none; }
.ch-mtf-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; }
.ch-mtf-row b { font-family: var(--font-mono); font-size: 11px; color: var(--color-ink-3); }
.ch-mtf-st { justify-self: start; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--color-surface-3); color: var(--color-ink-dim); }
.ch-mtf-st.is-up { background: color-mix(in oklab, var(--color-up) 18%, transparent); color: var(--color-up); }
.ch-mtf-st.is-down { background: color-mix(in oklab, var(--color-down) 18%, transparent); color: var(--color-down); }
.ch-mtf-st.is-side { background: var(--color-warn-soft); color: var(--color-warn); }
.ch-mtf-v { font-family: var(--font-mono); font-size: 11px; color: var(--color-ink-dim); }
.ch-mtf-note { display: block; margin-top: 6px; font-size: 10.5px; color: var(--color-ink-dim); }
.ch-mtf-fab { display: none; }

/* search */
.ch-chips-src { padding-top: 0; }
.ch-src-tag { justify-self: start; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 5px; border-radius: var(--radius-sm); background: var(--color-surface-3); color: var(--color-ink-3); }
.ch-src-tag[data-tag="HL"] { background: var(--color-nav-soft); color: var(--color-nav); }
.ch-src-tag[data-tag="BN"] { background: var(--color-warn-soft); color: var(--color-warn); }
.ch-sitem .ch-cat { justify-self: end; }
.ch-chip-ratio.is-on { color: var(--color-warn); border-color: var(--color-warn-edge); background: var(--color-warn-soft); }
.ch-ratio-hint { margin: 0 18px 8px; padding: 8px 12px; border-radius: var(--radius-md); background: var(--color-warn-soft); color: var(--color-warn); font-size: 12.5px; }
.ch-ratio-hint[hidden] { display: none; }
.ch-dlg-box.is-search .ch-slist { flex: 1; min-height: 120px; }

/* indicators dialog */
.ch-ind-search { margin-top: 12px; }
.ch-dlg-box.is-ind .ch-ilist { padding-top: 8px; max-height: 62vh; }
.ch-icat { list-style: none; }
.ch-icat-t { display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; padding: 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--color-ink-3); border-radius: var(--radius-md); }
.ch-icat-t:hover { background: var(--color-surface-2); }
.ch-icat-t small { color: var(--color-ink-dim); font-weight: 500; }
.ch-icat-t .ic { width: 14px; height: 14px; }
.ch-iitem b { min-width: 76px; }

/* settings / plot style / visibility */
.ch-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ch-preset { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: var(--radius-md); border: 1px solid var(--color-edge-soft); font-size: 12px; text-align: left; }
.ch-preset:hover { border-color: var(--color-accent-edge); }
.ch-preset i { width: 28px; height: 20px; border-radius: 4px; flex: none; background: linear-gradient(90deg, var(--pup) 0 35%, var(--pbg) 35% 65%, var(--pdn) 65%); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-ink) 20%, transparent); }
.ch-row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-row-btns .ch-btn, .ch-set-foot .ch-btn { border: 1px solid var(--color-edge-soft); }
.ch-set-foot { flex-wrap: wrap; }
.ch-dlg-box.ch-set-box { width: min(560px, 100%); }
.ch-field-plot { grid-template-columns: minmax(70px, 1fr) 44px 64px 76px 80px; }
.ch-field-plot input[type=range], .ch-field input[type=range] { width: 100%; accent-color: var(--color-accent); }
.ch-field-plot select { padding: 6px; }
.ch-field-vis { grid-template-columns: 1fr 64px 10px 64px; }
.ch-field-vis input[type=number] { width: 100%; }
.ch-field-col { grid-template-columns: 1fr; }
.ch-field input:not([type=checkbox]):not([type=color]):not([type=range]), .ch-field textarea { font: inherit; font-size: 13px; color: var(--color-ink); background: var(--color-well); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-md); padding: 7px 10px; min-width: 0; }
.ch-field-check label { cursor: pointer; }

/* alerts */
.ch-al-list, .ch-al-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ch-al { display: grid; grid-template-columns: 10px auto 1fr auto auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px 4px 6px 8px; border-radius: var(--radius-md); background: var(--color-surface-2); font-size: 12.5px; }
.ch-al small { grid-column: 2 / 4; grid-row: 2; color: var(--color-ink-dim); font-size: 11px; }
.ch-al .ch-icon { grid-row: 1 / 3; }
.ch-al-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-warn); grid-row: 1 / 3; }
.ch-al.is-off { opacity: .55; } .ch-al.is-off .ch-al-dot { background: var(--color-inert); }
.ch-al-log li { font-size: 12px; color: var(--color-ink-3); } .ch-al-log time { font-family: var(--font-mono); color: var(--color-ink-dim); }

/* watchlist manager */
.ch-wlm-lists { display: grid; gap: 4px; }
.ch-wlm-list { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: var(--radius-md); }
.ch-wlm-list.is-on { background: var(--color-accent-faint); }
.ch-wlm-pick { flex: 1; text-align: left; height: 32px; padding: 0 8px; font-weight: 600; }
.ch-wlm-pick small { color: var(--color-ink-dim); font-weight: 500; margin-left: 4px; }
.ch-wlm-name { flex: 1; font: inherit; font-weight: 600; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--color-accent-edge); background: var(--color-well); color: var(--color-ink); }
.ch-wlm-bulk summary { cursor: pointer; font-size: 13px; color: var(--color-ink-3); padding: 4px 0; }
.ch-wlm-bulk textarea { width: 100%; margin: 6px 0; font: inherit; font-size: 13px; color: var(--color-ink); background: var(--color-well); border: 1px solid var(--color-edge-soft); border-radius: var(--radius-md); padding: 8px; }
.ch-wlm-opts { display: flex; gap: 16px; font-size: 13px; }
.ch-wlm-opts label { display: inline-flex; align-items: center; gap: 6px; }
.ch-wlm-syms { list-style: none; margin: 0; padding: 0; max-height: 38vh; overflow-y: auto; border: 1px solid var(--color-hairline); border-radius: var(--radius-md); }
.ch-wlm-row { display: grid; grid-template-columns: 22px 1fr 22px 28px; align-items: center; gap: 6px; padding: 3px 6px; border-bottom: 1px solid var(--color-hairline); font-size: 13px; }
.ch-wlm-row.is-sec { background: var(--color-surface-2); font-weight: 600; text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em; }
.ch-wlm-row.is-drag { opacity: .4; } .ch-wlm-row.is-over { box-shadow: inset 0 2px 0 var(--color-accent); }
.ch-wlm-h { cursor: grab; color: var(--color-ink-dim); text-align: center; touch-action: none; user-select: none; font-size: 15px; }
.ch-inline-q { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--color-warn-soft); color: var(--color-warn); font-size: 13px; }
.ch-inline-q .ch-btn { margin-left: auto; height: 28px; }
.ch-app.is-embed .ch-side, .ch-app.is-embed .ch-rhandle, .ch-app.is-embed .ch-sym, .ch-app.is-embed .ch-mtf-fab, .ch-app.is-embed #ch-wl-toggle { display: none !important; }
.ch-app.is-embed .ch-body { grid-template-columns: 46px minmax(0, 1fr); }

@media (max-width: 820px) {
  .ch-rhandle { display: none; }
  .ch-body { grid-template-columns: minmax(0, 1fr) !important; }
  .ch-wl-chips { display: flex; flex: none; height: 44px; align-items: center; gap: 6px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; background: var(--color-surface-1); border-bottom: 1px solid var(--color-hairline); }
  .ch-wl-chips::-webkit-scrollbar { display: none; }
  .ch-wchip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--color-hairline); font-size: 12px; white-space: nowrap; }
  .ch-wchip.is-on { border-color: var(--color-accent-edge); background: var(--color-accent-faint); }
  .ch-wchip .ch-wlc { font-family: var(--font-mono); font-size: 11px; }
  .ch-wchip-add { width: 30px; padding: 0; justify-content: center; }
  .ch-wchip .ic { width: 14px; height: 14px; }
  .ch-mtf-fab { display: grid; place-items: center; position: absolute; z-index: 7; right: 6px; top: 38px; width: 52px; height: 26px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--color-surface-2); border: 1px solid var(--color-edge-soft); color: var(--color-ink-3); }
  .ch-app.mtf-sheet .ch-mtf-fab { color: var(--color-accent); border-color: var(--color-accent-edge); }
  .ch-app.mtf-sheet .ch-side { transform: none; }
  .ch-app.mtf-sheet .ch-side > :not(.ch-mtf):not(.ch-side-head) { display: none; }
  .ch-favbar { max-width: calc(100% - 8px); overflow-x: auto; }
  .ch-app.tools-open .ch-tools { bottom: calc(56px + 26px + 52px); }
  .ch-app.tools-open .ch-rg-more { right: 0; bottom: 0; width: 14px; height: 14px; }
  .ch-field-plot { grid-template-columns: 1fr 44px 60px 70px; }
  .ch-field-plot input[type=range] { grid-column: 1 / -1; }
  .ch-cell .ch-golive { right: 60px; }
  .ch-menu-layout .ch-tpl-row { flex-wrap: wrap; }
  .ch-al { grid-template-columns: 10px auto 1fr auto auto; }
  .ch-al .ch-icon:nth-of-type(2) { display: none; }
}

/* top bar must never overflow: secondary labels collapse first, then the rest (menus are position:fixed, so scrolling is safe) */
.ch-top { overflow-x: auto; scrollbar-width: none; }
.ch-top::-webkit-scrollbar { display: none; }
.ch-top > * { flex-shrink: 0; }
@media (max-width: 1600px) { .ch-top [data-dd="draw"] .ch-lbl, .ch-top [data-dd="shot"] .ch-lbl, .ch-top [data-dd="layout"] .ch-lbl { display: none; } }
@media (max-width: 1400px) { .ch-top #ch-alert-btn .ch-lbl, .ch-top [data-dd="type"] .ch-lbl { display: none; } .ch-rebate span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; } }
@media (max-width: 1240px) { .ch-top .ch-lbl, .ch-rebate span { display: none; } .ch-rebate { padding: 0 9px; } }
@media (max-width: 1100px) and (min-width: 821px) { #ch-help-btn, #ch-redo { display: none; } }

/* ===== chart extras: context menu, layers legend, custom-code editor, MTF confluence card, macro band, code tables ===== */
.ch-msep { height: 1px; margin: 4px 6px; background: var(--color-hairline); }
.ch-mi.is-danger { color: var(--color-down); }
.ch-mi[disabled] { opacity: .45; pointer-events: none; }
.ch-ctx { max-height: calc(100dvh - 12px); overflow-y: auto; min-width: 250px; }
.ch-btn-sm { height: 24px; padding: 0 8px; font-size: 12px; }
/* overlay-layer legend rows */
.ch-lyr-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.ch-lyr-own { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; padding: 0 5px; border-radius: 999px; color: var(--color-accent); background: var(--color-accent-faint); border: 1px solid var(--color-accent-edge); }
.ch-lyr-v { font-family: var(--font-mono); font-size: 11.5px; color: var(--color-ink-2); }
.ch-lyr.is-err .ch-lyr-v { color: var(--color-down); }
/* indicator menu additions */
.ch-cc-entry { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; margin-bottom: 6px; border-radius: var(--radius-md); border: 1px dashed var(--color-accent-edge); color: var(--color-accent); background: var(--color-accent-faint); font-weight: 600; font-size: 13px; }
.ch-cc-entry:hover { background: var(--color-accent-soft); }
.ch-cc-glyph { font-family: var(--font-mono); font-size: 12px; }
.ch-inote { display: flex; gap: 8px; padding: 10px 8px; font-size: 11.5px; line-height: 1.5; color: var(--color-ink-dim); list-style: none; }
.ch-inote .ic { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.ch-iitem.is-dis { opacity: .55; }
/* custom-code editor */
.ch-dlg-box.is-cc { width: min(660px, 94vw); }
.ch-cc .ch-tabp { display: grid; gap: 8px; }
.ch-cc .ch-tabp[hidden] { display: none; }
.ch-cc-note { margin: 0; padding: 6px 10px; border-radius: var(--radius-md); font-size: 12px; color: var(--color-warn); background: var(--color-warn-soft); border: 1px solid var(--color-warn-edge); }
.ch-cc-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ch-cc-row select { flex: 1 1 160px; min-width: 0; height: 32px; }
.ch-dlg-form textarea.ch-cc-code, .ch-cc-code { width: 100%; height: 42vh; min-height: 200px; resize: vertical; tab-size: 2; white-space: pre; overflow: auto; font: 12px/1.45 var(--font-mono); padding: 10px; border-radius: var(--radius-md); background: var(--color-well); color: var(--color-ink); border: 1px solid var(--color-edge-soft); }
.ch-dlg-form textarea.ch-cc-pine { height: 30vh; min-height: 160px; }
.ch-cc .ch-field { grid-template-columns: 70px 1fr; }
.ch-dlg-form textarea.ch-cc-manual { height: 140px; min-height: 0; margin-top: 6px; }
.ch-cc-status { min-height: 18px; font-size: 12px; line-height: 1.5; color: var(--color-ink-dim); overflow-wrap: anywhere; }
.ch-cc-status.is-ok { color: var(--color-up); }
.ch-cc-status.is-err { color: var(--color-down); }
.ch-cc-help { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--color-ink-3); }
.ch-cc-small { font-size: 11.5px; color: var(--color-ink-dim); }
.ch-cc-guide { max-height: 56vh; overflow-y: auto; font-size: 13px; line-height: 1.55; color: var(--color-ink-2); }
.ch-cc-guide h3 { margin: 10px 0 2px; font-size: 13.5px; color: var(--color-ink); }
.ch-cc-guide p, .ch-cc-guide ol { margin: 0; }
.ch-cc-guide code, .ch-cc-map td { font-family: var(--font-mono); font-size: 11.5px; }
.ch-cc-map { border-collapse: collapse; width: 100%; }
.ch-cc-map td { padding: 3px 6px; border-bottom: 1px solid var(--color-hairline); vertical-align: top; }
.ch-cc-api { white-space: pre-wrap; font: 11px/1.5 var(--font-mono); padding: 10px; border-radius: var(--radius-md); background: var(--color-well); color: var(--color-ink-3); margin: 8px 0 0; }
@media (max-width: 768px) { .ch-dlg-box.is-cc input, .ch-dlg-box.is-cc select, .ch-dlg-box.is-cc textarea { font-size: 16px; } .ch-dlg-form textarea.ch-cc-code { height: 36vh; } }
/* custom-code tables drawn over the chart */
.ch-cc-table { position: absolute; z-index: 4; pointer-events: none; border-collapse: separate; border-spacing: 0; border-radius: 4px; overflow: hidden; border: 1px solid var(--color-edge-soft); background: color-mix(in oklab, var(--color-surface-2) 86%, transparent); color: var(--color-ink); font-family: var(--font-mono); }
.ch-cc-table td { padding: 3px 7px; }
/* macro-events tooltip */
.ch-macro-tip { position: absolute; z-index: 8; max-width: 320px; padding: 8px 10px; border-radius: var(--radius-md); pointer-events: none; font-size: 11.5px; line-height: 1.45; background: var(--color-surface-2); border: 1px solid var(--color-edge-soft); color: var(--color-ink-2); box-shadow: 0 10px 24px -10px var(--color-shade-glow); }
.ch-macro-tip b { display: block; margin-bottom: 4px; color: var(--color-ink); }
.ch-macro-tip div { display: grid; margin-top: 3px; }
.ch-macro-tip small, .ch-macro-tip em { color: var(--color-ink-dim); font-style: normal; }
/* MTF confluence card */
.ch-mtf-head b { white-space: nowrap; }
.ch-mtf-head .ch-mtf-sym { flex: none; color: inherit; }
.ch-mtf-status { flex: 1; font-size: 10.5px; color: var(--color-ink-dim); text-transform: uppercase; letter-spacing: .06em; }
.ch-mtf-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--color-inert); }
.ch-mtf[data-k="uptrend"] .ch-mtf-head b { color: var(--color-up); }
.ch-mtf[data-k="downtrend"] .ch-mtf-head b { color: var(--color-down); }
.ch-mtf[data-k="sideways"] .ch-mtf-head b { color: var(--color-warn); }
.ch-mtf.is-live .ch-mtf-dot { background: currentColor; animation: ch-mtf-pulse 1.4s ease-in-out infinite; }
.ch-mtf.is-live[data-k="uptrend"] .ch-mtf-dot, .ch-mtf.is-live[data-k="uptrend"] .ch-mtf-status { color: var(--color-up); }
.ch-mtf.is-live[data-k="downtrend"] .ch-mtf-dot, .ch-mtf.is-live[data-k="downtrend"] .ch-mtf-status { color: var(--color-down); }
.ch-mtf.is-live[data-k="sideways"] .ch-mtf-dot, .ch-mtf.is-live[data-k="sideways"] .ch-mtf-status { color: var(--color-warn); }
@keyframes ch-mtf-pulse { 50% { opacity: .35; box-shadow: 0 0 0 4px color-mix(in oklab, currentColor 18%, transparent); } }
.ch-mtf-card { display: grid; gap: 2px; padding: 6px 10px; margin-bottom: 4px; border-radius: var(--radius-md); background: var(--color-surface-2); border-left: 3px solid var(--color-inert); }
.ch-mtf-card.is-uptrend { border-left-color: var(--color-up); }
.ch-mtf-card.is-downtrend { border-left-color: var(--color-down); }
.ch-mtf-card.is-sideways { border-left-color: var(--color-warn); }
.ch-mtf-label { font-size: 13px; }
.ch-mtf-detail { font-size: 11.5px; color: var(--color-ink-dim); line-height: 1.4; }
.ch-mtf-gauge { display: block; width: 100%; max-width: 180px; margin: 0 auto 2px; }
.ch-mtf-arc { fill: none; stroke-width: 8; opacity: .35; }
.ch-mtf-arc.is-on { opacity: 1; }
.ch-mtf-gauge text { font: 8px var(--font-mono); fill: var(--color-ink-dim); }
.ch-mtf-needle, .ch-mtf-pivot { fill: var(--color-ink-2); transition: transform .4s ease; }
.ch-app.mtf-off .ch-mtf-body { display: none; }
.ch-mtf-fab[data-k="uptrend"] { border-color: var(--color-up); }
.ch-mtf-fab[data-k="downtrend"] { border-color: var(--color-down); }
.ch-mtf-fab[data-k="sideways"] { border-color: var(--color-warn); }
@media (max-width: 820px) { .ch-dlg-box.is-cc { width: 100%; } .ch-app.mtf-sheet .ch-mtf-gauge { max-width: 240px; } .ch-app.mtf-sheet .ch-mtf-label { font-size: 15px; } .ch-app.mtf-sheet .ch-mtf-detail { font-size: 13px; } }

/* ===================== refine pass (docs/brand/UPGRADE-GUIDE.md, 2026-12-01): pro-terminal finish =====================
   Appended overrides only: same layout, same behaviour. Numbers use the number face (Inter + tabular figures),
   floating surfaces get the shared depth stack, gold stays on the one active thing per control. */
.ch-app { --ch-hi: inset 0 1px 0 color-mix(in srgb, var(--color-ink) 6%, transparent); }
:where(.ch-app) :focus-visible { outline-offset: 2px; }
/* chrome: a 1px top highlight so the bars read as raised panels over the canvas */
.ch-top, .ch-status, .ch-tools, .ch-side { box-shadow: var(--ch-hi); }
.ch-btn, .ch-icon, .ch-pill, .ch-tool, .ch-sym, .ch-chip, .ch-mi, .ch-wli, .ch-tpl, .ch-iitem, .ch-sitem { transition: background-color .15s var(--ease-out), color .15s var(--ease-out), border-color .15s var(--ease-out), box-shadow .15s var(--ease-out); }
.ch-btn:active, .ch-icon:active, .ch-pill:active, .ch-tool:active { transform: translateY(1px); }
.ch-icon[aria-pressed="true"] { background: var(--color-accent-faint); }
/* timeframe strip: one segmented well, the active frame is a raised gold-edged key */
.ch-tfs { gap: 2px; padding: 3px; margin-left: 6px; border-left: 0; border-radius: calc(var(--radius-md) + 3px); background: var(--color-well); box-shadow: inset 0 0 0 1px var(--color-hairline); }
.ch-pill { height: 28px; font-family: var(--font-num); font-feature-settings: var(--num-features); }
.ch-pill.is-on { box-shadow: inset 0 0 0 1px var(--color-accent-edge), 0 1px 2px -1px var(--color-shade-glow); }
.ch-tf-more { font-family: var(--font-num); font-feature-settings: var(--num-features); }
.ch-tf-more.is-on { box-shadow: inset 0 0 0 1px var(--color-accent-edge); }
/* menus: softer radius, depth stack, quick 120ms rise; group headers become eyebrows with a short gold bar */
.ch-menu { border-radius: var(--radius-xl); box-shadow: var(--ch-hi), 0 18px 40px -12px var(--color-shade-glow), 0 2px 6px -2px var(--color-shade-glow); animation: ch-rise .12s var(--ease-out); }
@keyframes ch-rise { from { opacity: 0; transform: translateY(-4px); } }
.ch-mh { display: flex; align-items: center; gap: 7px; color: var(--color-ink-4); }
.ch-mh::before { content: ""; width: 10px; height: 2px; border-radius: 2px; background: var(--color-accent); flex: none; }
.ch-mi.is-on { box-shadow: inset 2px 0 0 var(--color-accent); }
.ch-tpl.is-on { box-shadow: inset 0 0 0 1px var(--color-accent-edge); }
/* dialogs: depth stack + a thin gold gradient hairline across the top edge */
.ch-dlg-box { position: relative; border-color: var(--color-hairline); box-shadow: var(--ch-hi), 0 30px 60px -20px var(--color-shade-glow), 0 0 0 1px color-mix(in srgb, var(--color-shade) 25%, transparent); }
.ch-dlg-box::before { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 0; height: 1px; pointer-events: none; background: linear-gradient(90deg, transparent, var(--color-accent-edge) 30%, var(--color-accent) 50%, var(--color-accent-edge) 70%, transparent); opacity: .85; }
.ch-dlg-head { padding-top: 16px; }
.ch-dlg-head h2 { font-size: 17px; }
.ch-tab { transition: color .15s var(--ease-out), border-color .15s var(--ease-out); }
.ch-tab:hover { color: var(--color-ink); }
/* symbol search: category tags go neutral so gold is left for the current symbol and favourites */
.ch-sitem .ch-cat { background: var(--color-surface-3); color: var(--color-ink-4); }
.ch-sitem.is-sel { box-shadow: inset 2px 0 0 var(--color-accent); }
.ch-sempty { display: grid; justify-items: center; gap: 6px; padding: 18px 16px 22px; }
.ch-sempty::before { content: ""; width: 84px; height: 84px; background: url("../../img/icons3d/bc-empty-state.webp") center / contain no-repeat; }
/* legend + watchlist + info: every figure in the number face with tabular digits */
.ch-ohlc, .ch-lv, .ch-lyr-v, .ch-wlp, .ch-wlc, .ch-info-px span, .ch-info-dl dd, .ch-mtf-v, .ch-clock, .ch-tpl-n { font-family: var(--font-num); font-feature-settings: var(--num-features); font-variant-numeric: tabular-nums; }
.ch-ohlc { font-size: 12px; }
.ch-lsym { font-size: 14.5px; }
.ch-wl-cols { padding-top: 2px; font-weight: 600; letter-spacing: .07em; }
.ch-wl-cols, .ch-wli { grid-template-columns: minmax(0, 1fr) 92px 66px 22px; }
.ch-wlp { font-size: 12.5px; font-weight: 500; color: var(--color-ink-2); }
.ch-wlc { justify-self: end; font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.ch-wlc.up { background: var(--color-up-soft); }
.ch-wlc.dn { background: var(--color-down-soft); }
.ch-wchip .ch-wlc { background: none; padding: 0; }
.ch-wli { transition: background-color .15s var(--ease-out); }
.ch-info-px span { font-size: 24px; letter-spacing: -.025em; }
.ch-cat { border-radius: 6px; }
.ch-rebate-card { box-shadow: var(--ch-hi); transition: border-color .16s var(--ease-out), transform .16s var(--ease-out); }
.ch-rebate-card:hover { transform: translateY(-2px); }
.ch-mtf-card { box-shadow: var(--ch-hi); }
/* floating toolbars share the menu depth */
.ch-dtb, .ch-favbar { border-radius: var(--radius-xl); box-shadow: var(--ch-hi), 0 12px 30px -12px var(--color-shade-glow); }
/* short desktop screens: compact the MTF gauge so the watchlist and rebate card are not squeezed */
@media (min-width: 821px) and (max-height: 960px) { .ch-mtf-gauge { max-width: 132px; } .ch-mtf { padding-top: 8px; padding-bottom: 8px; } .ch-info { padding-top: 10px; padding-bottom: 10px; } }
@media (max-width: 820px) {
  .ch-tfs { margin-left: 2px; padding: 2px; }
  .ch-dlg-box::before { left: 24px; right: 24px; }
  /* bottom nav: active tab gets a short gold bar on its top edge */
  .ch-mnav > * { position: relative; }
  .ch-app.tools-open .ch-mnav [data-m=draw]::before, .ch-app.sheet-open .ch-mnav [data-m=wl]::before { content: ""; position: absolute; top: 0; left: 50%; width: 22px; height: 2px; margin-left: -11px; border-radius: 0 0 2px 2px; background: var(--color-accent); }
}
@media (prefers-reduced-motion: reduce) { .ch-menu { animation: none; } .ch-rebate-card:hover { transform: none; } }
