/* The chart's indicators (lot G1): the legends on the panes (clegend.js), the indicators menu in the chart's panel
   (cind-menu.js, cind-tpl.js; a sheet from the bottom on a phone) and the settings dialog (cind-set.js). Tokens only;
   colours of lines are places of the palette (--ind-N); hover only where a pointer hovers; never italic; logical
   properties. */

/* ---- one place of the palette, read by every part that shows it ---- */
[data-c="1"] { --c: var(--ind-1); }
[data-c="2"] { --c: var(--ind-2); }
[data-c="3"] { --c: var(--ind-3); }
[data-c="4"] { --c: var(--ind-4); }
[data-c="5"] { --c: var(--ind-5); }
[data-c="6"] { --c: var(--ind-6); }
[data-c="7"] { --c: var(--ind-7); }
[data-c="8"] { --c: var(--ind-8); }
[data-c="9"] { --c: var(--ind-9); }
[data-c="10"] { --c: var(--ind-10); }
[data-c="0"] { --c: var(--draw); }

/* ---- the legends: top left of each pane, over the candles on a soft backing; the keys come under the pointer, the
   keyboard or a tap ---- */
.lg { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.lg-pane { position: absolute; top: 0; left: 0; display: grid; justify-items: start; gap: 2px; max-width: 100%; will-change: transform; }
.lg-pane[hidden] { display: none; }
.lg-pane[data-folded="1"] > .lg-row { display: none; }
.lg-row, .lg-ohlc { display: flex; align-items: center; gap: 6px; max-width: 100%; min-height: 20px; padding: 0 4px 0 2px; border-radius: 4px;
  background: color-mix(in srgb, var(--chart-bg) 70%, transparent); pointer-events: auto; font-size: 11.5px; line-height: 18px; white-space: nowrap; }
.lg-ohlc { flex-wrap: wrap; column-gap: 8px; row-gap: 0; padding-inline-start: 6px; color: var(--dim); }
.lg-pane[data-narrow="1"] .lg-ohlc { column-gap: 6px; }
.lg-row { flex-wrap: wrap; row-gap: 0; }             /* a narrow pane: the values go under the name, never past the edge */
.lg-o { display: inline-flex; gap: 3px; }
.lg-ok { color: var(--dim); font-size: 10.5px; }
.lg-ohlc .lg-v { color: var(--up); }
.lg-ohlc[data-dir="down"] .lg-v { color: var(--down); }
.lg-v { flex: none; color: var(--c, var(--mute)); font-family: var(--font-num); font-stretch: var(--num-stretch); font-size: 11px; }
.lg-v[data-c="0"][data-dir="down"] { color: var(--down); }
.lg-v[data-c="0"][data-dir="up"] { color: var(--up); }
.lg-v[hidden] { display: none; }
.lg-vals { display: inline-flex; gap: 8px; flex: none; }
.lg-name { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; flex: 0 1 auto; height: 20px; padding: 0 4px; border: 0; border-radius: 4px;
  background: none; color: var(--text); font: inherit; font-weight: 600; text-align: start; cursor: pointer; }
.lg-full { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lg-code { flex: none; color: var(--dim); font-weight: 500; font-size: 10.5px; }
.lg-name:focus-visible, .lg-k:focus-visible, .lg-fold:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; }
.lg-pane[data-narrow="1"] .lg-full { display: none; }
.lg-pane[data-narrow="1"] .lg-code { color: var(--text); font-weight: 600; }
.lg-row[data-hidden="1"] .lg-name { color: var(--dim); }
.lg-row[data-hidden="1"] .lg-vals { display: none; }
.lg-keys { display: none; gap: 1px; flex: none; }
.lg-row:focus-within .lg-keys, .lg-row[data-open="1"] .lg-keys { display: inline-flex; }
.lg-k { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 20px; padding: 0; border: 0; border-radius: 4px;
  background: none; color: var(--mute); cursor: pointer; }
.lg-k .i { width: 13px; height: 13px; }
.lg-k:active { background: var(--surface-4); color: var(--text); }
.lg-fold { display: inline-flex; align-items: center; gap: 2px; height: 18px; padding: 0 5px; border: 0; border-radius: 4px; background: var(--surface-3);
  color: var(--mute); font-size: 10.5px; cursor: pointer; }
.lg-fold .i { width: 11px; height: 11px; transition: transform var(--t-fast) var(--ease); }
.lg-fold[aria-expanded="false"] .i { transform: rotate(-90deg); }
.lg-fold[hidden] { display: none; }
.chartwrap[data-drawing="1"] .lg-row, .chartwrap[data-drawing="1"] .lg-ohlc { pointer-events: none; }
.term[data-form="phone"] .lg-row, .term[data-form="phone"] .lg-ohlc { pointer-events: none; }   /* read only: the chart takes the touch */
.term[data-form="phone"] .lg-name { cursor: default; }

/* ---- the indicators menu ---- */
.cpop[data-kind="ind"] { display: flex; flex-direction: column; width: min(640px, calc(100% - 16px)); padding: 10px; overflow: hidden; }
.cm { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1 1 auto; }
.cm-search { flex: none; min-height: 34px; }
.cm-search input { height: 32px; font-size: 13px; }
.cm-search input::-webkit-search-cancel-button { filter: grayscale(1); }
.cm-tabs { display: flex; gap: 4px; flex: none; overflow-x: auto; scrollbar-width: none; }
.cm-tabs::-webkit-scrollbar { display: none; }
.cm-tab { display: inline-flex; align-items: center; gap: 4px; flex: none; min-height: 26px; padding: 0 9px; border: 0; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--mute); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.cm-tab .i { width: 12px; height: 12px; }
.cm-tab[aria-pressed="true"] { background: var(--surface-4); box-shadow: inset 0 0 0 1px var(--hair-3); color: var(--text); }
.cm-tab:focus-visible, .cm-star:focus-visible, .cm-pick:focus-visible, .cm-chip button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cm-body { display: grid; align-content: start; gap: 1px; min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.cm-g { margin: 8px 0 2px; color: var(--dim); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.cm-g:first-child { margin-top: 0; }
.cm-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: stretch; border-radius: var(--r-sm); }
.cm-row[data-on="1"] { background: var(--acc-soft); }
.cm-star { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--dim); cursor: pointer; }
.cm-star[aria-pressed="true"] { color: var(--warn); }
.cm-pick { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 18px; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px 4px 2px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.cm-code { font-family: var(--font-num); font-stretch: var(--num-stretch); font-size: 11.5px; font-weight: 600; }
.cm-txt { display: grid; min-width: 0; }
.cm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.cm-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11.5px; }
.cm-where { color: var(--dim); font-size: 10.5px; white-space: nowrap; }
.cm-on { display: inline-flex; color: var(--acc); }
.cm-on .i { width: 14px; height: 14px; }
.cm-none, .cm-hint { margin: 6px 2px; color: var(--dim); font-size: 12px; line-height: 1.45; }
.cm-foot { display: grid; gap: 6px; flex: none; padding-top: 8px; border-top: 1px solid var(--hair); }
.cm-count { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 11.5px; font-weight: 600; }
.cm-count b { color: var(--text); font-weight: 600; }
.cm-count .ci-clear { margin-inline-start: auto; }
.cm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.cm-chip { display: inline-flex; align-items: center; border-radius: var(--r-sm); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--hair); }
.cm-chip[data-hidden="1"] { opacity: 0.6; }
.cm-chip button { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 7px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--text); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.cm-chip .i { width: 12px; height: 12px; color: var(--dim); }
.cm-chip-x { padding: 0 6px; }
.cm .ci-note[data-bad="1"] { color: var(--warn); }
.cm .ci-note[data-bad="0"] { color: var(--mute); }

/* ---- ICT / Smart Money (lot SMC1, csmc.js): one switch per concept, no star; the sessions' choice under their row ---- */
.cm-row[data-smc] { grid-template-columns: minmax(0, 1fr); }
.cm-smc-note { margin: 0 2px 4px; color: var(--dim); font-size: 11px; line-height: 1.45; }
.cm-smc-link { color: var(--mute); text-decoration: underline; text-decoration-color: var(--hair-3); text-underline-offset: 2px; white-space: nowrap; }
.cm-smc-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cm-sub { display: flex; align-items: center; gap: 4px; padding-block: 0 6px; padding-inline: 50px 8px; color: var(--dim); font-size: 11px; }
.cm-seg { min-height: 24px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: var(--surface-3); color: var(--mute); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.cm-seg[aria-pressed="true"] { background: var(--surface-4); box-shadow: inset 0 0 0 1px var(--hair-3); color: var(--text); }
.cm-seg:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cm-chip-t { padding: 0 2px 0 8px; color: var(--text); font-size: 11.5px; font-weight: 600; }

/* ---- saved sets ---- */
.cm-tpl-form { display: flex; gap: 6px; align-items: center; }
.cm-tpl-form .field { flex: 1 1 auto; min-height: 30px; }
.cm-tpl-form input { height: 28px; font-size: 12.5px; }
.cm-tpls { display: grid; gap: 4px; }
.cm-tpl-row { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 6px; border-radius: var(--r-sm); background: var(--surface-3); }
.cm-tpl-row[data-def="1"] { box-shadow: inset 0 0 0 1px var(--hair-3); }
.cm-tpl-row > .cm-tpl-form { flex: 1 1 auto; }
.cm-tpl-t { display: grid; flex: 1 1 auto; min-width: 0; }
.cm-tpl-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.cm-tpl-list { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11px; }
.cm-tag { justify-self: start; margin-top: 1px; padding: 0 5px; border-radius: 4px; background: var(--surface-4); color: var(--mute); font-size: 10px; line-height: 15px; }
.cm-tpl-keys { display: inline-flex; gap: 4px; flex: none; }
.cm-tpl-keys [aria-pressed="true"] { color: var(--warn); }

/* ---- a phone: the menu is a sheet from the bottom, its keys of a thumb's size ---- */
.cpop[data-sheet="1"] { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 82%; padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-radius: 14px 14px 0 0; }
.cpop[data-sheet="1"] .cm-pick { grid-template-columns: 46px minmax(0, 1fr) 18px; min-height: 52px; }
.cpop[data-sheet="1"] .cm-where { display: none; }
.term[data-form="phone"] .cpop[data-sheet="1"] { width: 100%; }
.cpop[data-sheet="1"] .cm-desc { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.cpop[data-sheet="1"] .cm-row { grid-template-columns: 44px minmax(0, 1fr); }
.cpop[data-sheet="1"] .cm-row[data-smc] { grid-template-columns: minmax(0, 1fr); }
.cpop[data-sheet="1"] .cm-sub { padding-inline-start: 12px; flex-wrap: wrap; }
.cpop[data-sheet="1"] .cm-seg { min-height: 40px; }
.cpop[data-sheet="1"] .cm-tab { min-height: 36px; }
.cpop[data-sheet="1"] .cm-chip button { min-height: 44px; min-width: 44px; justify-content: center; }
.cpop[data-sheet="1"] .cm-search, .cpop[data-sheet="1"] .cm-search input { min-height: 44px; height: 42px; font-size: 16px; }
.cpop[data-sheet="1"] .cm-tpl-keys .key, .cpop[data-sheet="1"] .cm-tpl-form .key { min-height: 40px; }
.cpop[data-sheet="1"] .cm-tpl-keys .key-ico { width: 40px; }
.cpop[data-sheet="1"] .cm-tpl-form input { height: 38px; font-size: 16px; }

/* ---- the settings of one indicator ---- */
.cset { display: none; width: min(500px, calc(100vw - 32px)); max-height: min(700px, 88vh); margin-top: 7vh; background: var(--surface-2); color: var(--text); }
.cset[open] { display: flex; flex-direction: column; }
.cset::backdrop { background: rgba(4, 5, 7, 0.28); }
.cs-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--hair); }
.cs-head h2 { display: flex; align-items: baseline; gap: 8px; flex: 1 1 auto; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; }
.cs-head h2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-head small { flex: none; color: var(--dim); font-size: 11.5px; font-weight: 500; }
.cs-body { display: grid; gap: 14px; min-height: 0; padding: 12px 14px; overflow-y: auto; overscroll-behavior: contain; }
.cs-part { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.cs-part > legend { margin-bottom: 4px; padding: 0; color: var(--dim); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.cs-row { display: grid; grid-template-columns: minmax(0, 1fr) 168px; align-items: center; gap: 4px 12px; }
.cs-row > label { color: var(--mute); font-size: 12.5px; }
.cs-cell { display: flex; gap: 6px; align-items: center; }
.cs-cell input, .cs-cell select, .cs-line select { flex: 1 1 auto; min-width: 0; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--hair-2); color: var(--text); font: inherit; font-size: 13px; }
.cs-cell input:focus-visible, .cs-cell select:focus-visible, .cs-line select:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--acc), 0 0 0 3px var(--acc-soft); }
.cs-cell input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--warn); }
.cs-err { grid-column: 1 / -1; margin: 0; color: var(--warn); font-size: 11.5px; line-height: 1.4; }
.cs-err[hidden] { display: none; }
.cs-add { justify-self: start; }
.cs-none { margin: 0; color: var(--dim); font-size: 12px; line-height: 1.45; }
.cs-lines { display: grid; gap: 8px; }
.cs-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; align-items: center; gap: 10px; }
.cs-line[data-on="0"] .cs-sws { opacity: 0.45; }
.cs-check { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; cursor: pointer; }
.cs-check > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--acc); }
.cs-mark { flex: none; width: 14px; height: 3px; border-radius: 2px; background: var(--c); }
.cs-sws { display: inline-flex; gap: 3px; }
.cs-sw { position: relative; display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); cursor: pointer; }
.cs-sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cs-sw:has(input:checked) { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 3.5px var(--text); }
.cs-sw:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
.cs-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--hair); }
.cs-gap { flex: 1 1 auto; }
.cset[data-form="phone"], .dtext[data-form="phone"] { width: 100%; max-width: 100%; max-height: 88vh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
.cset[data-form="phone"] .cs-line { grid-template-columns: minmax(0, 1fr) 76px; }
.cset[data-form="phone"] .cs-sws { grid-column: 1 / -1; order: 3; flex-wrap: wrap; gap: 8px; }
.cset[data-form="phone"] .cs-sw { width: 28px; height: 28px; }
.cset[data-form="phone"] .cs-row { grid-template-columns: minmax(0, 1fr) 150px; }
.cset[data-form="phone"] .key, .cset[data-form="phone"] .cs-cell input, .cset[data-form="phone"] select { min-height: 44px; font-size: 16px; }
.cset[data-form="phone"] .key-ico { width: 44px; }
.cset[data-form="phone"] .cs-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

@media (hover: hover) {
  .lg-row:hover .lg-keys { display: inline-flex; }
  .lg-k:hover, .lg-fold:hover { background: var(--surface-4); color: var(--text); }
  .lg-name:hover .lg-full { text-decoration: underline; text-decoration-color: var(--hair-3); text-underline-offset: 3px; }
  .cm-tab:hover, .cm-star:hover { color: var(--text); }
  .cm-pick:hover, .cm-chip button:hover { background: var(--surface-3); }
  .cm-row[data-on="1"] .cm-pick:hover { background: transparent; }
}
@media (prefers-reduced-motion: reduce) { .lg-fold .i { transition: none; } }
