/* Several charts in the chart focus of a computer (lot G2b: multi.js, mchart.js). Off (one chart, every other screen) the
   grid and the desk chart's cell are no boxes at all: the chart stands in its plate as before. On: one to four cells,
   a hairline between two, each with its head (the market's name, the market list's arrow, the timeframe); the active
   one outlined in silver (never blue) and its name in full white. Tokens only; hover only where a pointer hovers;
   never italic; no text under 11 px. */

.mgrid, .mcell { display: contents; }
.mhead { display: none; }

.mgrid[data-on="1"] { position: relative; display: grid; flex: 1; min-height: 0; gap: 1px; background: var(--hair); }
.mgrid[data-layout="2h"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
.mgrid[data-layout="2v"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.mgrid[data-layout="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.mgrid[data-on="1"] > .mcell { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chart-bg); }
/* the active chart: a fine silver frame over its head and candles, drawn above them and never in the way of a press */
.mgrid[data-on="1"] > .mcell[data-active="1"]::after { content: ""; position: absolute; inset: 0; z-index: 8; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--silver) 75%, transparent); }

/* ---- a chart's head ---- */
.mgrid[data-on="1"] .mhead:not([hidden]) { display: flex; align-items: center; gap: 4px; flex: none; min-width: 0; height: 30px; padding: 0 6px;
  border-bottom: 1px solid var(--hair); background: var(--surface); }
.mh-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 26px; padding: 0 6px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--mute); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.mh-name .mlogo { --logo: 16px; }
.mh-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.mh-name[aria-pressed="true"] { color: var(--text); cursor: default; }
.mh-mk { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--dim); cursor: pointer; }
.mh-mk .i { width: 12px; height: 12px; }
.mh-tf { position: relative; display: inline-flex; align-items: center; flex: none; }
.mh-tft { display: inline-flex; align-items: center; min-height: 26px; padding: 0 22px 0 8px; border-radius: var(--r-sm); color: var(--mute); font-size: 12px; }
.mh-tf .i { position: absolute; right: 6px; width: 12px; height: 12px; color: var(--dim); pointer-events: none; }
.mh-sel { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; padding: 0; opacity: 0; -webkit-appearance: none; appearance: none; cursor: pointer; }
.mh-sel option { background: var(--surface-2); color: var(--text); }
.mh-on { margin-inline-start: auto; padding: 0 4px; color: var(--silver); font-size: 11px; font-weight: 600; white-space: nowrap; }
.mh-name:focus-visible, .mh-mk:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.mh-tf:has(.mh-sel:focus-visible) .mh-tft { outline: 2px solid var(--focus); outline-offset: -2px; }
.mh-name:active, .mh-mk:active, .mh-tf:active .mh-tft { background: var(--surface-3); }
@media (hover: hover) {
  .mh-name:not([aria-pressed="true"]):hover, .mh-mk:hover, .mh-tf:hover .mh-tft { background: var(--surface-3); color: var(--text); }
}

/* ---- a chart beside the active one: its candles, its lines, the words of a history on its way or missing ---- */
.mc-wrap { position: relative; flex: 1; min-height: 0; background: var(--chart-bg); }
.mc-k { position: absolute; inset: 0; }
.mc-wrap[data-cover] .mc-k, .mc-wrap[data-cover] .lines { visibility: hidden; }
.mc-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 12px; color: var(--dim);
  font-size: 12px; text-align: center; }
.mc-state[hidden] { display: none; }
.mgrid[data-on="1"] .chartwrap { flex: 1; }

/* ---- the key of the chart's bar and its panel ---- */
.ct-mc .ctool-n { margin-inline-start: 2px; }
.cpop[data-kind="multi"] { width: min(300px, calc(100% - 16px)); padding: 8px; gap: 2px; }
.mc-h { margin: 4px 6px 4px; color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.mc-pre:disabled { opacity: 0.5; cursor: not-allowed; }
.mc-what { margin: 6px 6px 2px; color: var(--dim); font-size: 11.5px; line-height: 1.45; }
.mc-pre-t { display: grid; gap: 1px; min-width: 0; text-align: start; }
.mc-pre-t b { font-weight: 600; }
.mc-pre-t small { color: var(--dim); font-size: 11px; font-weight: 500; }
.mc-pre { min-height: 44px; }
/* a layout's drawing: its charts as small boxes */
.mc-g { display: grid; flex: none; gap: 2px; width: 18px; height: 14px; }
.mc-g i { border-radius: 1.5px; box-shadow: inset 0 0 0 1.25px currentColor; }
.mc-g[data-g="1"] i:nth-child(n + 2), .mc-g[data-g="2h"] i:nth-child(n + 3), .mc-g[data-g="2v"] i:nth-child(n + 3) { display: none; }
.mc-g[data-g="2h"] { grid-template-columns: 1fr 1fr; }
.mc-g[data-g="2v"] { grid-template-rows: 1fr 1fr; }
.mc-g[data-g="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
/* the sync: a switch, its state in its own place and colour (no word needed) */
.mc-sw { position: relative; flex: none; width: 28px; height: 16px; border-radius: 8px; background: var(--surface-4); box-shadow: inset 0 0 0 1px var(--hair-3); }
.mc-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); transition: transform var(--t-fast) var(--ease); }
.mc-sync[aria-checked="true"] .mc-sw { background: var(--silver); }
.mc-sync[aria-checked="true"] .mc-sw::after { background: var(--bg); transform: translateX(12px); }
[dir="rtl"] .mc-sync[aria-checked="true"] .mc-sw::after { transform: translateX(-12px); }
[dir="rtl"] .mc-sw::after { left: auto; right: 3px; }
