/* xcalpai theme: "Obsidian" (dark, default) and "Paper" (light, html[data-theme="paper"]), as on xcalpai.com: volcanic-
   glass black with a green cast, light type, emerald for what the app points at (buttons, the active tab, focus), IBM
   Plex type. Candles stay teal and coral so a rising candle never reads as a button. Every colour of the page comes
   from these tokens; app.js reads the chart's colours from them too (th(): those it reads are plain colours, not
   color-mix()). Candle colours stay in the chart settings. */
:root {
  --bg: #0a0d0c; --bg-deep: #060807; --pane: #101413; --pane2: #171c1a; --raise: #0f1312; --raise2: #161b19;
  --line: #1d2321; --line2: #2c3431; --line3: #4a544f;
  --ink: #dce3de; --ink2: #f1f4f1; --muted: #84908a; --muted2: #5f6a65;
  --accent: #1fbf86; --accent-ink: #4fdba6; --accent-hover: #17a673; --on-accent: #03140d;
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
  --up: #2bb5a0; --down: #ef5d68; --down-ink: #ff8a93; --warn: #f0b03c; --fib: #a78bfa; --sel: #f6d66b;
  --mine: color-mix(in srgb, var(--accent) 16%, var(--pane)); --mine-line: color-mix(in srgb, var(--accent) 32%, var(--pane));
  --chart-text: #9aa6a0; --grid: rgba(29, 35, 33, 0.8); --cross: #6f7b75; --label-bg: rgba(16, 20, 19, 0.92); --accent-a40: rgba(31, 191, 134, 0.4); --pattern: #6aa9ff;
  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
html[data-theme="paper"] {
  --bg: #f4f6f3; --bg-deep: #e8ece7; --pane: #fbfcfa; --pane2: #edf1ec; --raise: #eaeee9; --raise2: #e1e7e1;
  --line: #d9dfd8; --line2: #c4ccc3; --line3: #9aa59c;
  --ink: #1f2622; --ink2: #0c110e; --muted: #66716b; --muted2: #8d9791;
  --accent: #0f8a5f; --accent-ink: #0c7a53; --accent-hover: #0b6e4a; --on-accent: #ffffff;
  --up: #15877a; --down: #d0384a; --down-ink: #b42a3c; --warn: #b7791f; --sel: #b8860b;
  --mine: color-mix(in srgb, var(--accent) 10%, var(--pane)); --mine-line: color-mix(in srgb, var(--accent) 26%, var(--pane));
  --chart-text: #56615a; --grid: rgba(217, 223, 216, 0.9); --cross: #8d9791; --label-bg: rgba(251, 252, 250, 0.94); --accent-a40: rgba(15, 138, 95, 0.4); --pattern: #2d64c8;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: calc(13px + var(--fs-up))/1.45 var(--sans); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.fine { font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); } .warnc { color: var(--warn); }

.app { display: grid; height: 100vh; height: 100dvh; grid-template-columns: var(--rail-w) minmax(0, 1fr) auto var(--rail-w); grid-template-rows: var(--tabs-h) var(--top-h) minmax(0, 1fr) var(--bot-h);
  grid-template-areas: "tabs tabs tabs tabs" "top top top top" "tools chart side icons" "bottom bottom bottom icons"; }
/* bar, button and text sizes: large like other chart apps by default (text one pixel up), Compact in chart settings */
:root { --tabs-h: 42px; --top-h: 48px; --bot-h: 36px; --rail-w: 54px; --btn: 40px; --icon: 24px; --tb-h: 36px; --tb-icon: 22px; --tb-font: 14px; --tab-font: 14px; --fs-up: 1px; }
html.compact { --tabs-h: 38px; --top-h: 40px; --bot-h: 30px; --rail-w: 44px; --btn: 34px; --icon: 18px; --tb-h: 30px; --tb-icon: 18px; --tb-font: 13px; --tab-font: 13px; --fs-up: 0px; }

/* top toolbar */
.toolbar { grid-area: top; display: flex; align-items: center; gap: 4px; padding: 0 8px; font-size: var(--tb-font); border-bottom: 1px solid var(--line); background: var(--bg); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.brand { width: calc(var(--tb-h) - 2px); height: calc(var(--tb-h) - 2px); display: grid; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); margin-right: 4px; flex: none; }
.symbol { display: flex; align-items: center; gap: 6px; height: var(--tb-h); font-size: calc(var(--tb-font) + 1px); padding: 0 12px 0 8px; border-radius: 6px; border: 0; background: var(--pane); cursor: pointer; font-weight: 700; color: var(--ink2); flex: none; }
.symbol:hover { background: var(--pane2); }
.sep { width: 1px; height: calc(var(--tb-h) - 8px); background: var(--line); margin: 0 4px; flex: none; }
.grow { flex: 1; }
.intervals { display: flex; gap: 2px; flex: none; }
.intervals button, .ranges button { border: 0; background: transparent; padding: 0 9px; min-height: var(--tb-h); border-radius: 4px; cursor: pointer; color: var(--ink); font-weight: 500; }
.intervals button:hover, .ranges button:hover, .tbtn:hover, .tool:hover, .ib:hover { background: var(--pane); }
.intervals button.on { color: var(--accent-ink); background: var(--accent-soft); }
.tbtn { display: flex; align-items: center; gap: 6px; height: var(--tb-h); padding: 0 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; white-space: nowrap; flex: none; }
.tbtn.on { color: var(--accent-ink); background: var(--accent-soft); }
.tbtn.accent { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.tbtn.accent:hover { background: var(--accent-hover); }
.clockTag { font-size: calc(12px + var(--fs-up)); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; flex: none; }
.clockTag.live { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); }
.clockTag.replay { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.menuWrap { position: relative; flex: none; }
.menu { position: fixed; z-index: 30; min-width: 300px; background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); padding: 6px; }
.menu label { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.menu label:hover { background: var(--pane2); }
.menu input { accent-color: var(--accent); margin-top: 2px; }
.menu small { display: block; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); }

/* left tools */
.tools { grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; scrollbar-width: none; border-right: 1px solid var(--line); background: var(--bg); }
.tool, .ib { width: var(--btn); height: var(--btn); display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--ink); }
.tool.on { color: var(--accent-ink); background: var(--accent-soft); }
.tool.off svg { opacity: 0.4; }
.tsep { width: calc(var(--btn) - 10px); height: 1px; background: var(--line); margin: 6px 0; }

/* chart */
.chartArea { grid-area: chart; position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.chart { position: absolute; inset: 0; }
/* the XcalpAI mark at a chart's bottom left (placed by app.js placeMark above the time axis) */
.chartMark { position: absolute; left: 10px; bottom: 36px; z-index: 4; display: flex; align-items: center; gap: 7px; pointer-events: none; user-select: none;
  color: var(--ink2); opacity: 0.85; font-weight: 700; font-size: 17px; letter-spacing: 0.005em; line-height: 1; }
.chartMark svg { width: 28px; height: 24px; flex: none; }
.miniChart .chartMark { gap: 5px; font-size: 13px; }
.miniChart .chartMark svg { width: 21px; height: 18px; }
.legend { position: absolute; top: 8px; left: 10px; z-index: 5; display: grid; gap: 2px; max-width: calc(100% - 90px); pointer-events: none; }
.legend .row { display: flex; align-items: center; gap: 8px; font-size: calc(var(--tb-font) - 0.5px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; }
.legend .title { font-size: calc(var(--tb-font) + 1px); font-weight: 600; color: var(--ink2); }
.legend .ohlc span { margin-right: 6px; }
.legend .layer { color: var(--ink); width: fit-content; max-width: 100%; padding: 1px 6px 1px 4px; border-radius: 4px; }
.legend .layer:hover { background: color-mix(in srgb, var(--pane) 90%, transparent); }
.legend .layer.off { color: var(--muted); text-decoration: line-through; }
.legend .eye { width: 16px; height: 16px; border: 0; background: transparent; padding: 0; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.legend .eye svg { width: 14px; height: 14px; }
.legend .sw { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.legend .stat { color: var(--muted); }
.hoverTag { position: absolute; top: 8px; right: 76px; z-index: 6; display: grid; gap: 4px; justify-items: end; max-width: calc(100% - 120px); pointer-events: none; }
.hoverTag div { background: color-mix(in srgb, var(--pane) 92%, transparent); border: 1px solid var(--line2); border-left: 3px solid var(--muted); border-radius: 4px; padding: 3px 8px; font-size: calc(12.5px + var(--fs-up)); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hoverTag .up { color: var(--up); border-left-color: var(--up); }
.hoverTag .down { color: var(--down); border-left-color: var(--down); }
.legend .fold { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: calc(11px + var(--fs-up)); padding: 0 4px; }
.legend .fold:hover { color: var(--ink); }
.hint { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 90px); pointer-events: none; z-index: 6; background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 10px; font-size: calc(12px + var(--fs-up)); }
.measure { position: absolute; z-index: 6; background: color-mix(in srgb, var(--accent) 92%, transparent); color: var(--on-accent); border-radius: 6px; padding: 6px 10px; font-size: calc(12px + var(--fs-up)); line-height: 1.4; pointer-events: none; font-family: var(--mono); }
.replayBar { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 6px; background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); flex-wrap: wrap; width: max-content; max-width: calc(100% - 20px); }
.replayBar .rlabel { color: var(--warn); font-weight: 600; padding: 0 4px; }
.replayBar input { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 6px; }

/* side panel + icon bar */
.side { grid-area: side; position: relative; width: var(--side-w, 370px); border-left: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; min-height: 0; }
.side.closed { display: none; }
/* drag handle on the panel's left edge: wider than it looks, so it is easy to grab */
.sideGrip { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 6; touch-action: none; }
.sideGrip::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background 0.12s; }
.sideGrip:hover::after, .sideGrip:focus-visible::after, .sideGrip.drag::after { background: var(--accent); }
.sideGrip:focus { outline: none; }
body.resizing { cursor: col-resize; user-select: none; }
.panelHead { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--ink2); }
.x { border: 0; background: transparent; color: var(--muted); font-size: calc(18px + var(--fs-up)); cursor: pointer; width: 28px; height: 28px; border-radius: 6px; }
.x:hover { background: var(--pane); color: var(--ink); }
.panel { overflow-y: auto; padding: 10px 12px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; flex: 1; min-height: 0; }
.iconbar { grid-area: icons; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-left: 1px solid var(--line); background: var(--bg); }
.ib.on { color: var(--accent-ink); background: var(--accent-soft); }

/* bottom bar */
.bottombar { grid-area: bottom; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 calc(var(--rail-w) + 6px); border-top: 1px solid var(--line); background: var(--bg); min-width: 0; overflow: hidden; white-space: nowrap; }
.ranges { display: flex; gap: 2px; }
.ranges button { min-height: calc(var(--bot-h) - 8px); padding: 0 9px; font-size: calc(var(--tb-font) - 1px); }
.ranges button.on { color: var(--accent-ink); }

/* panel content */
.sect { display: grid; gap: 6px; }
.sect h3 { margin: 0; font-size: calc(11.5px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 10px; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-family: var(--mono); text-align: right; }
.rate { font-size: calc(12px + var(--fs-up)); color: var(--muted); margin: 0; }
.rate b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 4px 3px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: calc(11.5px + var(--fs-up)); }
.wl { display: grid; }
.wl .hdr, .wl button { display: grid; grid-template-columns: 1.3fr 1.2fr 0.9fr 0.6fr; gap: 6px; align-items: center; padding: 7px 6px; }
.wl .hdr { color: var(--muted); font-size: calc(11.5px + var(--fs-up)); border-bottom: 1px solid var(--line); }
.wl button { border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 4px; }
.wl button:hover { background: var(--pane); }
.wl button.on { background: var(--accent-soft); }
.wl .sym { font-weight: 600; color: var(--ink2); }
.wl .r { text-align: right; font-family: var(--mono); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.pill { padding: 0 7px; border-radius: 999px; border: 1px solid var(--line2); font-size: calc(12px + var(--fs-up)); }
.pill.up { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); } .pill.down { color: var(--down); border-color: color-mix(in srgb, var(--down) 50%, transparent); }
.phist { display: grid; gap: 2px; }
.phist button { display: grid; grid-template-columns: 18px 82px 1fr; gap: 8px; align-items: center; text-align: left; border: 0; background: transparent; border-radius: 4px; padding: 6px; cursor: pointer; }
.phist button:hover, .phist button.on { background: var(--pane); }
.phist .when { color: var(--muted); font-family: var(--mono); font-size: calc(11.5px + var(--fs-up)); }
.phist .sub2 { grid-column: 3; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); }
.res.ok { color: var(--up); } .res.bad { color: var(--down); } .res.none { color: var(--muted); }

.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.form input, .form select, .form textarea { min-width: 0; width: 100%; box-sizing: border-box; background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 7px 9px; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.dir { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dir input { position: absolute; opacity: 0; }
.dir label { text-align: center; padding: 8px; cursor: pointer; font-weight: 700; color: var(--muted); border-radius: 6px; background: var(--pane); }
.dir input:checked + label[for="dirBuy"] { background: var(--up); color: var(--on-accent); }
.dir input:checked + label[for="dirSell"] { background: var(--down); color: var(--on-accent); }
.dir input:focus-visible + label { outline: 2px solid var(--accent); }
.primary { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 6px; padding: 9px 12px; font-weight: 600; cursor: pointer; }
.primary:disabled { opacity: 0.6; cursor: wait; }
/* the Xia box locked (no Xia on the plan, none left): its Send button looks off, not busy */
#askForm button:disabled { opacity: 0.35; cursor: not-allowed; filter: grayscale(1); }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--pane); }
.bar span { display: block; height: 100%; }
.checks { display: grid; gap: 7px; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 8px; }
.mark { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: calc(11px + var(--fs-up)); font-weight: 700; }
.check.ok .mark { background: color-mix(in srgb, var(--up) 20%, transparent); color: var(--up); }
.check.warn .mark { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.check.info .mark { background: var(--accent-soft); color: var(--accent-ink); }

/* "Plan a trade": Buy / Sell with their prices, inputs in three groups (in, out, risk), a live summary, then the
   checked result: four figures, the three levels, the past-plan bar and the checks */
.planForm { gap: 14px; }
.planForm .dir { gap: 0; padding: 3px; border-radius: 10px; background: var(--bg-deep); border: 1px solid var(--line); }
.planForm .dir label { display: grid; justify-items: center; gap: 1px; padding: 8px 6px 7px; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.planForm .dir label:hover { color: var(--ink); }
.planForm .dirName { display: flex; align-items: center; gap: 5px; font-size: calc(14px + var(--fs-up)); }
.planForm .dirName svg { width: 14px; height: 14px; stroke-width: 2; }
.planForm .dir small { font-size: calc(11.5px + var(--fs-up)); font-weight: 500; opacity: 0.8; }
.planForm .dir input:checked + label[for="dirBuy"] { background: color-mix(in srgb, var(--up) 18%, var(--pane)); color: var(--up); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--up) 55%, transparent); }
.planForm .dir input:checked + label[for="dirSell"] { background: color-mix(in srgb, var(--down) 16%, var(--pane)); color: var(--down-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--down) 55%, transparent); }
.pgroup { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); display: grid; gap: 10px; min-width: 0; }
.pgroup legend { padding: 0 6px; margin-left: -4px; font-size: calc(11px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; color: var(--muted); }
.pfield { display: grid; gap: 5px; min-width: 0; }
.planForm .pfield > label { display: flex; align-items: baseline; gap: 6px; font-size: calc(12px + var(--fs-up)); color: var(--ink); font-weight: 500; }
.unitTag { font-size: calc(10.5px + var(--fs-up)); color: var(--muted2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.pin { position: relative; display: flex; align-items: center; min-width: 0; border-radius: 7px; background: var(--pane); border: 1px solid var(--line2); transition: border-color 0.15s, box-shadow 0.15s; }
.pin:hover { border-color: var(--line3); }
.pin:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.planForm .pin input { flex: 1; border: 0; background: transparent; padding: 8px 10px; outline: none; font-size: calc(13px + var(--fs-up)); color: var(--ink2); }
.planForm .pin input:focus { outline: none; }
.planForm .pin input::placeholder { color: var(--muted2); }
.planForm .pin input::-webkit-inner-spin-button { opacity: 0.35; }
.pin.set { border-color: color-mix(in srgb, var(--accent) 55%, var(--line2)); }
.pinX { flex: none; width: 24px; height: 24px; margin-right: 5px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--pane2); color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.pinX:hover { background: color-mix(in srgb, var(--down) 22%, var(--pane2)); color: var(--down-ink); }
.pnote { font-size: calc(11.5px + var(--fs-up)); color: var(--muted); min-height: 1.2em; }
.stopF .pnote { color: color-mix(in srgb, var(--down-ink) 80%, var(--muted)); }
.targetF .pnote { color: color-mix(in srgb, var(--up) 85%, var(--muted)); }
.stopF .pin { box-shadow: inset 3px 0 0 -1px var(--down); }
.targetF .pin { box-shadow: inset 3px 0 0 -1px var(--up); }
.stopF .pin:focus-within { box-shadow: inset 3px 0 0 -1px var(--down), 0 0 0 3px var(--accent-soft); }
.targetF .pin:focus-within { box-shadow: inset 3px 0 0 -1px var(--up), 0 0 0 3px var(--accent-soft); }
.planForm .ghost { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border-radius: 7px; border: 1px dashed var(--line3); background: transparent;
  color: var(--ink); cursor: pointer; font-size: calc(12.5px + var(--fs-up)); font-weight: 500; }
.planForm .ghost svg { width: 15px; height: 15px; }
.planForm .ghost:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.planForm .ghost.on { border-style: solid; border-color: var(--line2); color: var(--muted); }
.planForm .ghost.on:hover { border-color: color-mix(in srgb, var(--down) 60%, transparent); color: var(--down-ink); background: color-mix(in srgb, var(--down) 10%, transparent); }
.rrChips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: calc(11.5px + var(--fs-up)); color: var(--muted); }
.rrChips span { margin-right: 2px; }
.rrChips button { border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 999px; padding: 2px 9px; cursor: pointer; font-family: var(--mono); font-size: calc(11.5px + var(--fs-up)); }
.rrChips button:hover { border-color: var(--accent); color: var(--accent-ink); }
.rrChips button.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--accent-ink); }
.unitSeg { flex: none; display: flex; margin-right: 4px; padding: 2px; gap: 2px; border-radius: 6px; background: var(--bg-deep); }
.unitSeg button { border: 0; background: transparent; color: var(--muted); padding: 2px 8px; border-radius: 4px; cursor: pointer; font-family: var(--mono); font-size: calc(12px + var(--fs-up)); }
.unitSeg button.on { background: var(--pane2); color: var(--accent-ink); }
.psum { min-height: 64px; }
.psumGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); gap: 1px; }
.psumGrid > div { display: grid; gap: 2px; padding: 9px 10px; background: var(--bg-deep); min-width: 0; }
.psumGrid span, .ptile span { font-size: calc(10.5px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.psumGrid b { font-family: var(--mono); font-size: calc(15px + var(--fs-up)); font-weight: 600; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.psumGrid small, .ptile small { font-size: calc(11px + var(--fs-up)); color: var(--muted2); }
.psumGrid b.up, .ptile.up b { color: var(--up); } .psumGrid b.down, .ptile.down b { color: var(--down-ink); }
.pbad { margin: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); color: var(--warn); font-size: calc(12.5px + var(--fs-up)); }
.planForm .planGo { padding: 11px 12px; border-radius: 9px; font-size: calc(14px + var(--fs-up)); transition: background 0.15s, transform 0.1s; }
.planForm .planGo:hover { background: var(--accent-hover); }
.planForm .planGo:active { transform: translateY(1px); }
#planOut { display: grid; gap: 14px; transition: opacity 0.2s; }
#planOut:empty { display: none; }
.pstale { display: none; margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); font-size: calc(12px + var(--fs-up)); }
#planOut.stale .pstale { display: block; }
#planOut.stale > :not(.pstale) { opacity: 0.45; }
.pres { display: grid; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line2); background: linear-gradient(180deg, var(--raise2), var(--raise)); }
.presHead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.presHead b { color: var(--ink2); }
.presHead .fine { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdir { padding: 1px 8px; border-radius: 999px; font-size: calc(11.5px + var(--fs-up)); font-weight: 700; }
.pdir.buy { color: var(--up); background: color-mix(in srgb, var(--up) 16%, transparent); }
.pdir.sell { color: var(--down-ink); background: color-mix(in srgb, var(--down) 16%, transparent); }
.ptiles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.ptile { display: grid; gap: 2px; padding: 9px 10px; border-radius: 9px; background: var(--bg-deep); border: 1px solid var(--line); min-width: 0; }
.ptile b { font-family: var(--mono); font-size: calc(17px + var(--fs-up)); font-weight: 600; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pres > .fine { margin: 0; }
.plvls { display: grid; border-radius: 9px; border: 1px solid var(--line); overflow: hidden; }
.plvl { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; grid-template-areas: "bar name price" "bar sub sub"; column-gap: 10px; padding: 7px 10px 7px 0; background: var(--bg-deep); }
.plvl + .plvl { border-top: 1px solid var(--line); }
.plvl i { grid-area: bar; background: var(--muted2); }
.plvl.t i { background: var(--up); } .plvl.s i { background: var(--down); } .plvl.e i { background: var(--ink); }
.plvl span { grid-area: name; color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.plvl b { grid-area: price; color: var(--ink2); font-weight: 600; }
.plvl small { grid-area: sub; color: var(--muted2); font-size: calc(11px + var(--fs-up)); }
.barKey { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: calc(11.5px + var(--fs-up)); color: var(--muted); }
.barKey i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.barKey b { color: var(--ink); font-family: var(--mono); }
.chart.onplan, .chart.onplan * { cursor: ns-resize !important; }
.answer { display: grid; gap: 8px; }
.answer h4 { margin: 6px 0 0; font-size: calc(12.5px + var(--fs-up)); color: var(--ink2); }
.answer ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.answer p { margin: 0; }
.err { color: var(--warn); }
.loading { color: var(--muted); }

/* search dialog */
.dialogBack { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.5); display: grid; place-items: start center; padding-top: 12vh; }
.dialog { width: min(520px, 92vw); background: var(--pane); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); overflow: hidden; }
#searchInput { width: 100%; border: 0; border-bottom: 1px solid var(--line2); background: transparent; padding: 14px 16px; font-size: calc(15px + var(--fs-up)); outline: none; }
.searchList { max-height: 50vh; overflow-y: auto; padding: 6px; }
.searchList button { width: 100%; display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; }
.searchList button:hover, .searchList button.on { background: var(--pane2); }

@media (max-width: 900px) {
  :root:not(.compact) { --rail-w: 46px; --btn: 38px; --icon: 22px; }
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--rail-w); grid-template-areas: "tabs tabs tabs" "top top top" "tools chart icons" "bottom bottom icons"; }
  .side { position: fixed; right: var(--rail-w); top: calc(var(--tabs-h) + var(--top-h)); bottom: var(--bot-h); z-index: 20; width: min(var(--side-w, 340px), calc(100vw - 80px)); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4); }
  .toolbar .tbtn span, .clockTag { display: none; }
  .toolbar .tbtn.accent span { display: inline; }
  .bottombar .fine { display: none; }
  .sideGrip { display: none; }
}
/* phones: full mobile layout (<= 640px and 390px phone widths) */
@media (max-width: 640px) {
  :root {
    --rail-w: 36px;
    --btn: 30px;
    --icon: 18px;
    --tb-h: 34px;
    --tb-icon: 18px;
    --tb-font: 13px;
    --top-h: 40px;
    --bot-h: 32px;
    --tabs-h: 34px;
    --wl-details: 160px;
  }

  /* Toolbar: smooth touch swipe, hide cluttering secondary desktop buttons */
  .toolbar {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    gap: 3px;
    padding: 0 4px;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .toolbar #paletteBtn,
  .toolbar #layoutBtn,
  .toolbar #undoBtn,
  .toolbar #redoBtn,
  .toolbar #layoutSaveBtn,
  .toolbar #fullBtn,
  .toolbar #shotBtn,
  .toolbar #shareBtn,
  .toolbar #askBtn,
  .toolbar .sep {
    display: none !important;
  }
  .toolbar .symbol {
    padding: 0 8px;
    font-size: 13px;
    gap: 4px;
  }
  .toolbar .intervals button {
    padding: 0 6px;
    font-size: 12px;
  }

  /* Full screen modal side panel with clean close button */
  .side {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 50;
    box-shadow: none;
    background: var(--bg);
  }
  /* dialogs and menus opened from the full-screen panel (Messages: profile, message menu, Message info) go over it */
  .dialogBack { z-index: 52; }
  #popMenu.menu { z-index: 56; }
  .panelHead {
    height: 44px;
    padding: 0 12px;
  }
  .panelHead .x {
    width: 38px;
    height: 38px;
    font-size: 24px;
    display: grid;
    place-items: center;
  }
  .wlTop .wlBtn {
    width: 36px;
    height: 36px;
  }

  /* Left drawing tools rail */
  .tools {
    padding: 4px 0;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }
  .tools .tsep {
    margin: 3px 0;
  }

  /* Compact legend and OHLC bar */
  .legend {
    top: 4px;
    left: 4px;
    gap: 1px;
    max-width: calc(100% - 50px);
  }
  .legend .row {
    font-size: 11px;
    gap: 4px;
  }
  .legend .row .fine {
    display: none;
  }
  .legend .title {
    font-size: 12px;
  }
  .legend .ohlc {
    font-size: 9.5px;
    gap: 2px;
  }
  .legend .ohlc span {
    margin-right: 2px;
  }
  .legend .quote button {
    padding: 2px 6px;
    font-size: 11px;
  }
  .legend .layersChip {
    padding: 1px 5px;
    font-size: 10px;
  }

  /* Bottom bar: compact controls on mobile */
  .bottombar {
    padding: 0 4px;
    font-size: 11px;
  }
  .bottombar .ranges button {
    padding: 0 4px;
    font-size: 10.5px;
  }
  .bottombar .fine {
    display: none !important;
  }

  /* Dialogs / popups fit mobile screen */
  .dialog {
    width: 96vw;
    max-height: 85vh;
  }
}

/* the hidden attribute always wins over display rules above */
[hidden] { display: none !important; }
.chartArea:has(.replayBar:not([hidden])) .hint { bottom: 110px; }

/* ── v2: the chart tools ─────────────────────────── */
.tbtn.icon { width: var(--tb-h); padding: 0; justify-content: center; }
.tbtn.icon svg, .tbtn svg { width: var(--tb-icon); height: var(--tb-icon); }
.tool svg, .ib svg { width: var(--icon); height: var(--icon); }
.tbtn.small { height: calc(var(--bot-h) - 8px); width: auto; padding: 0 6px; }
.tbtn.small svg { width: calc(var(--tb-icon) - 2px); height: calc(var(--tb-icon) - 2px); }
.tbtn:hover:not(.accent), .tool:hover, .ib:hover { background: var(--pane2); }
.tgroup { position: relative; display: flex; align-items: center; }
.tgroup .caret { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); width: 10px; height: 18px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: calc(9px + var(--fs-up)); cursor: pointer; opacity: 0; }
.tgroup:hover .caret { opacity: 1; }
.tgroup .caret:hover { color: var(--ink); }
.chart.placing, .chart.placing * { cursor: crosshair !important; }
.chart.ondraw, .chart.ondraw * { cursor: move !important; }
.chart.onhandle, .chart.onhandle * { cursor: pointer !important; }

/* pop-up menus (chart type, layers, tool groups, right click) */
.menu { min-width: 220px; max-height: 70vh; overflow-y: auto; }
/* as wide as its longest line (not squeezed by where it opened last), never wider than the window */
#popMenu { width: max-content; }
#popMenu:not(.wide) { max-width: min(440px, calc(100vw - 12px)); }
.menu > button { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; color: var(--ink); }
.menu > button:hover { background: var(--pane2); }
.menu > button.on { color: var(--accent-ink); }
.menu > button svg { width: 18px; height: 18px; }
.menu > button small { grid-column: 3; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); max-width: 220px; white-space: normal; text-align: right; }
/* the label always takes the middle column, on one line (cut with … when there is no room), so an item without an
   icon no longer drops into the 22px icon slot and wraps a word a line; a menu with no icons or ticks has no slot */
.menu > button > span:not(.ck) { grid-column: 2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu:not(:has(> button > svg, > button > .ck)) > button > span:not(.ck) { grid-column: 1 / 3; }
.menu .ck { width: 16px; height: 16px; border: 1px solid var(--line2); border-radius: 3px; display: grid; place-items: center; font-size: calc(11px + var(--fs-up)); color: var(--accent-ink); }
.menu .msep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu .mhead2 { padding: 6px 8px 4px; font-size: calc(11px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
/* the interval menu: section headers that fold with their arrow, a star that pins an interval to the top bar */
.menu > button.mfold { display: flex; justify-content: space-between; padding: 7px 8px 5px; font-size: calc(11px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.menu > button.mfold:hover { color: var(--ink); }
.menu > button.mfold svg { width: 16px; height: 16px; transition: transform 0.15s; }
.menu > button.mfold[aria-expanded="false"] svg { transform: rotate(180deg); }
.menu > button.tfRow > span:not(.ck) { grid-column: 1 / 3; }
.menu > button.tfRow { min-height: 34px; }
.menu > button.locked > span { color: var(--muted); }
.menu .mpin, .menu .mlock { grid-column: 3; display: grid; place-items: center; width: 24px; height: 24px; margin: -4px -2px; border-radius: 5px; color: var(--muted); }
.menu .mpin svg, .menu .mlock svg { width: 16px; height: 16px; }
.menu .mpin { opacity: 0; }
.menu > button:hover .mpin, .menu > button:focus-visible .mpin { opacity: 1; }
.menu .mpin:hover { color: var(--ink); background: var(--pane); }
.menu .mpin.on { opacity: 1; color: #f7a600; }
.menu .mpin.on svg { fill: currentColor; }
@media (hover: none) { .menu .mpin { opacity: 0.55; } .menu .mpin.on { opacity: 1; } }
/* the search box on top of long lists: stays put while the list scrolls under it */
.menu > .msearch { position: sticky; top: -6px; z-index: 1; display: block; width: 100%; margin: 0 0 4px; padding: 7px 10px; border: 1px solid var(--line2); border-radius: 6px;
  background: var(--bg); box-shadow: 0 0 0 6px var(--pane); outline: none; accent-color: auto; font-size: calc(13.5px + var(--fs-up)); }
.menu > .msearch:focus { border-color: var(--accent); }
.menu:has(> .msearch) { min-width: 290px; }
.menu:has(> .msearch) > button { grid-template-columns: 22px max-content minmax(0, 1fr); }   /* the symbol stays whole, a long name shortens */
.menu:has(> .msearch) > button small { min-width: 0; max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu > button.hi { background: var(--pane2); }
.menu > button { scroll-margin-top: 44px; }
.menu .mnone { margin: 0; padding: 14px 10px; color: var(--muted); }
@media (max-width: 640px) { .menu > .msearch { font-size: 16px; } }   /* 16px keeps phones from zooming in on it */

/* legend rows for indicators and compared pairs; buttons appear on hover like other chart apps */
.legend .row.ind { gap: 6px; width: fit-content; max-width: 100%; padding: 1px 6px 1px 4px; border-radius: 4px; }
.legend .row.ind:hover, .paneLegend .row.ind:hover { background: color-mix(in srgb, var(--pane) 90%, transparent); }
.row.ind.off { color: var(--muted); }
.row.ind .vals span { margin-right: 6px; }
.row.ind .ibtns { display: none; gap: 2px; }
.row.ind:hover .ibtns { display: inline-flex; }
.row.ind .ibtns button { width: 20px; height: 20px; border: 0; padding: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 4px; }
.row.ind .ibtns button:hover { color: var(--ink); background: var(--pane2); }
.row.ind .ibtns svg { width: 14px; height: 14px; }
.paneLegend { position: absolute; left: 10px; z-index: 5; display: grid; gap: 2px; pointer-events: none; }
.paneLegend .row { display: flex; align-items: center; gap: 6px; font-size: calc(12px + var(--fs-up)); white-space: nowrap; pointer-events: auto; }

/* floating style bar for the selected drawing */
.floatbar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 3px; padding: 4px 6px; background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none; }
.floatbar .fbname { font-size: calc(12px + var(--fs-up)); color: var(--muted); padding: 0 6px 0 2px; white-space: nowrap; }
.floatbar.moved { transform: none; }
.floatbar .fbGrip { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 26px; flex: none; cursor: grab; color: var(--muted); touch-action: none; border-radius: 4px; }
.floatbar .fbGrip:hover { color: var(--ink2); background: var(--pane2); }
.floatbar .fbGrip svg { width: 8px; height: 16px; fill: currentColor; }
.floatbar.dragging, .floatbar.dragging .fbGrip { cursor: grabbing; user-select: none; }
.floatbar button { height: 26px; min-width: 26px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); cursor: pointer; font-size: calc(12px + var(--fs-up)); white-space: nowrap; flex: none; }
.floatbar button:hover, .floatbar button.on { background: var(--pane2); }
.floatbar button svg { width: 16px; height: 16px; }
.floatbar .swatch { min-width: 18px; width: 18px; height: 18px; padding: 0; border-radius: 4px; border: 2px solid transparent; }
.floatbar .swatch.on { border-color: var(--on-accent); }
.floatbar input { width: 140px; height: 26px; background: var(--bg); border: 1px solid var(--line2); border-radius: 5px; padding: 0 8px; }

/* dialogs */
.dialog.wide { width: min(560px, 94vw); }
#modal { padding: 0 0 14px; max-height: 80vh; overflow-y: auto; }
#modal .mhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: calc(15px + var(--fs-up)); }
#modal .x { border: 0; background: transparent; font-size: calc(20px + var(--fs-up)); cursor: pointer; color: var(--muted); }
#modal .form, #modal > p, #modal .searchList, #modal .keys { margin: 12px 16px 0; }
#modal #indSearch { width: calc(100% - 32px); margin: 12px 16px 4px; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 9px 12px; font-size: calc(14px + var(--fs-up)); outline: none; }
#modal #indSearch:focus { border-color: var(--accent); }
.indList { max-height: 50vh; overflow-y: auto; padding: 0 10px; }
.indList h4 { margin: 12px 6px 4px; font-size: calc(11px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.indList button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 8px 8px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; color: var(--ink); }
.indList button:hover { background: var(--pane2); }
.mfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.mfoot button { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line2); background: transparent; cursor: pointer; }
.mfoot .primary { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.mfoot .primary:hover { background: var(--accent-hover); }
.colorRow { display: flex; flex-wrap: wrap; gap: 12px; }
.colorRow label { display: grid; gap: 4px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.colorRow input[type="color"] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--line2); border-radius: 5px; background: transparent; }
.form .check1 { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: calc(13px + var(--fs-up)); }
.form .check1 input { width: auto; accent-color: var(--accent); }
.keys { border-collapse: collapse; width: calc(100% - 32px); }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: calc(13px + var(--fs-up)); }
kbd { font-family: var(--mono); font-size: calc(12px + var(--fs-up)); background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 1px 6px; }

/* object tree and alerts */
.obj { display: flex; align-items: center; gap: 4px; padding: 5px 4px; border-radius: 6px; }
.obj:hover, .obj.on { background: var(--pane2); }
.obj > span, .obj .oname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj .oname { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; text-align: left; color: var(--ink); padding: 0; }
.obj button { border: 0; background: transparent; cursor: pointer; color: var(--muted); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; flex: none; }
.obj .oname { width: auto; height: auto; display: flex; color: var(--ink); }
.obj button:hover { color: var(--ink); }
.obj button svg { width: 15px; height: 15px; }
.obj .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.obj.alert > span { white-space: normal; }
.obj.alert small { display: block; }
.obj.alert.done { opacity: 0.6; }
.primary.wide { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 8px; }
.primary.wide svg { width: 16px; height: 16px; }

/* bottom bar scale buttons, toasts */
.scaleBtns { display: flex; gap: 2px; border-left: 1px solid var(--line); padding-left: 8px; }
.scaleBtns button { min-height: calc(var(--bot-h) - 8px); padding: 0 8px; font-size: calc(var(--tb-font) - 1px); border: 0; background: transparent; border-radius: 4px; cursor: pointer; color: var(--muted); }
.scaleBtns button.on { color: var(--accent-ink); background: var(--accent-soft); }
/* toasts, the update bar, plan and connection bars, fired alerts: "pop-up notices" near the end */
.app:fullscreen { width: 100vw; height: 100vh; }

/* ── v2 batch 2: layouts, screener ───────────────────────── */
.cells { position: absolute; inset: 0; display: grid; gap: 2px; background: var(--line2); grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.cells.l2h { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cells.l2v { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.cells.l3 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.cells.l3 .cell.main { grid-row: 1 / span 2; }
.cells.l4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.cell { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.cell.mini { display: flex; flex-direction: column; }
.miniHead { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--line); font-size: calc(12px + var(--fs-up)); white-space: nowrap; overflow: hidden; }
.miniHead select { background: var(--pane); border: 1px solid var(--line2); border-radius: 5px; padding: 2px 4px; font-size: calc(12px + var(--fs-up)); font-weight: 600; }
.miniHead .mv { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: calc(11px + var(--fs-up)); }
.miniHead .mm { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: calc(15px + var(--fs-up)); padding: 0 4px; }
.miniHead .mm:hover { color: var(--ink); }
.miniChart { position: relative; flex: 1; min-height: 0; }
#utcClock { cursor: pointer; }
.wideModal .dialog.wide { width: min(980px, 96vw); }
/* Retail sentiment: Dukascopy's widget, framed */
.sentNote { margin: 0 0 12px; max-width: 900px; }
.sentOutside { margin: 16px 16px 20px; max-width: 560px; }
.sentOutside p { margin: 0 0 14px; }
.sentFrame { display: block; width: 100%; height: min(72vh, 760px); border: 0; background: transparent; }
.dialogBack.asPage .sentFrame { height: calc(100vh - var(--tabs-h) - 150px); min-height: 480px; }
.scrBar { display: flex; align-items: center; gap: 12px; margin: 12px 16px 0; flex-wrap: wrap; }
.scrBar select { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; }
.scrBar button { border: 1px solid var(--line2); background: transparent; border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.scrBody { margin: 10px 16px 0; overflow-x: auto; }
table.scr { width: 100%; border-collapse: collapse; font-size: calc(13px + var(--fs-up)); white-space: nowrap; }
table.scr th { text-align: right; font-weight: 500; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line2); cursor: pointer; user-select: none; }
table.scr th:first-child, table.scr td:first-child { text-align: left; }
table.scr th.on { color: var(--accent-ink); }
table.scr td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: calc(12.5px + var(--fs-up)); }
table.scr td:first-child { font-family: inherit; }
table.scr tr[data-pair] { cursor: pointer; }
table.scr tr[data-pair]:hover td { background: var(--pane2); }

/* ── batch 3 ─────────────────────────────────────────────── */
.chart.erasing, .chart.erasing * { cursor: not-allowed !important; }
.chart.erasing.ondraw, .chart.erasing.ondraw * { cursor: pointer !important; }
.tool { position: relative; }
.tool .badge { position: absolute; right: 3px; bottom: 2px; font-size: calc(8px + var(--fs-up)); font-style: normal; font-weight: 700; color: var(--accent-ink); }
.floatbar .emo { font-size: calc(16px + var(--fs-up)); padding: 0 3px; }

.legend .row.quote { gap: 4px; margin: 2px 0 4px; }
.legend .quote button { display: grid; justify-items: center; line-height: 1.1; padding: 3px 10px; border-radius: 5px; background: color-mix(in srgb, var(--bg) 85%, transparent); cursor: pointer; font-family: var(--mono); font-size: calc(13px + var(--fs-up)); }
.legend .quote button small { font-family: var(--sans); font-size: calc(9.5px + var(--fs-up)); letter-spacing: 0.06em; }
.legend .quote .qsell { border: 1px solid var(--down); color: var(--down); }
.legend .quote .qbuy { border: 1px solid var(--accent); color: var(--accent-hover); }
.legend .quote .qsell:hover { background: color-mix(in srgb, var(--down) 15%, transparent); }
.legend .quote .qbuy:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.legend .quote .spr { font-size: calc(11px + var(--fs-up)); color: var(--muted); }
.plusBtn { position: absolute; z-index: 7; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line2); background: var(--pane); color: var(--ink); font-size: calc(15px + var(--fs-up)); line-height: 1; cursor: pointer; padding: 0; }
.plusBtn:hover { background: var(--accent); border-color: var(--accent); }
/* ">>" back to the live candle: bottom right of each chart, placed by placeLive() */
.liveBtn { position: absolute; right: 70px; bottom: 36px; z-index: 7; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line2); background: var(--pane); color: var(--ink2);
  display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.liveBtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.liveBtn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.liveBtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cells.l9 .liveBtn, .cells.l16 .liveBtn { width: 24px; height: 24px; }
@media (pointer: coarse), (max-width: 640px) { .liveBtn, .cells.l9 .liveBtn, .cells.l16 .liveBtn { width: 40px; height: 40px; } .liveBtn svg { width: 20px; height: 20px; } }
.hoverTag .warn { color: var(--warn); border-left-color: var(--warn); }
.intervals .tfmore { color: var(--muted); padding: 0 6px; }

.chart.selecting, .chart.selecting * { cursor: col-resize !important; }
.replayBar select { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 4px; font-size: calc(12px + var(--fs-up)); }

.layoutSave .ln { display: grid; line-height: 1.05; text-align: left; }
.layoutSave .ln b { font-weight: 500; font-size: calc(12.5px + var(--fs-up)); }
.layoutSave .ln small { font-size: calc(10px + var(--fs-up)); color: var(--accent-ink); }
.indRow { display: flex; align-items: center; }
.indRow .star { width: 26px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: calc(15px + var(--fs-up)); flex: none; }
.indRow .star.on { color: var(--warn); }
.indRow [data-add] { flex: 1; }
.tplBar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 16px 0; font-size: calc(12.5px + var(--fs-up)); }
.tplBar select { background: var(--bg); border: 1px solid var(--line2); border-radius: 5px; padding: 4px 6px; min-width: 120px; }
.tplBar button { border: 1px solid var(--line2); background: transparent; border-radius: 5px; padding: 4px 8px; cursor: pointer; }

.wl.wl5 .hdr, .wl.wl5 button { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1.05fr) minmax(0, 0.6fr) minmax(0, 0.75fr) minmax(0, 0.65fr); gap: 4px; font-size: calc(12.5px + var(--fs-up)); }
.wl .srt { cursor: pointer; user-select: none; }
.wl .srt.on { color: var(--accent-ink); }
.wl .sym { display: flex; align-items: center; gap: 5px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; }
/* country flags & crypto vector logos: round SVGs shipped with the page (flags/ & coins/) */
.flagImg, .coinImg { display: inline-block; width: 1.2em; height: 1.2em; border-radius: 50%; vertical-align: -0.25em; user-select: none; object-fit: contain; }
i > .flagImg, i > .coinImg { display: block; width: 100%; height: 100%; border-radius: 50%; }
.flags { display: inline-flex; align-items: center; font-size: calc(11px + var(--fs-up)); margin-right: 4px; flex: none; vertical-align: middle; }
.flags i { width: 1.4em; height: 1.4em; border-radius: 50%; overflow: hidden; background: var(--pane2); }
.flags i + i { margin-left: -0.45em; box-shadow: 0 0 0 1.5px var(--bg); }
.mflag { display: inline-block; width: 16px; height: 16px; margin-right: 7px; vertical-align: -3px; }
.pairDetails { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.pairDetails h4 { margin: 12px 0 6px; font-size: calc(12px + var(--fs-up)); color: var(--muted); font-weight: 600; }
.pdHead { display: flex; align-items: center; gap: 6px; }
.pdPrice { font-size: calc(26px + var(--fs-up)); font-weight: 600; margin-top: 6px; }
.pdPrice small { font-size: calc(12px + var(--fs-up)); color: var(--muted); margin-left: 4px; }
.pdChg { font-size: calc(13px + var(--fs-up)); margin-bottom: 2px; }
.perf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.perf div { display: grid; justify-items: center; padding: 6px 2px; border-radius: 5px; background: var(--pane); font-size: calc(12px + var(--fs-up)); }
.perf div span { color: var(--muted); font-size: calc(11px + var(--fs-up)); }
.perf .pos { background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); }
.perf .neg { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
#panel-datawindow h4 { margin: 8px 0 4px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
#panel-datawindow .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* layer list as a dropdown */
.legend .layersChip { border: 1px solid var(--line2); background: color-mix(in srgb, var(--pane) 85%, transparent); color: var(--ink); border-radius: 5px; padding: 1px 8px; font-size: calc(11.5px + var(--fs-up)); cursor: pointer; }
.legend .layersChip b { color: var(--accent-ink); font-weight: 600; }
.legend .layersChip:hover { border-color: var(--accent); }
.menu.wide { min-width: 360px; max-width: min(460px, 94vw); }
.menu.wide > button { grid-template-columns: 22px minmax(0, 1fr); }
.menu.wide > button small { grid-column: 2; text-align: left; max-width: none; }
.menu > button.off > span { color: var(--muted); text-decoration: line-through; }
.menu .msw { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }

.cells.l6 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cells.l8 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cells.l9 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(0, 1fr)); }
.cells.l16 { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(0, 1fr)); }
.cells.l9 .miniHead, .cells.l16 .miniHead { padding: 2px 4px; font-size: calc(11px + var(--fs-up)); }
.cells.l9 .miniHead .mv, .cells.l16 .miniHead .mv { display: none; }

.seasChart { position: relative; height: 340px; margin: 12px 16px 0; border-radius: 6px; overflow: hidden; }
.seasLegend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 16px 0; font-size: calc(12px + var(--fs-up)); }
.seasLegend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
table.seas td, table.seas th { padding: 4px 6px; text-align: center !important; font-size: calc(11.5px + var(--fs-up)); }
table.seas tr.tot td { font-weight: 600; border-top: 1px solid var(--line2); }
table.hm td, table.hm th { text-align: center !important; padding: 9px 6px; }
table.hm td.self { background: var(--pane2); }
table.hm td.link { cursor: pointer; }
table.hm td.link:hover { outline: 1px solid var(--on-accent); }
.scrBar button.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }
.hmh { margin: 14px 16px 6px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.strengthBars { margin: 0 16px; display: grid; gap: 4px; }
.strengthBars div { display: grid; grid-template-columns: 70px 1fr 70px; gap: 8px; align-items: center; font-size: calc(12.5px + var(--fs-up)); }
.strengthBars i { height: 8px; border-radius: 4px; display: block; }
.strengthBars b { text-align: right; font-family: var(--mono); font-weight: 500; }
.palInput { width: calc(100% - 24px); margin: 12px; background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; padding: 10px 12px; font-size: calc(15px + var(--fs-up)); outline: none; color: var(--ink); }
.palList { max-height: 55vh; overflow-y: auto; padding: 0 8px 4px; }
.palList button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; color: var(--ink); }
.palList button.on, .palList button:hover { background: var(--pane2); }
.palList small { color: var(--muted); font-size: calc(11px + var(--fs-up)); flex: none; }

.ycBody { margin: 0 16px; }
.ycBody h4 { margin: 14px 0 6px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.ycSvg { width: 100%; height: auto; display: block; background: var(--pane); border-radius: 6px; }
.ycSvg text { fill: var(--muted); font-size: calc(11px + var(--fs-up)); font-family: var(--sans); }
.ycSvg text.v { fill: var(--sel); font-size: calc(10px + var(--fs-up)); }
.ycFacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.ycFacts div { background: var(--pane); border-radius: 6px; padding: 8px 10px; display: grid; gap: 2px; }
.ycFacts b { font-family: var(--mono); font-size: calc(16px + var(--fs-up)); }
.ycFacts span { font-size: calc(11px + var(--fs-up)); color: var(--muted); }
.ycSpread { position: relative; height: 200px; border-radius: 6px; overflow: hidden; }

.note { background: color-mix(in srgb, var(--warn) 10%, transparent); border-left: 3px solid var(--warn); padding: 8px 10px; border-radius: 4px; font-size: calc(12.5px + var(--fs-up)); margin: 0 0 10px; }

/* desktop app (macOS hidden title bar): room for the window buttons, and the toolbar drags the window */
html.desktop.mac .tabStrip { padding-left: 78px; }
html.desktop .tabStrip { -webkit-app-region: drag; }
html.desktop .tabStrip .tab, html.desktop .tabStrip button { -webkit-app-region: no-drag; }
html.desktop .toolbar button, html.desktop .toolbar input, html.desktop .toolbar select, html.desktop .toolbar .intervals, html.desktop .toolbar .clockTag { -webkit-app-region: no-drag; }

/* plain-language briefing */
.plain { margin: 4px 0 8px; font-size: calc(13px + var(--fs-up)); line-height: 1.5; }
.plainTable td { padding: 4px 6px 4px 0; font-size: calc(13px + var(--fs-up)); }
.lvl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: calc(13px + var(--fs-up)); }
.lvl small { grid-column: 1 / -1; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); }

/* Xia chat: messages scroll, the input stays at the bottom */
.panel.chatPanel { display: flex; flex-direction: column; gap: 8px; overflow: hidden; padding-bottom: 10px; }
.chatTop { display: flex; align-items: center; gap: 8px; }
.chatTop label { font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.chatTop select { flex: 1; min-width: 0; background: var(--pane); color: var(--ink); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 6px; font: inherit; font-size: calc(13px + var(--fs-up)); }
.chatLog { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.bubble { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: calc(13.5px + var(--fs-up)); line-height: 1.5; display: grid; gap: 6px; }
.bubble p { margin: 0; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.bubble.bot { align-self: flex-start; background: var(--pane2); color: var(--ink); border-bottom-left-radius: 4px; }
.bubble .tag { font-size: calc(10.5px + var(--fs-up)); font-weight: 600; letter-spacing: 0.04em; opacity: 0.75; }
.bubble.me .tag { display: block; }
.bubble details { border-top: 1px solid var(--line2); padding-top: 6px; }
.bubble summary { cursor: pointer; color: var(--accent); font-size: calc(12.5px + var(--fs-up)); font-weight: 600; }
.bubble details[open] summary { margin-bottom: 4px; }
.bubble h4 { margin: 8px 0 2px; font-size: calc(12.5px + var(--fs-up)); color: var(--ink2); }
.bubble ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.bubble.typing { color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chatDot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.6; } }
.chatSuggest { display: flex; flex-wrap: wrap; gap: 6px; }
.chatSuggest:empty { display: none; }
.chatSuggest.compact { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chatSuggest.compact .chip { flex: none; }
.chatSuggest .chip { border: 1px solid var(--line2); background: transparent; color: var(--ink2); border-radius: 14px; padding: 4px 10px; font: inherit; font-size: calc(12px + var(--fs-up)); cursor: pointer; }
.chatSuggest .chip:hover { border-color: var(--accent); color: var(--ink); }
.chatInput { display: flex; gap: 6px; align-items: flex-end; }
.chatInput textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; background: var(--pane); color: var(--ink); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: calc(13.5px + var(--fs-up)); line-height: 1.4; }
.chatInput textarea:focus { outline: none; border-color: var(--accent); }
.chatInput .primary { width: auto; padding: 8px 14px; border-radius: 10px; }
.chatNote { margin: 0; }
#xiaLeft { display: block; margin-top: 2px; color: var(--ink2); }
#xiaLeft:empty { display: none; }
.chatInput textarea:disabled, .chatInput .primary:disabled { opacity: 0.55; cursor: not-allowed; }
.bubble.xiaLock .planSee { display: inline-block; text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 600; }

/* news items in the calendar panel */
.newsItem { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: calc(13px + var(--fs-up)); }
.newsHead { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.newsHead > span:first-child { font-weight: 600; }
.newsHead .fine { white-space: nowrap; }
.imp { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.imp.high { background: var(--down); } .imp.medium { background: var(--warn); }

/* calendar panel: tabs, and the week-view economic calendar */
.calTabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.calTabs [data-cal] { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: calc(13px + var(--fs-up)); font-weight: 600; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.calTabs [data-cal].on { background: var(--pane2); color: var(--ink2); }
.calTabs .calWide { margin-left: auto; height: 28px; color: var(--muted); }
.ecHead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; position: relative; }
.ecBtn { border: 1px solid var(--line2) !important; height: 34px; padding: 0 12px; color: var(--ink); font-size: calc(13.5px + var(--fs-up)); border-radius: 7px; }
.ecIcon { width: 34px; padding: 0 !important; display: inline-grid; place-items: center; font-size: calc(16px + var(--fs-up)); }
.ecIcon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.ecArrow { border: 0; background: transparent; color: var(--ink); font-size: calc(20px + var(--fs-up)); width: 28px; height: 34px; border-radius: 6px; cursor: pointer; }
.ecArrow:hover { background: var(--pane2); }
.ecWeek { font-size: calc(19px + var(--fs-up)); font-weight: 700; margin-left: 4px; color: var(--ink2); white-space: nowrap; }
.ecGap { flex: 1; }
.ecDate { position: absolute; left: 60px; top: 34px; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.ecStrip { position: relative; }
.ecDays { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(108px, 1fr); gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.ecDays::-webkit-scrollbar { display: none; }
.ecDay { display: grid; align-content: start; gap: 3px; min-height: 104px; text-align: left; border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; scroll-snap-align: start; }
.ecDay:hover { background: var(--pane2); }
.ecDay b { font-size: calc(15px + var(--fs-up)); font-weight: 600; width: fit-content; padding-bottom: 3px; margin-bottom: 4px; border-bottom: 2px solid transparent; }
.ecDay.today b { border-bottom-color: var(--ink2); }
.ecDay.today, .ecDay.sel { background: var(--pane2); }
.ecDay.sel { border-color: var(--muted); }
.ecDay.empty { opacity: 0.7; }
.ecCnt { display: flex; justify-content: space-between; gap: 8px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.ecCnt span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }
.ecCnt .impHigh { color: var(--down); }
.ecScroll { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: var(--pane2); color: var(--ink); font-size: calc(20px + var(--fs-up)); cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); }
.ecScroll.left { left: -6px; } .ecScroll.right { right: -6px; }
.ecScroll:hover { background: var(--line2); }
.ecChips { display: flex; flex-wrap: wrap; gap: 8px; }
.ecChips button { border: 0; border-radius: 18px; padding: 8px 16px; background: var(--pane2); color: var(--ink2); font: inherit; font-size: calc(13.5px + var(--fs-up)); cursor: pointer; }
.ecChips button:hover { background: var(--line2); }
.ecChips button.on { background: var(--ink2); color: var(--bg); }
.ecBar { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.ecSep { width: 1px; height: 22px; background: var(--line2); }
.ecDrop { border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(13.5px + var(--fs-up)); padding: 5px 8px; border-radius: 6px; cursor: pointer; }
.ecDrop:hover { background: var(--pane2); }
.ecTable { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.ecFilterRow { display: grid; gap: 10px; min-width: 0; }
#calAll, #calPair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
#calAll { container-type: inline-size; }
#calAll[hidden], #calPair[hidden] { display: none; }
.ecRow { display: grid; grid-template-columns: 50px 26px 18px minmax(0, 1fr) 76px 64px; gap: 10px; align-items: center; }
.ecDayHead { display: grid; grid-template-columns: minmax(0, 1fr) 76px 64px; gap: 10px; align-items: center; position: sticky; top: -10px; z-index: 2; background: var(--pane2);
  border-left: 3px solid var(--ink2); padding: 10px 6px 10px 12px; margin-top: 8px; font-weight: 700; font-size: calc(13.5px + var(--fs-up)); color: var(--ink2); border-bottom: 1px solid var(--line2); }
.ecDayHead.today { border-bottom-color: var(--down); }
.ecDayHead span + span { text-align: right; font-weight: 500; font-size: calc(12.5px + var(--fs-up)); color: var(--muted); }
.ecRow { padding: 0 6px; min-height: 40px; border-bottom: 1px solid var(--line); font-size: calc(13px + var(--fs-up)); cursor: pointer; }
.ecRow.grp { border-top: 0; }
.ecTable .ecRow:has(+ .ecRow.grp) { border-bottom-color: transparent; background-image: linear-gradient(var(--line), var(--line)); background-size: calc(100% - 92px) 1px; background-position: right bottom; background-repeat: no-repeat; }
.ecTable .ecRow:has(+ .ecRow.grpc) { background-size: calc(100% - 128px) 1px; }
.ecRow:hover, .ecRow:focus-visible { background-color: var(--pane2); outline: none; }
.ecRow.past { color: var(--muted); }
.ecRow.past .ecAct b { color: var(--ink2); }
.ecTime { font-variant-numeric: tabular-nums; font-size: calc(13.5px + var(--fs-up)); }
.ecRow.next .ecTime { background: var(--down); color: var(--on-accent); border-radius: 5px; padding: 3px 0; text-align: center; font-weight: 600; }
.ecFlag { display: grid; place-items: center; }
.ecFlag i { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-style: normal; font-size: calc(30px + var(--fs-up)); line-height: 1; background: var(--line2); }
.ecBars { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.ecBars i { width: 3px; background: var(--line2); border-radius: 1px; }
.ecBars i:nth-child(1) { height: 5px; } .ecBars i:nth-child(2) { height: 9px; } .ecBars i:nth-child(3) { height: 13px; }
.ecBars.imp-low i:nth-child(1), .ecBars.imp-medium i:nth-child(-n+2) { background: var(--accent); }
.ecBars.imp-high i { background: var(--down); }
.ecTitle { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink2); }
.ecRow.past .ecTitle { color: var(--ink); }
.ecTitle.full { white-space: normal; overflow-wrap: anywhere; padding: 6px 0; }
.ecCcy { font-size: calc(11px + var(--fs-up)); color: var(--muted); font-weight: 600; margin-right: 2px; }
.ecAct, .ecPrior { text-align: right; font-variant-numeric: tabular-nums; }
.ecAct { grid-column: 5; } .ecPrior { grid-column: 6; }
.ecRow.next .ecAct { grid-column: 5 / span 2; text-align: left; }
.ecRow.next .ecPrior { display: none; }
.ecSoon { color: var(--down); font-weight: 600; white-space: nowrap; font-size: calc(13px + var(--fs-up)); }
.ecNow { position: relative; height: 0; border-top: 2px solid var(--down); margin: 0 0 -2px; z-index: 1; }
.ecNow span { position: absolute; right: 0; top: -9px; font-size: calc(10px + var(--fs-up)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--on-accent); background: var(--down); border-radius: 3px; padding: 1px 5px; }
.ecMore { padding: 8px 10px 10px 64px; font-size: calc(12.5px + var(--fs-up)); line-height: 1.5; border-bottom: 1px solid var(--line); background: var(--pane2); }
.ecEmpty { padding: 18px 6px; }
@media (max-width: 900px) {
  .ecRow { grid-template-columns: 44px 24px 16px minmax(0, 1fr) 60px 52px; gap: 6px; }
  .ecDayHead { grid-template-columns: minmax(0, 1fr) 60px 52px; gap: 6px; }
  .ecWeek { font-size: calc(16px + var(--fs-up)); }
}
/* a narrow panel (phones, the default side width): no Prior column (it is in the event's details), smaller chips */
@container (max-width: 440px) {
  .ecRow { grid-template-columns: 40px 22px 12px minmax(0, 1fr) 62px; gap: 6px; }
  .ecPrior, .ecDayHead span:last-child, .ecCcy { display: none; }
  .ecDayHead { grid-template-columns: minmax(0, 1fr) 62px; gap: 6px; }
  .ecRow.next { row-gap: 0; padding-top: 6px; padding-bottom: 6px; }
  .ecRow.next .ecAct { grid-column: 4 / span 2; grid-row: 2; text-align: left; }
  .ecTable .ecRow:has(+ .ecRow.grp) { background-size: calc(100% - 70px) 1px; }
  .ecTable .ecRow:has(+ .ecRow.grpc) { background-size: calc(100% - 98px) 1px; }
  .ecChips { gap: 6px; } .ecChips button { padding: 6px 12px; font-size: calc(12.5px + var(--fs-up)); }
  .ecWeek { font-size: calc(16px + var(--fs-up)); }
  .ecDays { grid-auto-columns: minmax(100px, 1fr); }
  .ecMore { padding-left: 12px; }
}

/* drawing settings dialog (Style, Text, Coordinates, Visibility) */
#popMenu { z-index: 45; }
.dialogBack.dsModal { background: rgba(0, 0, 0, 0.18); }
.dsModal #modal { width: min(440px, calc(100vw - 32px)); padding: 0; }
.dsBar { cursor: move; user-select: none; }
.dsTitle { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dsTitle b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsTitle input { font: inherit; font-weight: 700; background: var(--bg); border: 1px solid var(--accent); border-radius: 5px; padding: 3px 7px; width: 240px; max-width: 100%; }
.dsPen { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; flex: none; }
.dsPen:hover { color: var(--ink); background: var(--pane2); }
.dsPen svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.dsTabs { display: flex; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.dsTabs button { border: 0; background: transparent; color: var(--muted); padding: 10px 0 9px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.dsTabs button:hover { color: var(--ink); }
.dsTabs button.on { color: var(--ink2); border-bottom-color: var(--ink2); }
.dsBody { padding: 14px 16px 16px; min-height: 250px; max-height: 56vh; overflow-y: auto; align-content: start; gap: 12px; }
.dsRow { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 10px; color: var(--ink); font-size: calc(13px + var(--fs-up)); }
.dsCtl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.dsCtl select, .dsCtl input[type="number"], .dsCtl input[type="datetime-local"] { width: auto; flex: 1 1 90px; min-width: 0; }
.dsCtl input[type="datetime-local"] { flex-basis: 170px; }
.dsCtl select[data-k="fontSize"] { flex: 0 0 72px; }
.dsCtl .dsNum { flex: 0 1 72px; }
.dsCtl input[type="color"], .dsCustom input[type="color"] { width: 34px; height: 30px; padding: 2px; flex: none; cursor: pointer; }
.dsCtl input[type="range"] { flex: 1 1 100px; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.form .dsCheck { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: calc(13px + var(--fs-up)); cursor: pointer; }
.form .dsCheck input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.dsHead { margin: 6px 0 -4px; font-size: calc(11px + var(--fs-up)); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.dsLineWrap { position: relative; }
.dsLineBtn, .dsEnd, .dsTog { height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid var(--line2); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.dsLineBtn:hover, .dsEnd:hover, .dsTog:hover { background: var(--pane2); }
.dsEnd.on, .dsTog.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.dsEnd { font-size: calc(12px + var(--fs-up)); letter-spacing: -1px; }
.dsTog { width: 32px; justify-content: center; padding: 0; }
.dsSw { width: 20px; height: 20px; border-radius: 4px; display: block; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); }
.dsLn { width: 34px; height: 0; display: block; }
.dsPop { position: absolute; left: 0; top: calc(100% + 6px); z-index: 2; width: 236px; padding: 10px; display: grid; gap: 10px; background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.dsPal { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.dsC { aspect-ratio: 1; border: 2px solid transparent; border-radius: 4px; padding: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.dsC.on { border-color: var(--on-accent); }
.form .dsCustom { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.dsSeg { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; }
.dsSeg button { height: 28px; border: 1px solid var(--line2); border-radius: 5px; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0 8px; }
.dsSeg button.on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.dsSeg i { display: block; width: 100%; height: 0; }
.dsBody textarea { resize: vertical; min-height: 80px; font: inherit; }
.dsFoot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.dsFoot .dsGap { flex: 1; }
.dsFoot button { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line2); background: transparent; color: var(--ink); cursor: pointer; }
.dsFoot button:hover { background: var(--pane2); }
.dsFoot .primary { border-color: transparent; background: var(--ink2); color: var(--bg); font-weight: 600; }
.dsFoot .primary:hover { background: var(--on-accent); }
.dsTplSave { display: flex; gap: 6px; min-width: 0; }
.dsTplSave input { width: 140px; min-width: 0; background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; }
@media (max-width: 520px) {
  .dsRow { grid-template-columns: 1fr; gap: 6px; }
  .dsTplSave input { width: 100px; }
}
.dsCtl input:disabled { opacity: 0.4; cursor: not-allowed; }
.dsLevels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.dsLv { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dsLv input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--accent); }
.dsLv input[type="number"] { flex: 1; min-width: 0; width: auto; padding: 5px 7px; }
.dsLv input[type="color"] { width: 30px; height: 28px; padding: 2px; flex: none; cursor: pointer; }
.dsLv input[type="color"]:disabled { opacity: 0.35; cursor: not-allowed; }
.dsLvDel { width: 22px; height: 22px; flex: none; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; font-size: calc(15px + var(--fs-up)); line-height: 1; padding: 0; }
.dsLvDel:hover { color: var(--ink); background: var(--pane2); }
.dsSmall { height: 28px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font-size: calc(12px + var(--fs-up)); }
.dsSmall:hover:not(:disabled) { background: var(--pane2); }
.dsSmall:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 520px) { .dsLevels { grid-template-columns: 1fr; } }
.dsCtl select[data-f="width"] { flex: 0 0 66px; }
.dsCtl select[data-f="style"], .dsCtl select[data-f="plot"] { flex: 1 1 80px; }
.dsCtl select:disabled, .dsCtl input:disabled { opacity: 0.4; }

/* newer chart page on the server */
/* newer chart page on the server, plans (app.js upgradePrompt), no connection (app.js netState): cards in the
   "pop-up notices" docks near the end; here only their buttons */
.updateBar button { flex: none; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line2); background: transparent; color: var(--ink); cursor: pointer; }
.updateBar button.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.planBar a.primary, .planLocked a.planSee { flex: none; padding: 6px 12px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; }
.planLocked { padding: 18px 20px 22px; max-width: 520px; }
.planLocked p { margin: 0 0 12px; }
.planLocked a.planSee { display: inline-block; }

/* ── Home: layouts and tools (the usual new-tab page) ── */
button.brand { border: 0; padding: 0; cursor: pointer; font: inherit; }
.brand .mark { width: 58%; height: auto; color: var(--ink2); }
.markDot { fill: var(--accent); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
button.brand:hover { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.home { position: fixed; inset: 0; z-index: 35; overflow-y: auto; background: var(--bg-deep); color: var(--ink2); }
.homeIn { max-width: 1440px; margin: 0 auto; padding: 36px 48px 28px; display: grid; gap: 28px; }
.homeTop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.homeTop h1 { margin: 0; font-size: calc(32px + var(--fs-up)); font-weight: 700; letter-spacing: -0.01em; }
.homeGap { flex: 1; }
.homeSearch { display: flex; align-items: center; gap: 10px; width: min(520px, 100%); height: 48px; padding: 0 18px; border-radius: 24px; background: var(--raise2); color: var(--muted); }
.homeSearch:focus-within { outline: 2px solid var(--accent); }
.homeSearch svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; }
.homeSearch input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(15px + var(--fs-up)); outline: none; }
.homeRound { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 1px solid var(--line2); background: transparent; color: var(--ink2); font-size: calc(20px + var(--fs-up)); cursor: pointer; }
.homeRound:hover { background: var(--raise2); }
.homeCards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.homeCard { position: relative; display: grid; align-content: end; gap: 6px; min-height: 140px; padding: 18px 20px; border: 1px solid var(--line2); border-radius: 12px; background: transparent;
  color: var(--ink2); text-align: left; font: inherit; cursor: pointer; }
.homeCard:hover, .homeCard:focus-visible { border-color: var(--line3); background: var(--raise); outline: none; }
.homeCard.cur { border-color: var(--line3); }
.homeCard > b { font-size: calc(17px + var(--fs-up)); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 26px; }
.homeCard .fine { font-size: calc(13px + var(--fs-up)); color: var(--muted); }
.homeCard.new { border-style: dashed; place-items: center; align-content: center; grid-auto-flow: column; justify-content: center; gap: 10px; font-size: calc(17px + var(--fs-up)); }
.homeCard.new span { font-size: calc(22px + var(--fs-up)); font-weight: 300; }
.homeCard.pair { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.homeArrow { position: absolute; right: 18px; bottom: 18px; color: var(--accent-ink); font-size: calc(18px + var(--fs-up)); }
.homeStar { position: absolute; top: 14px; left: 14px; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: calc(18px + var(--fs-up)); cursor: pointer; }
.homeStar:hover { background: var(--raise2); color: var(--ink2); }
.homeStar.on { color: var(--warn); }
.homeStar.ghost { cursor: default; opacity: 0.35; display: grid; place-items: center; }
.homeMore { position: absolute; right: 10px; bottom: 14px; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--ink2); font-size: calc(20px + var(--fs-up)); cursor: pointer; }
.homeMore:hover { background: var(--raise2); }
.homeName { font: inherit; font-size: calc(16px + var(--fs-up)); background: var(--raise2); border: 1px solid var(--accent); border-radius: 6px; padding: 5px 9px; color: var(--ink2); width: calc(100% - 30px); }
.homeCard.confirm { cursor: default; border-color: color-mix(in srgb, var(--down) 60%, transparent); }
.homeBtns { display: flex; gap: 8px; margin-top: 4px; }
.homeBtns button { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line2); background: transparent; color: var(--ink2); cursor: pointer; font: inherit; }
.homeBtns .danger { background: var(--down); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.homeNone { grid-column: 1 / -1; }
.homeGlow { height: 90px; margin: 8px -48px -20px; background: radial-gradient(60% 120% at 25% 0%, rgba(0, 188, 212, 0.28), transparent 70%),
  radial-gradient(60% 120% at 80% 0%, rgba(156, 39, 176, 0.32), transparent 70%), linear-gradient(90deg, color-mix(in srgb, var(--accent) 20%, transparent), rgba(156, 39, 176, 0.2));
  border-top: 1px solid color-mix(in srgb, var(--accent-ink) 35%, transparent); -webkit-mask-image: linear-gradient(#000, transparent); mask-image: linear-gradient(#000, transparent); }
.homeTools { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px; padding: 0 0 8px; }
.homeTile { display: grid; grid-template-rows: auto auto; border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; background: var(--raise); color: var(--ink2); padding: 0; cursor: pointer; font: inherit; text-align: left; }
.homeTile:hover, .homeTile:focus-visible { border-color: var(--line3); outline: none; }
.homeTile:hover .homeIcon { transform: scale(1.06); }
.homeArt { position: relative; height: 150px; background: var(--raise2); color: var(--line3); display: grid; place-items: center; overflow: hidden; }
.homeArt > svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.homeIcon { position: relative; width: 86px; height: 86px; border-radius: 20px; background: var(--raise2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); display: grid; place-items: center; transition: transform 0.15s; }
.homeIcon svg { width: 42px; height: 42px; fill: none; stroke: var(--ink2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.homeLabel { padding: 18px 20px 20px; font-size: calc(17px + var(--fs-up)); }
.homeLabel span { color: var(--ink); }
.homeFoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: var(--muted); font-size: calc(13px + var(--fs-up)); }
.homeFoot label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.homeFoot input { accent-color: var(--accent); }
@media (max-width: 700px) {
  .homeIn { padding: 20px 16px; gap: 20px; }
  .homeTop h1 { font-size: calc(26px + var(--fs-up)); }
  .homeSearch { order: 3; width: 100%; height: 44px; }
  .homeRound { width: 44px; height: 44px; }
  .homeCards { grid-template-columns: 1fr; gap: 12px; }
  .homeCard { min-height: 112px; padding-top: 50px; }
  .homeCard.new { min-height: 80px; padding-top: 18px; }
  .homeGlow { margin: 0 -16px -10px; height: 60px; }
  .homeTools { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .homeArt { height: 100px; } .homeIcon { width: 60px; height: 60px; border-radius: 14px; } .homeIcon svg { width: 30px; height: 30px; }
  .homeLabel { padding: 12px; font-size: calc(14px + var(--fs-up)); }
}

/* ── tabs: charts, the Home page and tool pages, like a web browser (as in desktop chart apps) ── */
.tabStrip { grid-area: tabs; display: flex; align-items: stretch; gap: 1px; padding: 4px 6px 0; background: var(--bg-deep); border-bottom: 1px solid var(--line); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabStrip::-webkit-scrollbar { display: none; }
.tab { position: relative; display: flex; align-items: center; gap: 7px; flex: 0 1 260px; min-width: 120px; padding: 0 6px 0 12px; border-radius: 8px 8px 0 0; color: var(--muted); cursor: default;
  font-size: var(--tab-font); white-space: nowrap; user-select: none; }
.tab:hover { background: var(--raise); color: var(--ink); }
.tab.on { background: var(--bg); color: var(--ink2); }
.tab:not(.on) + .tab:not(.on)::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 1px; background: var(--line2); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab.dragging { opacity: 0.5; }
.tabIcon { display: grid; place-items: center; width: 18px; flex: none; }
.tabIcon svg { width: calc(var(--tab-font) + 3px); height: calc(var(--tab-font) + 3px); }
.tabIcon svg.tabX { width: calc(var(--tab-font) + 4px); height: auto; color: var(--ink2); }
.tabTitle { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; font-weight: 600; }
.tab .tabTitle { flex-shrink: 0; max-width: 60%; }
.tabSub { color: var(--muted); flex: none; }
.tabPx { flex: 0 1 auto; min-width: 0; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.tab.on, .tab:has(.tabPx) { flex-basis: 300px; }   /* chart tabs keep room for their price, shown or not */
.tabPx.up { color: var(--up); } .tabPx.down { color: var(--down); }
.tabClose { margin-left: auto; flex: none; width: 22px; height: 22px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: calc(16px + var(--fs-up)); line-height: 1; cursor: pointer; opacity: 0; }
.tab:hover .tabClose, .tab.on .tabClose, .tabClose:focus-visible { opacity: 1; }
.tabClose:hover { background: var(--pane2); color: var(--ink2); }
.tabNew { flex: none; width: 34px; height: calc(var(--tabs-h) - 10px); align-self: center; margin-left: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: calc(20px + var(--fs-up)); line-height: 1; cursor: pointer; }
.tabNew:hover { background: var(--raise); color: var(--ink2); }
.tabDrag { flex: 1; min-width: 20px; }
/* Home and tool pages sit under the tab strip */
.home { top: var(--tabs-h); }
.tabPage { position: fixed; inset: var(--tabs-h) 0 0 0; z-index: 34; background: var(--bg); overflow-y: auto; }
.tabPage > .panel { max-width: 1560px; margin: 0 auto; min-height: 100%; padding: 18px 24px 28px; }
.dialogBack.asPage { inset: var(--tabs-h) 0 0 0; z-index: 34; background: var(--bg); padding: 0; place-items: stretch; }
.dialogBack.asPage #modal { width: 100%; max-width: none; max-height: none; height: 100%; border: 0; border-radius: 0; box-shadow: none; overflow-y: auto; padding: 0 max(16px, calc((100% - 1560px) / 2)) 24px; }
.dialogBack.asPage #modal .mhead { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 16px 0 12px; font-size: calc(20px + var(--fs-up)); }
.dialogBack.asPage #modal .mhead .x { display: none; }
@media (max-width: 700px) {
  .tab { min-width: 92px; padding-left: 8px; gap: 5px; }
  .tabSub, .tabPx { display: none; }
  .tabPage > .panel { padding: 12px 12px 20px; }
}

/* the calendar opened as a tab: full page, like the usual */
.tabPage .calTabs { display: none; }
.tabPage .ecDayHead { top: 0; }
.ecPageHead { display: flex; align-items: center; justify-content: space-between; }
.ecPageHead h1 { margin: 0; font-size: calc(30px + var(--fs-up)); font-weight: 700; color: var(--ink2); }
.ecG10 { height: 34px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 7px; background: transparent; color: var(--ink); font: inherit; font-size: calc(13px + var(--fs-up)); font-weight: 700; cursor: pointer; }
.ecG10:hover { background: var(--pane2); }
.ecG10.on { border-color: var(--ink2); background: var(--ink2); color: var(--bg); }
.ecTz { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--ink2); font: inherit; font-size: calc(14px + var(--fs-up)); cursor: pointer; white-space: nowrap; }
.ecTz:hover { background: var(--pane2); }
.ecTz svg { width: 18px; height: 18px; }
.ecCountry { display: none; }
.ecSoonBtn { position: sticky; bottom: 18px; justify-self: center; z-index: 4; display: inline-flex; gap: 8px; align-items: center; padding: 9px 20px; border: 0; border-radius: 22px;
  background: var(--ink2); color: var(--bg); font: inherit; font-size: calc(14px + var(--fs-up)); font-weight: 600; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.ecSoonBtn[hidden] { display: none; }
@container (max-width: 440px) { .ecTz span, .ecG10 { display: none; } }
@container (min-width: 860px) {
  .ecFilterRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .ecHead { gap: 10px; }
  .ecWeek { font-size: calc(24px + var(--fs-up)); }
  .ecDays { grid-auto-columns: minmax(0, 1fr); overflow: visible; }
  .ecScroll { display: none; }
  .ecDay { min-height: 150px; padding: 16px 18px; gap: 6px; }
  .ecDay b { font-size: calc(18px + var(--fs-up)); margin-bottom: 8px; }
  .ecCnt { font-size: calc(13.5px + var(--fs-up)); }
  .ecChips button { padding: 9px 20px; font-size: calc(15px + var(--fs-up)); }
  .ecRow { grid-template-columns: 64px 200px 22px minmax(0, 1fr) 110px 110px; gap: 14px; min-height: 54px; padding: 0 14px 0 24px; font-size: calc(14.5px + var(--fs-up)); }
  .ecDayHead { grid-template-columns: minmax(0, 1fr) 110px 110px; gap: 14px; padding: 14px 14px 14px 24px; font-size: calc(15px + var(--fs-up)); }
  .ecDayHead span + span { font-size: calc(14px + var(--fs-up)); }
  .ecTime { font-size: calc(14.5px + var(--fs-up)); }
  .ecFlag { display: flex; align-items: center; gap: 10px; min-width: 0; justify-content: flex-start; }
  .ecFlag i { width: 26px; height: 26px; font-size: calc(36px + var(--fs-up)); flex: none; }
  .ecCountry { display: inline; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
  .ecRow.past .ecCountry { color: var(--ink); }
  .ecCcy { display: none; }
  .ecTitle { font-size: calc(14.5px + var(--fs-up)); }
  .ecAct b { font-size: calc(14.5px + var(--fs-up)); }
  .ecTable .ecRow:has(+ .ecRow.grp) { background-size: calc(100% - 102px) 1px; }
  .ecTable .ecRow:has(+ .ecRow.grpc) { background-size: calc(100% - 316px) 1px; }
  .ecMore { padding-left: 316px; }
}

/* ── News flow page (a tab): the feed on the left, the chosen release on the right ── */
.tabPage.nfMode { overflow: hidden; }
.newsPage { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); height: 100%; min-height: 0; }
.nfList { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; border-right: 1px solid var(--line2); }
/* News flow's Headlines: FXStreet's widget framed from news.xcalpai.com, across the whole page */
.nfList.nfHeadlines { grid-column: 1 / -1; grid-template-rows: auto minmax(0, 1fr) auto; border-right: 0; }
.nfFrame { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.nfTop { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 20px 8px; }
.nfTop .fine { display: block; font-size: calc(13px + var(--fs-up)); color: var(--ink); }
.nfFeed { border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(26px + var(--fs-up)); font-weight: 700; padding: 2px 0; cursor: pointer; }
.nfFeed span { font-size: calc(18px + var(--fs-up)); color: var(--muted); }
.nfFilters { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 20px 14px; border-bottom: 1px solid var(--line2); }
.nfChip { height: 36px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: calc(14px + var(--fs-up)); cursor: pointer; white-space: nowrap; }
.nfChip:hover { background: var(--pane2); }
.nfOn { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 6px 0 12px; border-radius: 8px; background: var(--ink2); color: var(--bg); font-size: calc(13.5px + var(--fs-up)); }
.nfOn button { border: 0; background: transparent; color: inherit; font-size: calc(16px + var(--fs-up)); cursor: pointer; width: 22px; height: 22px; border-radius: 5px; }
.nfScroll { overflow-y: auto; min-height: 0; }
.nfGroup { position: sticky; top: 0; z-index: 1; padding: 8px 20px; background: var(--bg); color: var(--muted); font-size: calc(11.5px + var(--fs-up)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line); }
.nfItem { position: relative; display: grid; gap: 6px; width: 100%; padding: 14px 20px 14px 28px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink2); font: inherit; text-align: left; cursor: pointer; }
.nfItem:hover { background: var(--raise); }
.nfItem.on { background: var(--pane2); }
.nfItem.unread::before { content: ""; position: absolute; left: 12px; top: 43px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.nfMeta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: calc(13px + var(--fs-up)); min-width: 0; }
.nfMeta .ecBars { margin-left: auto; }
.nfHead { font-size: calc(15.5px + var(--fs-up)); line-height: 1.4; }
.nfMove { font-size: calc(12.5px + var(--fs-up)); color: var(--muted); }
.nfMove.up { color: var(--up); } .nfMove.down { color: var(--down); }
.nfFlag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; font-style: normal; font-size: calc(27px + var(--fs-up)); line-height: 1; flex: none; background: var(--line2); }
.nfFlag.big { width: 34px; height: 34px; font-size: calc(46px + var(--fs-up)); }
.nfMore { display: block; margin: 10px 20px; padding: 8px 14px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.nfMore:hover { background: var(--pane2); }
.nfPad { padding: 14px 20px; }
.nfDetail { position: relative; overflow-y: auto; min-height: 0; padding: 28px 36px 36px; display: grid; align-content: start; gap: 18px; background: var(--bg-deep); }
.nfDetail.empty { place-items: center; align-content: center; }
.nfClose { position: absolute; top: 18px; right: 22px; }
.nfSrc { display: flex; align-items: center; gap: 10px; margin-top: 40px; font-size: calc(19px + var(--fs-up)); font-weight: 700; color: var(--ink2); }
.nfSrc span { font-weight: 400; color: var(--muted); font-size: calc(14px + var(--fs-up)); }
.nfDetail h2 { margin: 0; font-size: calc(27px + var(--fs-up)); line-height: 1.3; color: var(--ink2); }
.nfInfo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: calc(14px + var(--fs-up)); }
.nfInfo .homeRound { margin-left: auto; }
.homeRound.small { width: 40px; height: 40px; font-size: calc(18px + var(--fs-up)); }
.nfChips { display: flex; flex-wrap: wrap; gap: 8px; }
.nfTag { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 8px; border-radius: 20px; background: var(--pane2); color: var(--ink2); font-size: calc(15px + var(--fs-up)); }
.nfTag.up { color: var(--up); } .nfTag.down { color: var(--down); }
.nfFigs { width: 100%; border-collapse: collapse; font-size: calc(15px + var(--fs-up)); }
.nfFigs th { text-align: right; color: var(--muted); font-weight: 500; font-size: calc(13px + var(--fs-up)); padding: 6px 0; border-bottom: 1px solid var(--line2); }
.nfFigs th:first-child, .nfFigs td:first-child { text-align: left; }
.nfFigs td { text-align: right; padding: 10px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.nfText { margin: 0; font-size: calc(15.5px + var(--fs-up)); line-height: 1.55; color: var(--ink); }
.nfChartBox { display: grid; gap: 6px; }
.nfChartHead { font-size: calc(13px + var(--fs-up)); color: var(--muted); }
.nfChart { height: 260px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.nfActions .primary { padding: 10px 18px; border-radius: 8px; border: 0; background: var(--ink2); color: var(--bg); font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 900px) {
  .newsPage { grid-template-columns: 1fr; }
  .nfList.hasSel { display: none; }
  .nfDetail.empty { display: none; }
  .nfDetail { padding: 16px; }
  .nfSrc { margin-top: 44px; }
  .nfDetail h2 { font-size: calc(21px + var(--fs-up)); }
}

/* ── Yield curves page ── */
.ycTop { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ycChartWrap { position: relative; }
.ycLegend { position: absolute; left: 64px; top: 10px; z-index: 1; display: grid; gap: 6px; font-size: calc(13.5px + var(--fs-up)); color: var(--ink2); pointer-events: none; }
.ycLegend span { display: flex; align-items: center; gap: 8px; }
.ycLegend i { width: 10px; height: 10px; border-radius: 50%; }
.ycFold { pointer-events: auto; width: 28px; height: 22px; border: 1px solid var(--line2); border-radius: 5px; background: var(--bg); color: var(--ink); cursor: pointer; }
.ycPlot { display: block; width: 100%; }
.ycPlot .ycGrid { stroke: color-mix(in srgb, var(--line2) 45%, transparent); }
.ycPlot .ycVert { stroke: color-mix(in srgb, var(--line2) 60%, transparent); stroke-dasharray: 2 4; }
.ycPlot .ycAxis { fill: var(--muted); font-size: calc(12px + var(--fs-up)); stroke: none; }
.ycPlot .ycCross { stroke: var(--muted); stroke-dasharray: 4 4; }
.ycTip { position: absolute; top: 40px; z-index: 2; display: grid; gap: 4px; min-width: 220px; padding: 10px 12px; border-radius: 8px; background: var(--pane); border: 1px solid var(--line2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font-size: calc(13px + var(--fs-up)); pointer-events: none; }
.ycTip span { display: flex; align-items: center; gap: 8px; }
.ycTip span b { margin-left: auto; font-variant-numeric: tabular-nums; }
.ycTip i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ycCmpHead { display: flex; align-items: center; gap: 8px; margin: 18px 0 6px; padding-top: 14px; border-top: 1px solid var(--line2); }
.ycCmpHead h3, .ycH { margin: 0; font-size: calc(19px + var(--fs-up)); color: var(--ink2); }
.ycH { margin: 16px 0 8px; }
.ycTableWrap { overflow-x: auto; }
.ycTable { width: 100%; border-collapse: collapse; font-size: calc(14px + var(--fs-up)); white-space: nowrap; }
.ycTable th { padding: 10px 8px; color: var(--muted); font-weight: 500; text-align: right; border-bottom: 1px solid var(--line2); }
.ycTable th:nth-child(-n+3) { text-align: left; }
.ycTable td { padding: 0 8px; height: 50px; text-align: right; color: var(--on-accent); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--bg); }
.ycTable td:nth-child(-n+3) { text-align: left; color: var(--ink2); }
.ycTable tr.off td:not(:nth-child(-n+3)):not(.ycActs) { opacity: 0.45; }
.ycTable .ycNo { color: var(--muted); background: var(--pane); }
.ycCountry { display: inline-flex; align-items: center; gap: 10px; }
.ycCountry .nfFlag { width: 26px; height: 26px; font-size: calc(36px + var(--fs-up)); }
.ycCheck { position: relative; display: inline-grid; width: 22px; height: 22px; cursor: pointer; }
.ycCheck input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ycCheck span { width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--c); display: grid; place-items: center; }
.ycCheck input:checked + span { background: var(--c); }
.ycCheck input:checked + span::after { content: "✓"; color: var(--on-accent); font-size: calc(14px + var(--fs-up)); font-weight: 700; }
.ycCheck input:focus-visible + span { outline: 2px solid var(--ink2); outline-offset: 2px; }
.ycWhen { border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(14px + var(--fs-up)); padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.ycWhen:hover { background: var(--pane2); }
.ycActs { white-space: nowrap; }
.ycActs button { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.ycActs button:hover { background: var(--pane2); color: var(--ink2); }
.ycActs svg { width: 17px; height: 17px; }
.ycAdd { margin: 12px 0 4px; height: 42px; font-size: calc(15px + var(--fs-up)); }
.ycSpread { height: 340px; }
.ycBars { display: grid; gap: 8px; margin-bottom: 16px; }
.ycBarRow { display: grid; grid-template-columns: 220px minmax(0, 1fr) 70px; align-items: center; gap: 12px; font-size: calc(14px + var(--fs-up)); }
.ycBarRow b { text-align: right; font-variant-numeric: tabular-nums; }
.ycBar { height: 14px; border-radius: 7px; background: var(--pane2); overflow: hidden; }
.ycBar i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--accent), var(--up)); }
@media (max-width: 700px) { .ycLegend { left: 56px; font-size: calc(12px + var(--fs-up)); } .ycBarRow { grid-template-columns: 130px minmax(0, 1fr) 56px; } }

/* ── Options (calculated) ── */
.opTop { margin-bottom: 10px; }
.opBar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.opSides { display: inline-flex; gap: 2px; }
.opSides button { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: calc(14.5px + var(--fs-up)); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.opSides button.on { background: var(--pane2); color: var(--ink2); font-weight: 600; }
.opAssume { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line2); border-radius: 10px; font-size: calc(13.5px + var(--fs-up)); color: var(--ink); }
.opCalc { padding: 3px 9px; border-radius: 5px; background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); font-weight: 700; font-size: calc(12px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.04em; }
.opEdit { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: calc(13.5px + var(--fs-up)); padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.opEdit:hover { background: var(--pane2); }
.opType { width: 90px; background: var(--bg); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; color: var(--ink2); }
.opChain { overflow-x: auto; }
.opSideHead { display: grid; grid-template-columns: 1fr 120px 1fr; text-align: center; font-weight: 600; color: var(--ink2); padding: 4px 0 6px; }
.opTable { width: 100%; border-collapse: collapse; font-size: calc(14px + var(--fs-up)); white-space: nowrap; font-variant-numeric: tabular-nums; }
.opTable th { padding: 10px 10px; color: var(--muted); font-weight: 500; text-align: right; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: var(--bg); z-index: 1; }
.opTable td { padding: 0 10px; height: 46px; text-align: right; border-bottom: 1px solid var(--line); }
.opTable .opK { text-align: center; background: var(--raise); width: 120px; }
.opTable .opK span { display: inline-block; min-width: 86px; padding: 6px 10px; border: 1px solid var(--line2); border-radius: 7px; color: var(--ink2); }
.opTable td.itm { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.opTable td.itmP { background: color-mix(in srgb, var(--down) 10%, transparent); }
.opTheor { cursor: pointer; color: var(--ink2); font-weight: 600; }
.opTheor:hover { outline: 1px solid var(--accent); outline-offset: -4px; border-radius: 6px; }
.opExp td { padding: 0; height: auto; text-align: left; background: var(--raise); }
.opExp button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(15px + var(--fs-up)); font-weight: 600; cursor: pointer; text-align: left; }
.opCaret { width: 14px; color: var(--muted); }
.opDte { padding: 2px 7px; border-radius: 5px; background: color-mix(in srgb, var(--down) 18%, transparent); color: var(--down-ink); font-size: calc(12px + var(--fs-up)); font-weight: 700; }
.opTag { padding: 2px 7px; border-radius: 5px; background: var(--pane2); color: var(--ink); font-size: calc(12px + var(--fs-up)); font-weight: 600; }
.opExp .fine { margin-left: auto; font-weight: 400; }
.opSpot td { text-align: center; height: 40px; border-bottom: 0; }
.opSpot span { display: inline-block; padding: 5px 14px; border-radius: 16px; background: var(--pane2); color: var(--ink2); font-size: calc(13.5px + var(--fs-up)); }
.opEmpty { padding: 20px 0; display: grid; gap: 10px; }
.opEmpty h3 { margin: 0; font-size: calc(19px + var(--fs-up)); color: var(--ink2); }
.opLegs { display: grid; gap: 10px; }
.opLegTable { width: 100%; border-collapse: collapse; font-size: calc(14px + var(--fs-up)); }
.opLegTable th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line2); }
.opLegTable td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.opLegTable input, .opLegTable select { width: 120px; background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; color: var(--ink2); font: inherit; }
.opLegTable input[data-oplegq] { width: 70px; }
.opSide { border: 0; border-radius: 6px; padding: 6px 12px; font: inherit; font-weight: 700; cursor: pointer; }
.opSide.buy { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent-ink); }
.opSide.sell { background: color-mix(in srgb, var(--down) 20%, transparent); color: var(--down-ink); }
.opDel { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.opDel:hover { background: var(--pane2); color: var(--ink2); }
.opLegBtns { display: flex; gap: 8px; }
.opStats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.opStats > div { display: grid; gap: 3px; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 10px; }
.opStats span { color: var(--muted); font-size: calc(12.5px + var(--fs-up)); }
.opStats b { font-size: calc(18px + var(--fs-up)); color: var(--ink2); }
.opStats b.up { color: var(--up); } .opStats b.down { color: var(--down); }
.opStats small { color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.opPay { width: 100%; height: auto; display: block; margin-top: 8px; }
.opReal { padding: 3px 9px; border-radius: 5px; background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); font-weight: 700; font-size: calc(12px + var(--fs-up)); letter-spacing: 0.02em; }
.opNote { margin: -4px 0 12px; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--ink2); font-size: calc(13.5px + var(--fs-up)); }
.opTableReal td { padding: 0 8px; }
.opTableReal td small { display: block; margin-top: 1px; color: var(--muted); font-size: calc(11px + var(--fs-up)); font-weight: 400; }
.opSmileChips { flex-wrap: wrap; margin: 4px 0 6px; }
.opTableReal td.opThinQ { color: var(--muted); }
@media (max-width: 700px) { .opTableReal td { padding: 0 6px; } .opTableReal th { padding: 8px 6px; } .opTableReal { font-size: calc(13px + var(--fs-up)); } .opAssume { gap: 6px 10px; } .opLegs { overflow-x: auto; } .opLegTable select, .opLegTable input { width: 100px; } }

/* ── Markets page ── */
.mkLead { margin: 0 0 6px; color: var(--muted); font-size: calc(14px + var(--fs-up)); }
.mkSec { margin: 22px 0 10px; }
.mkSec h2 { margin: 0 0 16px; font-size: calc(30px + var(--fs-up)); font-weight: 700; color: var(--ink2); }
.mkMore { border: 0; background: transparent; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.mkMore span { color: var(--muted); }
.mkMore:hover span { color: var(--ink2); }
.mkStrip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.mkStrip::-webkit-scrollbar { display: none; }
.mkPill { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; min-width: 230px; padding: 12px 22px 12px 14px; border: 0; border-radius: 40px; background: transparent; color: var(--ink2); font: inherit; text-align: left; cursor: pointer; }
.mkPill:hover { background: var(--raise); }
.mkPill.on { background: var(--pane2); }
.mkTxt { display: grid; gap: 3px; min-width: 0; }
.mkTxt b { font-size: calc(16px + var(--fs-up)); font-weight: 500; }
.mkVal { font-size: calc(15px + var(--fs-up)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mkVal b { font-weight: 500; margin-right: 6px; }
.mkVal .up, .mkChartHead .up { color: var(--up); } .mkVal .down, .mkChartHead .down { color: var(--down); }
.mkIco { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 50%; font-weight: 800; font-size: calc(13px + var(--fs-up)); color: var(--on-accent); }
.mkIco.fred { background: #2a3550; color: #9fb7ff; }
.mkIco.gold { background: linear-gradient(135deg, #f7c948, #b8860b); }
.mkIco.silver { background: linear-gradient(135deg, #e0e3e8, #8a8f98); color: #222; }
.mkIco.flags2 { position: relative; }
.mkIco.flags2 i { position: absolute; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-style: normal; font-size: calc(40px + var(--fs-up)); line-height: 1; background: var(--line2); }
.mkIco.flags2 i:first-child { left: 0; top: 0; z-index: 1; box-shadow: 0 0 0 2px var(--bg); }
.mkIco.flags2 i:last-child { right: 0; bottom: 0; }
.mkChartBox { display: grid; gap: 10px; margin-top: 10px; }
.mkChartHead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 46px; font-size: calc(14.5px + var(--fs-up)); }
.mkChartHead .mkIco { width: 40px; height: 40px; }
.mkBig { font-size: calc(26px + var(--fs-up)); font-weight: 700; color: var(--ink2); font-variant-numeric: tabular-nums; }
.mkChart { height: 380px; }
.mkTools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mkRanges { display: inline-flex; gap: 4px; }
.mkRanges button, .mkTypes button { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: calc(15px + var(--fs-up)); padding: 8px 16px; border-radius: 8px; cursor: pointer; }
.mkRanges button:hover, .mkTypes button:hover { background: var(--raise); }
.mkRanges button.on, .mkTypes button.on { background: var(--pane2); color: var(--ink2); }
.mkTypes { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line2); border-radius: 10px; }
.mkTypes button { padding: 6px 10px; }
.mkCards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.mkCard { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 10px 12px; align-items: center; padding: 16px; border: 1px solid var(--line2); border-radius: 14px; background: transparent; color: var(--ink2); font: inherit; text-align: left; cursor: pointer; }
.mkCard:hover { border-color: var(--line3); background: var(--raise); }
.mkCard .mkTxt .fine { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkSpark { grid-column: 1 / -1; height: 36px; }
.mkSpark svg { width: 100%; height: 36px; display: block; }
.mkCard .mkVal { grid-column: 1 / -1; }
@media (max-width: 700px) { .mkSec h2 { font-size: calc(23px + var(--fs-up)); } .mkPill { min-width: 200px; } .mkChart { height: 280px; } .mkRanges button { padding: 7px 10px; } }

/* ── Macro maps ── */
.mmTop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.mmSep { width: 1px; height: 28px; background: var(--line2); }
.mmQ { width: 200px; height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line2); background: var(--pane); color: var(--ink2); font: inherit; }
.mmGrid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.mmMapBox { position: relative; }
.mmSvg { display: block; width: 100%; height: auto; cursor: grab; touch-action: none; }
.mmSvg:active { cursor: grabbing; }
.mmSvg path { stroke: var(--bg-deep); stroke-width: 0.35; vector-effect: non-scaling-stroke; transition: fill 0.2s; }
.mmSvg path.has:hover { stroke: var(--ink2); stroke-width: 1.2; }
.mmSvg path.sel { stroke: var(--on-accent); stroke-width: 1.6; }
.mmZoom { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; gap: 6px; }
.mmZoom button { width: 40px; height: 40px; border: 1px solid var(--line2); border-radius: 8px; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--ink2); font-size: calc(20px + var(--fs-up)); cursor: pointer; }
.mmZoom button:hover { background: var(--pane2); }
.mmTip { position: absolute; z-index: 2; display: grid; gap: 2px; padding: 8px 11px; border-radius: 8px; background: var(--pane); border: 1px solid var(--line2); font-size: calc(13px + var(--fs-up)); pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); white-space: nowrap; }
.mmLegend { display: flex; max-width: 640px; margin: 18px auto 6px; padding-top: 18px; }
.mmLegend span { position: relative; flex: 1; height: 8px; }
.mmLegend span:first-child { border-radius: 4px 0 0 4px; } .mmLegend span:last-child { border-radius: 0 4px 4px 0; }
.mmLegend b { position: absolute; left: 0; top: -20px; transform: translateX(-50%); font-size: calc(12.5px + var(--fs-up)); font-weight: 500; color: var(--ink); }
.mmTime { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; margin-top: 14px; }
.mmTime input { width: 100%; accent-color: var(--ink2); }
.mmNow { grid-column: 1 / -1; justify-self: center; font-size: calc(15px + var(--fs-up)); color: var(--ink2); }
.mmList { display: grid; gap: 0; }
.mmGroup { justify-self: start; border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(22px + var(--fs-up)); font-weight: 700; padding: 0 0 10px; cursor: pointer; }
.mmHead { display: flex; justify-content: space-between; padding: 6px 0 10px; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--line2); }
.mmRow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line2); background: transparent; color: var(--ink2); font: inherit; text-align: left; cursor: pointer; }
.mmRow:hover, .mmRow.on { background: var(--raise); }
.mmName { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.mmName b { font-size: calc(16px + var(--fs-up)); font-weight: 500; }
.mmCode { padding: 3px 8px; border-radius: 5px; background: var(--pane2); font-size: calc(12px + var(--fs-up)); font-weight: 700; color: var(--ink); }
.mmVal { display: grid; gap: 6px; justify-items: end; font-variant-numeric: tabular-nums; }
.mmVal b { font-size: calc(17px + var(--fs-up)); font-weight: 500; }
.mmVal span { font-size: calc(14px + var(--fs-up)); color: var(--ink); }
.mmSpark { display: grid; gap: 4px; padding: 8px 4px 12px; border-bottom: 1px solid var(--line2); }
.mmSpark svg { width: 100%; height: 70px; }
@media (max-width: 1000px) { .mmGrid { grid-template-columns: 1fr; } }

/* ── Technicals ── */
.tcHead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tcHead .flags { font-size: calc(20px + var(--fs-up)); }
.tcPair { border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(18px + var(--fs-up)); font-weight: 600; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.tcPair:hover { background: var(--pane2); }
.tcHead .fine { font-size: calc(16px + var(--fs-up)); }
.tcTfs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 26px; }
.tcTfs button { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: calc(15px + var(--fs-up)); padding: 9px 16px; border-radius: 8px; cursor: pointer; }
.tcTfs button:hover { background: var(--raise); }
.tcTfs button.on { background: var(--pane2); color: var(--ink2); font-weight: 600; }
.tcGauges { display: grid; grid-template-columns: 1fr 1.3fr 1fr; align-items: end; gap: 20px; }
.tcBlock { display: grid; justify-items: center; gap: 6px; }
.tcGauge { width: 230px; max-width: 100%; height: auto; }
.tcBlock.big .tcGauge { width: 320px; }
.tcTitle { font-size: calc(16px + var(--fs-up)); color: var(--ink2); font-weight: 500; }
.tcWord { font-size: calc(22px + var(--fs-up)); color: var(--ink2); }
.tcBlock.big .tcWord { font-size: calc(28px + var(--fs-up)); }
.tcWord.buy { color: #5b9cf6; } .tcWord.sell { color: var(--down-ink); }
.tcCounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; min-width: 260px; margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--pane2); text-align: center; font-size: calc(15px + var(--fs-up)); color: var(--ink); }
.tcCounts span { display: grid; gap: 4px; }
.tcCounts b { font-size: calc(20px + var(--fs-up)); color: var(--ink2); font-weight: 600; }
.tcAsOf { text-align: center; margin: 18px 0 8px; }
.tcTables { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 20px; }
.tcTable h3 { margin: 0 0 10px; font-size: calc(19px + var(--fs-up)); color: var(--ink2); }
.tcTable table { width: 100%; border-collapse: collapse; font-size: calc(14.5px + var(--fs-up)); }
.tcTable th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 0; border-bottom: 1px solid var(--line2); }
.tcTable th:nth-child(2), .tcTable td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; padding-right: 30px; }
.tcTable td { padding: 13px 0; border-bottom: 1px solid var(--line); color: var(--ink2); }
.tcAct { color: var(--muted); }
.tcAct.buy { color: #5b9cf6; } .tcAct.sell { color: var(--down-ink); }
@media (max-width: 900px) { .tcGauges { grid-template-columns: 1fr; } .tcTables { grid-template-columns: 1fr; } .tcCounts { min-width: 220px; } }

/* ── compare symbol ── */
.cmpTop { display: grid; gap: 10px; margin: 12px 16px 4px; }
.cmpTop input { width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 10px 12px; font-size: calc(14px + var(--fs-up)); color: var(--ink2); outline: none; }
.cmpTop input:focus { border-color: var(--accent); }
.cmpModes { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.cmpModes button { border: 1px solid var(--line2); background: transparent; color: var(--ink); font: inherit; font-size: calc(13px + var(--fs-up)); padding: 6px 12px; border-radius: 16px; cursor: pointer; }
.cmpModes button.on { background: var(--ink2); color: var(--bg); border-color: var(--ink2); }
.cmpList { max-height: 52vh; }
.cmpList .cmpH { margin: 10px 6px 4px; font-size: calc(11px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cmpList button { grid-template-columns: 110px 1fr auto !important; }
.cmpAct { color: var(--accent-ink); font-weight: 600; font-size: calc(13px + var(--fs-up)); }
.cmpList button.on .cmpAct { color: var(--down); }
.cmpRow .vals .up { color: var(--up); } .cmpRow .vals .down { color: var(--down); }
.obj .sw { vertical-align: middle; }

/* ── Seasonals ── */
.seBar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.seViews { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--pane2); }
.seViews button { border: 0; background: transparent; color: var(--ink); padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.seViews button.on { background: var(--line2); color: var(--ink2); }
.nfChip.on { border-color: var(--ink2); }
.nfChip svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.seRange { display: grid; gap: 6px; margin-bottom: 18px; }
.seTicks { display: flex; justify-content: space-between; color: var(--muted); font-size: calc(13px + var(--fs-up)); }
.seSlider { position: relative; height: 22px; }
.seSlider::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--line2) var(--a), var(--ink2) var(--a), var(--ink2) var(--b), var(--line2) var(--b)); }
.seSlider input { position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; }
.seSlider input::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.seSlider input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 3px solid var(--ink2); cursor: pointer; }
.seSlider input::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--ink2); cursor: pointer; }
.seSlider input::-moz-range-track { background: transparent; }
.seChartBox { position: relative; }
.seChart { height: min(62vh, 640px); min-height: 320px; }
.seQ { position: absolute; top: 0; bottom: 28px; width: 0; border-left: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); pointer-events: none; }
.seTip { position: absolute; top: 10px; z-index: 3; display: grid; gap: 3px; min-width: 170px; max-height: 80%; overflow: hidden; padding: 9px 11px; border-radius: 8px;
  background: var(--pane); border: 1px solid var(--line2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); font-size: calc(12.5px + var(--fs-up)); pointer-events: none; }
.seTip span { display: flex; align-items: center; gap: 7px; }
.seTip span b { margin-left: auto; font-variant-numeric: tabular-nums; }
.seTip i { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ── replay (the usual Bar Replay) ── */
.replayBar { bottom: 40px; gap: 4px; padding: 5px 8px; border-radius: 10px; flex-wrap: nowrap; }
.rpGroup { display: inline-flex; align-items: center; border-radius: 8px; background: var(--pane2); }
.rpBtn { height: 34px; min-width: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--ink2); font: inherit; font-size: calc(14px + var(--fs-up)); cursor: pointer; }
.rpBtn:hover:not(:disabled) { background: var(--pane2); }
.rpBtn:disabled { opacity: 0.35; cursor: default; }
.rpBtn svg { width: 18px; height: 18px; }
.rpBtn.rpPlay svg, .rpBtn svg path[d^="M6 4l10"] { fill: currentColor; }
.rpBtn.on { background: var(--accent-soft); color: var(--accent-ink); }
.rpSel { padding-right: 6px; }
.rpDrop { min-width: 24px; padding: 0 6px; color: var(--muted); }
.rpTxt { font-variant-numeric: tabular-nums; min-width: 44px; }
.rpSep { width: 1px; height: 22px; background: var(--line2); margin: 0 4px; }
.rpClock { padding: 0 8px; font-size: calc(13px + var(--fs-up)); color: var(--warn); white-space: nowrap; }
.rpDate { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.rpCut { position: absolute; top: 0; z-index: 4; pointer-events: none; }
.rpDim { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 62%, transparent); }
.rpLine { position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: var(--accent); }
.rpScissors { position: absolute; left: -10px; top: 32%; width: 20px; text-align: center; font-size: calc(17px + var(--fs-up)); color: var(--on-accent); transform: rotate(90deg); text-shadow: 0 0 4px #000; }
.rpLabel { position: absolute; left: 0; bottom: -26px; transform: translateX(-50%); padding: 3px 8px; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-size: calc(12px + var(--fs-up)); white-space: nowrap; }
.chart.selecting, .chart.selecting * { cursor: crosshair !important; }
@media (max-width: 700px) { .rpSel span, .rpClock { display: none; } .replayBar { gap: 2px; } }

/* ── layout picker (more charts per tab) ── */
.layoutPop { position: fixed; z-index: 45; width: min(600px, calc(100vw - 16px)); overflow-y: auto; padding: 8px 14px 12px; }
.lpRow { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 5px 0; border-bottom: 1px solid var(--line); }
.lpN { width: 26px; color: var(--muted); font-size: calc(13px + var(--fs-up)); text-align: left; flex: none; }
.lpOpt { width: 40px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; cursor: pointer; padding: 0; }
.lpOpt:hover { background: var(--pane2); }
.lpOpt.on { background: var(--ink2); }
.lpOpt svg, #layoutBtn svg { width: 24px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.3; }
.lpOpt.on svg rect { stroke: var(--bg); }
.lpOpt svg rect.m, #layoutBtn svg rect.m { fill: color-mix(in srgb, var(--accent-ink) 25%, transparent); }
.lpSync { padding-top: 10px; display: grid; gap: 4px; }
.lpSw { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-size: calc(14px + var(--fs-up)); color: var(--ink2); cursor: pointer; position: relative; }
.lpInfo { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--line2); color: var(--ink); font-size: calc(10px + var(--fs-up)); font-style: normal; font-weight: 700; margin-left: 4px; }
.lpSw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lpSw b { width: 40px; height: 22px; border-radius: 11px; background: var(--line2); position: relative; transition: background 0.15s; flex: none; }
.lpSw b::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.lpSw input:checked + b { background: var(--ink2); }
.lpSw input:checked + b::after { transform: translateX(18px); background: var(--bg); }
.lpSw input:focus-visible + b { outline: 2px solid var(--accent); outline-offset: 2px; }
.cells.dense .miniHead { padding: 2px 4px; font-size: calc(11px + var(--fs-up)); }
.cells.dense .miniHead .mv { display: none; }
.cells.many .miniHead select { font-size: calc(11px + var(--fs-up)); padding: 1px 2px; }
.layoutPop .lpSw { display: flex; grid-template-columns: none; gap: 12px; padding: 6px 0; border-radius: 0; }
.layoutPop .lpSw:hover { background: transparent; }
.layoutPop .lpSw > span { flex: 1; white-space: nowrap; display: flex; align-items: center; }

/* ── right bar: products menu (star = shown in the bar) ── */
.ibGap { flex: 1; min-height: 8px; }
.ibProducts { border-radius: 50%; }
.ibProducts svg { fill: currentColor; stroke: none; }
.iconbar { overflow-y: auto; scrollbar-width: none; }
.productsPop { position: fixed; z-index: 45; width: 290px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 8px; }
.productsPop .mhead2 { padding: 10px 10px 4px; }
/* the bar's own order (app.js dockMove): drag a button, press and hold first on touch, or Alt+↑ / Alt+↓ */
.iconbar { position: relative; }
.ib[data-dock] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.iconbar.ibSorting .ib[data-dock] { transition: transform 0.15s ease; }
.iconbar.ibSorting .ib.ibDragging { transition: none; z-index: 2; cursor: grabbing; background: var(--pane2); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.iconbar.ibSorting .ib.ibDragging.on { background: var(--accent-soft); }
.iconbar.ibSorting .ib:not(.ibDragging):hover { background: transparent; }
.iconbar.ibSorting .ib.on:not(.ibDragging):hover { background: var(--accent-soft); }
body.ibSortingBody { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.ibDrop { position: absolute; left: 50%; width: var(--btn); margin-left: calc(var(--btn) / -2); box-sizing: border-box; border: 1.5px dashed var(--accent); border-radius: 6px; background: var(--accent-soft); pointer-events: none; }
.ibLive { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.prFoot { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 10px 4px; border-top: 1px solid var(--line); }
.prFoot .fine { flex: 1; }
.prFoot button { flex: none; padding: 7px 12px; border-radius: 6px; border: 1px solid var(--line2); background: transparent; color: var(--ink2); font: inherit; font-size: calc(13px + var(--fs-up)); cursor: pointer; }
.prFoot button:hover:not([aria-disabled="true"]) { background: var(--pane2); }
.prFoot button[aria-disabled="true"] { opacity: 0.45; cursor: default; }
@media (prefers-reduced-motion: reduce) { .iconbar.ibSorting .ib[data-dock] { transition: none; } }
.prRow { display: flex; align-items: center; border-radius: 8px; }
.prRow:hover { background: var(--pane2); }
.prOpen { flex: 1; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: calc(14.5px + var(--fs-up)); text-align: left; cursor: pointer; }
.prOpen svg { width: 22px; height: 22px; flex: none; }
.prStar { width: 34px; height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: calc(18px + var(--fs-up)); cursor: pointer; }
.prStar:hover { color: var(--ink2); }
.prStar.on { color: var(--ink2); }

/* larger buttons need the room: as the window narrows, toolbar labels give way to their icons (other chart apps do the same) */
@media (max-width: 1640px) { html:not(.compact) :is(#alertBtn, #replayBtn) span { display: none; } }
@media (max-width: 1480px) { html:not(.compact) #overlaysBtn span { display: none; } }
@media (max-width: 1300px) { html:not(.compact) #indicatorsBtn span { display: none; } }
@media (max-width: 1640px) { html:not(.compact) :is(#alertBtn, #replayBtn) { width: var(--tb-h); padding: 0; justify-content: center; } }
@media (max-width: 1480px) { html:not(.compact) #overlaysBtn { width: var(--tb-h); padding: 0; justify-content: center; } }
@media (max-width: 1300px) { html:not(.compact) #indicatorsBtn { width: var(--tb-h); padding: 0; justify-content: center; } }
@media (max-width: 1640px) { html:not(.compact) #modeTag { display: none; } }
/* the bottom bar keeps its clock and scale buttons; the long source line gives way */
.bottombar > .fine { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.bottombar > #utcClock, .bottombar > .scaleBtns, .bottombar > .ranges { flex: none; }
.bottombar > #utcClock { font-size: calc(var(--tb-font) - 1px); }
.wl .hdr > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── alerts: dialog, panel (Alerts / Log), pop-ups, unread badge ── */
.alModal #modal { width: min(480px, calc(100vw - 32px)); }
.alBody { display: grid; }
.alBody input[type="text"], .alBody input[type="url"], .alBody textarea { width: 100%; }
.alSym { color: var(--ink2); margin-right: 4px; }
.alTrig { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.alTrig button { height: 32px; }
.alNote { border-left: 2px solid var(--accent); padding-left: 8px; }
.dsCheck.dsOff { color: var(--muted); }
.alErr { color: var(--warn); min-width: 0; }
.alTabs { display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); margin: -4px 0 4px; }
.alTabs button[data-altab] { border: 0; background: transparent; color: var(--muted); padding: 8px 0 7px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.alTabs button[data-altab].on { color: var(--ink2); border-bottom-color: var(--ink2); }
.alTabs button[data-altab] i { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 2px; }
.alGap { flex: 1; }
.alIco { border: 0; background: transparent; color: var(--muted); width: 30px; height: 28px; border-radius: 5px; cursor: pointer; font-size: calc(16px + var(--fs-up)); }
.alIco:hover { background: var(--pane2); color: var(--ink); }
.alList { display: grid; gap: 2px; }
.alRow { display: flex; align-items: stretch; border-radius: 6px; }
.alRow:hover { background: var(--pane); }
.alMain, .alLog { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 8px 6px; cursor: pointer; border-radius: 6px; }
.alLog:hover { background: var(--pane); }
.alTop { display: flex; align-items: center; gap: 6px; min-width: 0; }
.alTop b { color: var(--ink2); }
.alTime { margin-left: auto; white-space: nowrap; }
.alDesc, .alMsg { overflow: hidden; text-overflow: ellipsis; }
.alDesc { white-space: nowrap; }
.alMsg { color: var(--ink); overflow-wrap: anywhere; }
.alState { margin-left: auto; font-size: calc(11.5px + var(--fs-up)); font-weight: 600; padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.alRow.active .alState { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.alRow.triggered .alState { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.alRow.stopped .alState, .alRow.expired .alState { color: var(--muted); background: var(--pane2); }
.alRow:not(.active) .alDesc { color: var(--muted); }
.alBtns { display: flex; align-items: center; gap: 2px; padding-right: 4px; opacity: 0.55; }
.alRow:hover .alBtns, .alBtns:focus-within { opacity: 1; }
.alBtns button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); border-radius: 5px; cursor: pointer; font-size: calc(10px + var(--fs-up)); }
.alBtns button:hover { background: var(--pane2); }
.alBtns svg { width: 16px; height: 16px; }
.alLog.expired .alMsg { color: var(--muted); }
/* fired alerts (app.js alertFired): glass cards in the bottom dock ("pop-up notices" near the end); with a side panel
   open the dock sits over the chart's corner, not over the panel's buttons and message box */
.alPop { gap: 6px; }
.alPopHead { display: flex; align-items: center; gap: 8px; color: var(--warn); }
.alPopHead b { color: var(--ink2); flex: 1; min-width: 0; }
.alPopHead svg { width: 18px; height: 18px; }
.alPopName { font-weight: 600; color: var(--ink2); }
.alPopMsg { color: var(--ink); overflow-wrap: anywhere; }
.alPopTime { color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.alPopFoot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.alPopFoot button { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line2); background: transparent; color: var(--ink); cursor: pointer; }
.alPopFoot button.primary { border: 0; }
.ib { position: relative; }
.ib[data-badge]::after { content: attr(data-badge); position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--down); color: var(--on-accent); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.alWarn { color: var(--warn); }
.clockTag.offline { color: var(--down); border-color: color-mix(in srgb, var(--down) 50%, transparent); }

/* ── sign-in screen and account button (servers with XCALPAI_SIGNIN=required) ── */
.signIn { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, var(--pane2) 0%, var(--bg-deep) 70%); }
.siCard { width: min(400px, 100%); display: grid; gap: 14px; padding: 28px 28px 22px; background: var(--pane); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); }
.siLogo { display: flex; align-items: center; gap: 10px; font-size: calc(18px + var(--fs-up)); color: var(--ink2); }
.siLogo .brand { width: 34px; height: 34px; font-weight: 700; }
.siCard h2 { margin: 4px 0 -6px; font-size: calc(22px + var(--fs-up)); color: var(--ink2); }
.siSub { margin: 0; color: var(--muted); }
.siCard label { display: grid; gap: 6px; color: var(--ink); font-weight: 500; }
.siCard input { width: 100%; height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg); color: var(--ink2); font-size: calc(14px + var(--fs-up)); }
.siCard input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.siCard #siStep1, .siCard #siStep2 { display: grid; gap: 12px; }
.siCard [hidden] { display: none !important; }
.siPw { position: relative; display: block; }
.siPw input { padding-right: 64px; }
.siShow { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent-ink); cursor: pointer; font-weight: 600; padding: 6px 8px; }
.siErr { margin: -4px 0 0; min-height: 1.2em; color: var(--down); }
.siGo { height: 44px; font-size: calc(15px + var(--fs-up)); }
.siLinks { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.siLinks a { color: var(--accent-ink); text-decoration: none; }
.siLinks a:hover { text-decoration: underline; }
.siFine { margin: 0; color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.accountBtn { flex: none; align-self: center; width: 30px; height: 30px; margin: 0 4px 0 auto; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: calc(12px + var(--fs-up)); cursor: pointer; }
.accountBtn:hover { filter: brightness(1.15); }

/* past chart patterns (patterns.js): the panel's library link, and the Pattern library page */
.phLib { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--pane); color: var(--ink); cursor: pointer; text-align: left; }
.phLib:hover { border-color: var(--pattern); }
.phLib svg { color: var(--pattern); }
.patSketch { width: 100%; height: auto; display: block; }
.patSketch .psPath { fill: none; stroke: var(--ink2); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.patSketch .psLine { fill: none; stroke: var(--pattern); stroke-width: 1.6; }
.patSketch .psLine.dash { stroke-dasharray: 4 3; }
.patSketch .psPole { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 3; }
.patSketch .psEnd.up { fill: var(--up); } .patSketch .psEnd.down { fill: var(--down); }
.plBody { display: grid; gap: 16px; padding-bottom: 12px; }
.plHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plHead p { margin: 0; max-width: 820px; color: var(--ink); }
.plNote { margin: 0; max-width: 820px; color: var(--muted); }
.plTfs { display: flex; gap: 2px; background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; padding: 3px; flex: none; }
.plTfs button { border: 0; background: transparent; color: var(--ink); padding: 5px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.plTfs button.on { background: var(--accent-soft); color: var(--accent-ink); }
.plGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.plCard { display: grid; gap: 6px; align-content: start; text-align: left; padding: 14px; border: 1px solid var(--line2); border-radius: 10px; background: var(--pane); color: var(--ink); cursor: pointer; }
.plCard:hover, .plCard:focus-visible { border-color: var(--pattern); outline: none; }
.plCard .patSketch { background: var(--bg); border-radius: 6px; padding: 6px; margin-bottom: 4px; }
.plCard b { color: var(--ink2); font-size: calc(14px + var(--fs-up)); }
.plCard small { color: var(--muted); }
.plBars { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center; margin-top: 4px; }
.plBars span { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.plBars i { display: block; height: 100%; }
.plBars i.t { background: var(--pattern); } .plBars i.r { background: var(--muted2); }
.plBars em { font-style: normal; font-size: calc(11.5px + var(--fs-up)); color: var(--muted); font-family: var(--mono); }
.plBack { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.plDetail { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.plAbout { display: grid; gap: 10px; }
.plAbout .patSketch { background: var(--pane); border: 1px solid var(--line2); border-radius: 10px; padding: 10px; }
.plAbout h2 { margin: 4px 0 0; font-size: calc(20px + var(--fs-up)); color: var(--ink2); }
.plAbout dl { margin: 0; display: grid; gap: 4px; }
.plAbout dt { font-size: calc(11px + var(--fs-up)); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 6px; }
.plAbout dd { margin: 0; color: var(--ink); }
.plStats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plStats div { background: var(--pane); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; }
.plStats b { font: 600 calc(20px + var(--fs-up)) var(--mono); color: var(--ink2); }
.plStats small { color: var(--muted); }
.plVerdict { margin: 0; padding: 10px 12px; border-left: 3px solid var(--pattern); background: var(--pane); color: var(--ink2); }
.plExamples { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; min-width: 0; }
.plViewer { display: grid; gap: 8px; min-width: 0; }
.plChart { height: min(520px, 60vh); border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.plCaption { color: var(--muted); }
.plCaption b { color: var(--ink2); }
.plList { display: grid; gap: 4px; align-content: start; max-height: min(600px, 66vh); overflow-y: auto; }
.plList button { display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; align-items: center; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: var(--pane); color: var(--ink); cursor: pointer; text-align: left; }
.plList button.on { border-color: var(--pattern); }
.plList button small { grid-column: 2; color: var(--muted); }
.plList .res { grid-row: span 2; font-weight: 700; text-align: center; }
.plList .res.ok { color: var(--up); } .plList .res.bad { color: var(--down); } .plList .res.none { color: var(--muted); }
@media (max-width: 1100px) { .plDetail, .plExamples { grid-template-columns: minmax(0, 1fr); } }
.plNav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plNav select { background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; color: var(--ink); max-width: 260px; }
.plStep { display: flex; align-items: center; gap: 4px; }
.plStep button { width: 36px; height: 32px; border: 1px solid var(--line2); border-radius: 8px; background: var(--pane); color: var(--ink2); font: 600 calc(16px + var(--fs-up))/1 var(--sans); cursor: pointer; }
.plStep button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.plStep button:disabled { opacity: .35; cursor: default; }
.plPos { min-width: 92px; text-align: center; font: 500 calc(12.5px + var(--fs-up)) var(--mono); color: var(--muted); }
.plOut { display: flex; gap: 2px; background: var(--pane); border: 1px solid var(--line2); border-radius: 8px; padding: 2px; margin-left: auto; }
.plOut button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.plOut button.on { background: var(--accent-soft); color: var(--accent-ink); }

/* watchlist (watchlist.js): your lists, sections, live prices, details below */
#panel-watchlist { padding: 0; gap: 0; overflow: hidden; display: flex; flex-direction: column; }
.wlWrap { display: grid; grid-template-rows: auto auto minmax(80px, 1fr) 6px minmax(0, var(--wl-details, 300px)); height: 100%; min-height: 0; }
.wlTop { display: flex; align-items: center; gap: 2px; padding: 8px 8px 6px 10px; }
.wlName { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink2); font: 600 calc(15px + var(--fs-up)) var(--sans); padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.wlName:hover, .wlBtn:hover { background: var(--pane2); }
.wlName span { color: var(--muted); font-size: 12px; }
.wlBtn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.wlHead, .wlRow { display: grid; grid-template-columns: 10px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.75fr) 0; align-items: center; column-gap: 6px; }
.wlHead.t, .wlHead.t ~ .wlRows .wlRow { grid-template-columns: 10px minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.75fr) minmax(0, 0.7fr) 0; }
.wlHead { padding: 0 10px 4px 0; border-bottom: 1px solid var(--line); }
.wlHead button { grid-column: auto; border: 0; background: transparent; color: var(--muted); font-size: calc(12px + var(--fs-up)); text-align: left; padding: 4px 0; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wlHead button:first-child { grid-column: 2; }
.wlHead button.r { text-align: right; }
.wlHead button.on { color: var(--accent-ink); }
.wlRows { overflow-y: auto; min-height: 0; outline: none; padding-bottom: 4px; }
.wlRows:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.wlRow { position: relative; height: 34px; padding-right: 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); cursor: pointer; font-size: calc(13px + var(--fs-up)); }
.wlRow:hover { background: var(--raise2); }
.wlRow.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.wlRow .r { text-align: right; white-space: nowrap; overflow: hidden; }
.wlRow .mono { font-variant-numeric: tabular-nums; }
.wlRow .flash.fu { background: color-mix(in srgb, var(--up) 30%, transparent); border-radius: 3px; }
.wlRow .flash.fd { background: color-mix(in srgb, var(--down) 30%, transparent); border-radius: 3px; }
.wlFlag { align-self: stretch; width: 10px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.wlFlag[style*="--fc"] { background: var(--fc); clip-path: polygon(0 18%, 100% 18%, 60% 50%, 100% 82%, 0 82%); }
.wlRow:hover .wlFlag:not([style*="--fc"]) { background: var(--line2); clip-path: polygon(0 18%, 100% 18%, 60% 50%, 100% 82%, 0 82%); }
.wlSym { display: flex; align-items: center; gap: 7px; min-width: 0; }
.wlSym b { font-weight: 600; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wlDot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }
.wlX { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--pane2); color: var(--muted); cursor: pointer; display: none; line-height: 1; }
.wlRow:hover .wlX { display: block; }
.wlX:hover { color: var(--down); }
.wlSec { display: flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px 0 6px; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); letter-spacing: .06em; font-weight: 600; text-transform: uppercase; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.wlSec small { margin-left: 4px; color: var(--muted2); }
.wlFold { width: 22px; height: 22px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; border-radius: 4px; }
.wlFold svg { width: 14px; height: 14px; transition: transform .15s; }
.wlSec.folded .wlFold svg { transform: rotate(-90deg); }
.wlRow.dragging, .wlSec.dragging { opacity: .4; }
.dropAbove { box-shadow: inset 0 2px 0 var(--accent); } .dropBelow { box-shadow: inset 0 -2px 0 var(--accent); }
.wlEmpty { display: grid; justify-items: center; gap: 8px; padding: 30px 16px; color: var(--muted); }
.wlEmpty .primary { padding: 7px 14px; }
.wlGrip { cursor: row-resize; background: var(--line); height: 1px; margin: 3px 0 2px; position: relative; }
.wlGrip::after { content: ""; position: absolute; inset: -4px 0; }
.wlGrip:hover { background: var(--accent); }
.wlWrap .pairDetails { overflow-y: auto; border-top: 0; margin-top: 0; padding: 10px 12px 14px; min-height: 0; }
/* symbol icons & badges (watchlist.js) */
.symIco { display: inline-flex; align-items: center; flex: none; }
.symIco i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; line-height: 1; overflow: hidden; background: var(--pane2); }
.symIco i + i { margin-left: -6px; box-shadow: 0 0 0 1.5px var(--bg); }
.symIco i.logo { background: none; box-shadow: 0 0 0 1px rgba(127, 127, 127, .22); }   /* company logos: a hairline, so dark discs keep an edge */
.symIco.metal { width: 22px; height: 22px; border-radius: 50%; justify-content: center; font: 700 9.5px var(--sans); color: #fff; background: linear-gradient(135deg, #3d5a80, #293241); }
.symIco.f { width: 22px; height: 22px; border-radius: 50%; justify-content: center; background: var(--pane2); color: var(--accent-ink); font: 600 13px var(--sans); }
.symIco.stk { background: linear-gradient(135deg, #5d6b85, #2b3345); color: #fff; font-size: 7px; letter-spacing: -.2px; }
.symIco.coin { background: linear-gradient(135deg, #3fc3a4, #1f7d6b); color: #fff; font-size: 7px; letter-spacing: -.2px; }

/* metals, energy, commodities & softs */
.symIco.gold { background: linear-gradient(135deg, #f7d774, #b8860b); color: #1b1404; }
.symIco.silver { background: linear-gradient(135deg, #eef1f3, #8a9198); color: #1b1404; }
.symIco.pd { background: linear-gradient(135deg, #e6e2dc, #7d776f); color: #1b1404; }
.symIco.pt { background: linear-gradient(135deg, #e0eafc, #8697a2); color: #1b1404; font-size: 7.5px; }
.symIco.copper { background: linear-gradient(135deg, #e58e65, #9c411c); color: #fff; font-size: 7.5px; }
.symIco.alum { background: linear-gradient(135deg, #bdc3c7, #4b6584); color: #fff; font-size: 7.5px; }
.symIco.dbb { background: linear-gradient(135deg, #4b6cb7, #182848); color: #fff; font-size: 6.5px; }
.symIco.oil { background: linear-gradient(135deg, #5a5f6b, #16181d); color: #f0f2f5; font-size: 7.5px; }
.symIco.gas { background: linear-gradient(135deg, #8ec5ff, #2f6fd1); color: #fff; font-size: 7.5px; }
.symIco.coffee { background: linear-gradient(135deg, #8d5b4c, #4a2c22); color: #fff; font-size: 7.5px; }
.symIco.sugar { background: linear-gradient(135deg, #70e1b5, #208e62); color: #1b1404; font-size: 7.5px; }
.symIco.cocoa { background: linear-gradient(135deg, #795548, #3e2723); color: #fff; font-size: 7.5px; }
.symIco.wheat { background: linear-gradient(135deg, #f6d365, #c87a28); color: #1b1404; font-size: 7px; }
.symIco.corn { background: linear-gradient(135deg, #f9d423, #d35400); color: #1b1404; font-size: 7.5px; }
.symIco.soy { background: linear-gradient(135deg, #88d49e, #2e7d32); color: #fff; font-size: 7.5px; }

/* 100 cryptocurrencies */
.symIco.btc { background: linear-gradient(135deg, #ffb547, #e8820c); color: #fff; font-size: 12px; }
.symIco.eth { background: linear-gradient(135deg, #a3a9ff, #5b62c9); color: #fff; font-size: 12px; }
.symIco.sol { background: linear-gradient(135deg, #9b6bff, #17c9a4); color: #fff; font-size: 7.5px; }
.symIco.xrp { background: linear-gradient(135deg, #5a6170, #23272f); color: #fff; font-size: 7.5px; }
.symIco.bnb { background: linear-gradient(135deg, #f8d12f, #d39e00); color: #1b1404; font-size: 7.5px; }
.symIco.doge { background: linear-gradient(135deg, #e1c25b, #b9962c); color: #1b1404; font-size: 12px; }
.symIco.ada { background: linear-gradient(135deg, #3d7bff, #1a3fa8); color: #fff; font-size: 7.5px; }
.symIco.trx { background: linear-gradient(135deg, #ff4b4b, #b11a1a); color: #fff; font-size: 7.5px; }
.symIco.link { background: linear-gradient(135deg, #4a7dff, #2547b5); color: #fff; font-size: 6.5px; }
.symIco.avax { background: linear-gradient(135deg, #f0555b, #b3262b); color: #fff; font-size: 6.5px; }
.symIco.ltc { background: linear-gradient(135deg, #b8c0cc, #6d7685); color: #fff; font-size: 12px; }
.symIco.dot { background: linear-gradient(135deg, #f0398f, #a8145c); color: #fff; font-size: 7.5px; }
.symIco.sui { background: linear-gradient(135deg, #4da2ff, #2970ff); color: #fff; font-size: 7.5px; }
.symIco.pepe { background: linear-gradient(135deg, #56a23b, #2e691a); color: #fff; font-size: 6.5px; }
.symIco.near { background: linear-gradient(135deg, #00ec97, #008751); color: #1b1404; font-size: 6.5px; }
.symIco.shib { background: linear-gradient(135deg, #f05a28, #c43809); color: #fff; font-size: 6.5px; }
.symIco.wif { background: linear-gradient(135deg, #e07a93, #ab3c59); color: #fff; font-size: 7.5px; }
.symIco.apt { background: linear-gradient(135deg, #24d1a5, #128265); color: #fff; font-size: 7.5px; }
.symIco.op { background: linear-gradient(135deg, #ff0420, #b80014); color: #fff; font-size: 8.5px; }
.symIco.arb { background: linear-gradient(135deg, #28a0f0, #1260a3); color: #fff; font-size: 7.5px; }
.symIco.inj { background: linear-gradient(135deg, #00f2fe, #4facfe); color: #1b1404; font-size: 7.5px; }
.symIco.rndr { background: linear-gradient(135deg, #e53935, #9b111e); color: #fff; font-size: 6.5px; }
.symIco.tia { background: linear-gradient(135deg, #7b2bf9, #bf26f7); color: #fff; font-size: 7.5px; }
.symIco.fet { background: linear-gradient(135deg, #3d52d5, #0c1538); color: #fff; font-size: 7.5px; }
.symIco.tao { background: linear-gradient(135deg, #2de2e6, #0984e3); color: #1b1404; font-size: 7.5px; }
.symIco.bch { background: linear-gradient(135deg, #0ac18e, #057d5b); color: #fff; font-size: 7.5px; }
.symIco.pol { background: linear-gradient(135deg, #8247e5, #5522b0); color: #fff; font-size: 7.5px; }
.symIco.atom { background: linear-gradient(135deg, #464b6e, #181926); color: #fff; font-size: 6.5px; }
.symIco.xlm { background: linear-gradient(135deg, #14b6f7, #087099); color: #fff; font-size: 7.5px; }
.symIco.icp { background: linear-gradient(135deg, #ed1e79, #29abe2); color: #fff; font-size: 7.5px; }
.symIco.uni { background: linear-gradient(135deg, #ff007a, #b30056); color: #fff; font-size: 7.5px; }
.symIco.fil { background: linear-gradient(135deg, #0090ff, #005699); color: #fff; font-size: 7.5px; }
.symIco.etc { background: linear-gradient(135deg, #3ab83a, #1f6b1f); color: #fff; font-size: 7.5px; }
.symIco.aave { background: linear-gradient(135deg, #b6509e, #2ebac6); color: #fff; font-size: 6.5px; }
.symIco.algo { background: linear-gradient(135deg, #485460, #1e272e); color: #fff; font-size: 6.5px; }
.symIco.sei { background: linear-gradient(135deg, #9e1f36, #5c0f1e); color: #fff; font-size: 7.5px; }
.symIco.bonk { background: linear-gradient(135deg, #f18a28, #b85b04); color: #fff; font-size: 6.5px; }
.symIco.floki { background: linear-gradient(135deg, #e9b62f, #9b7410); color: #1b1404; font-size: 6.5px; }
.symIco.hbar { background: linear-gradient(135deg, #4b5563, #1f2937); color: #fff; font-size: 6.5px; }
.symIco.stx { background: linear-gradient(135deg, #5546ff, #291cb8); color: #fff; font-size: 7.5px; }
.symIco.grt { background: linear-gradient(135deg, #6742f1, #3c1da8); color: #fff; font-size: 7.5px; }
.symIco.rune { background: linear-gradient(135deg, #33ff99, #00cc7a); color: #1b1404; font-size: 6.5px; }
.symIco.wld { background: linear-gradient(135deg, #404040, #0a0a0a); color: #fff; font-size: 7.5px; }
.symIco.jup { background: linear-gradient(135deg, #f76808, #60c527); color: #fff; font-size: 7.5px; }
.symIco.pyth { background: linear-gradient(135deg, #6932d9, #36147a); color: #fff; font-size: 6.5px; }
.symIco.imx { background: linear-gradient(135deg, #00b8ff, #006699); color: #fff; font-size: 7.5px; }
.symIco.ena { background: linear-gradient(135deg, #d8e2dc, #8d99ae); color: #1b1404; font-size: 7.5px; }
.symIco.ondo { background: linear-gradient(135deg, #1e3a8a, #0b192c); color: #fff; font-size: 6.5px; }
.symIco.ldo { background: linear-gradient(135deg, #f97970, #00a3ff); color: #fff; font-size: 7.5px; }
.symIco.gala { background: linear-gradient(135deg, #1e293b, #0f172a); color: #fff; font-size: 6.5px; }
.symIco.pendle { background: linear-gradient(135deg, #1fd1a5, #0a7359); color: #fff; font-size: 6.5px; }
.symIco.crv { background: linear-gradient(135deg, #3861fb, #f93822); color: #fff; font-size: 7.5px; }
.symIco.snx { background: linear-gradient(135deg, #00d1ff, #087099); color: #fff; font-size: 7.5px; }
.symIco.comp { background: linear-gradient(135deg, #00d395, #007d57); color: #fff; font-size: 6.5px; }
.symIco.inch { background: linear-gradient(135deg, #e53e3e, #2b6cb0); color: #fff; font-size: 6px; letter-spacing: -0.3px; }
.symIco.kava { background: linear-gradient(135deg, #ff564f, #ba2a24); color: #fff; font-size: 6.5px; }
.symIco.flow { background: linear-gradient(135deg, #00ef8b, #008f53); color: #1b1404; font-size: 6.5px; }
.symIco.mina { background: linear-gradient(135deg, #ff603b, #b83214); color: #fff; font-size: 6.5px; }
.symIco.egld { background: linear-gradient(135deg, #1b46c2, #0b1e59); color: #fff; font-size: 6.5px; }
.symIco.qnt { background: linear-gradient(135deg, #374151, #111827); color: #fff; font-size: 7.5px; }
.symIco.rose { background: linear-gradient(135deg, #0092f6, #0500e2); color: #fff; font-size: 6.5px; }
.symIco.arkm { background: linear-gradient(135deg, #9a031e, #4a000d); color: #fff; font-size: 6.5px; }
.symIco.ai { background: linear-gradient(135deg, #8a2be2, #4b0082); color: #fff; font-size: 8.5px; }
.symIco.bome { background: linear-gradient(135deg, #76b852, #497a2e); color: #fff; font-size: 6.5px; }
.symIco.turbo { background: linear-gradient(135deg, #f39c12, #d35400); color: #fff; font-size: 6.5px; }
.symIco.neiro { background: linear-gradient(135deg, #e09f3e, #9e5b0d); color: #fff; font-size: 6.5px; }
.symIco.sand { background: linear-gradient(135deg, #0084ff, #004ecc); color: #fff; font-size: 6.5px; }
.symIco.mana { background: linear-gradient(135deg, #ff2d55, #ffbc00); color: #fff; font-size: 6.5px; }
.symIco.axs { background: linear-gradient(135deg, #0055ff, #002b80); color: #fff; font-size: 7.5px; }
.symIco.ray { background: linear-gradient(135deg, #3a41e8, #22d3ee); color: #fff; font-size: 7.5px; }
.symIco.cake { background: linear-gradient(135deg, #d1884f, #824b22); color: #fff; font-size: 6.5px; }
.symIco.dydx { background: linear-gradient(135deg, #6c5ce7, #232334); color: #fff; font-size: 6.5px; }
.symIco.gmx { background: linear-gradient(135deg, #2d42fc, #101968); color: #fff; font-size: 7.5px; }
.symIco.cfx { background: linear-gradient(135deg, #1e3c72, #2a5298); color: #fff; font-size: 7.5px; }
.symIco.super { background: linear-gradient(135deg, #e63946, #8d0801); color: #fff; font-size: 6.5px; }
.symIco.celo { background: linear-gradient(135deg, #fbcc5c, #35d07f); color: #1b1404; font-size: 6.5px; }
.symIco.lpt { background: linear-gradient(135deg, #00a55f, #005c35); color: #fff; font-size: 7.5px; }
.symIco.bat { background: linear-gradient(135deg, #ff5000, #993000); color: #fff; font-size: 7.5px; }
.symIco.ankr { background: linear-gradient(135deg, #215ffd, #0b3499); color: #fff; font-size: 6.5px; }
.symIco.zec { background: linear-gradient(135deg, #f4b728, #966b04); color: #1b1404; font-size: 7.5px; }
.symIco.dash { background: linear-gradient(135deg, #008de4, #004b7d); color: #fff; font-size: 6.5px; }
.symIco.mask { background: linear-gradient(135deg, #1c68f3, #093994); color: #fff; font-size: 6.5px; }
.symIco.metis { background: linear-gradient(135deg, #00d2ff, #0077b6); color: #fff; font-size: 6.5px; }
.symIco.cyber { background: linear-gradient(135deg, #2ecc71, #27ae60); color: #1b1404; font-size: 6.5px; }
.symIco.id { background: linear-gradient(135deg, #18d893, #09754e); color: #fff; font-size: 8.5px; }
.symIco.magic { background: linear-gradient(135deg, #8338ec, #3a0ca3); color: #fff; font-size: 6.5px; }
.symIco.portal { background: linear-gradient(135deg, #4361ee, #1e2d78); color: #fff; font-size: 6.5px; }
.symIco.pixel { background: linear-gradient(135deg, #2dc653, #155d27); color: #fff; font-size: 6.5px; }
.symIco.alt { background: linear-gradient(135deg, #374151, #111827); color: #fff; font-size: 7.5px; }
.symIco.manta { background: linear-gradient(135deg, #06b6d4, #0e7490); color: #fff; font-size: 6.5px; }
.symIco.ronin { background: linear-gradient(135deg, #1273ea, #063c82); color: #fff; font-size: 7.5px; }
.symIco.bb { background: linear-gradient(135deg, #f59e0b, #b45309); color: #fff; font-size: 8.5px; }
.symIco.io { background: linear-gradient(135deg, #7c3aed, #4c1d95); color: #fff; font-size: 8.5px; }
.symIco.lista { background: linear-gradient(135deg, #06d6a0, #047a5b); color: #fff; font-size: 6.5px; }
.symIco.banana { background: linear-gradient(135deg, #facc15, #ca8a04); color: #1b1404; font-size: 6.5px; }
.symIco.zil { background: linear-gradient(135deg, #29c5b5, #146960); color: #fff; font-size: 7.5px; }
.symIco.woo { background: linear-gradient(135deg, #334155, #0f172a); color: #fff; font-size: 7.5px; }
.symIco.enj { background: linear-gradient(135deg, #7866df, #43339e); color: #fff; font-size: 7.5px; }
.symIco.not { background: linear-gradient(135deg, #262626, #000000); color: #fff; font-size: 7.5px; }
.symIco.dogs { background: linear-gradient(135deg, #404040, #171717); color: #fff; font-size: 6.5px; }

/* symbol search (watchlist.js), as in other chart apps */
.dialog.symDlg { width: min(860px, 94vw); padding: 0; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; max-height: min(760px, 86vh); }
.dialogBack:has(.symDlg) { padding-top: 7vh; }
.symTop { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.symTop b { font-size: calc(19px + var(--fs-up)); color: var(--ink2); }
.symInput { display: flex; align-items: center; gap: 10px; margin: 0 20px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--bg); }
.symInput:focus-within { border-color: var(--accent); }
.symInput svg { width: 20px; height: 20px; color: var(--muted); }
.symInput input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px 0; font-size: calc(16px + var(--fs-up)); outline: none; color: var(--ink2); }
.symClear { border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 4px; }
.symCats { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 20px 10px; }
.symCats button { border: 0; border-radius: 999px; padding: 7px 14px; background: var(--pane2); color: var(--ink); cursor: pointer; font-size: calc(13px + var(--fs-up)); }
.symCats button:hover { background: var(--line2); }
.symCats button.on { background: var(--ink2); color: var(--bg); font-weight: 600; }
.symList { overflow-y: auto; min-height: 120px; border-top: 1px solid var(--line); }
.symRow { width: 100%; display: grid; grid-template-columns: 30px minmax(90px, 0.6fr) minmax(0, 1.6fr) auto auto auto; gap: 12px; align-items: center; padding: 10px 20px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.symRow.on { background: var(--raise2); box-shadow: inset 2px 0 0 var(--accent); }
.symCode { color: #ffffff; font-weight: 600; font-size: calc(14.5px + var(--fs-up)); }
html[data-theme="paper"] .symCode { color: var(--ink2); }
.symDesc { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symRow mark { background: transparent; color: var(--accent-ink); font-weight: 700; }
.symDesc mark { color: var(--accent-ink); }
.symType { color: var(--muted); font-size: calc(12px + var(--fs-up)); white-space: nowrap; }
.symSrc { color: var(--ink2); font-size: calc(12.5px + var(--fs-up)); white-space: nowrap; text-transform: none; }
.symAdd { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line2); color: var(--ink2); font-weight: 700; }
.symAdd.in { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.symNone { padding: 24px 20px; color: var(--muted); margin: 0; }
.symFoot { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: calc(12px + var(--fs-up)); background: var(--pane); text-align: center; }
.symFoot b { color: var(--ink); font-family: var(--mono); font-weight: 500; }
@media (max-width: 700px) { .symRow { grid-template-columns: 26px minmax(70px, auto) minmax(0, 1fr) auto; } .symType, .symSrc { display: none; } }
.side:has(#panel-watchlist:not([hidden])) .panelHead { display: none; }   /* the watchlist has its own top row */

/* ── the trading journal (journal.js) ── */
.jTabs button[data-jtab] { border: 0; background: transparent; color: var(--muted); padding: 8px 0 7px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.jTabs button[data-jtab].on { color: var(--ink2); border-bottom-color: var(--ink2); }
.jToday { display: grid; gap: 4px; padding: 8px 10px; border-radius: 6px; background: var(--pane); font-size: calc(12.5px + var(--fs-up)); color: var(--muted); }
.jToday b { color: var(--ink); font-weight: 500; }
.jToday.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-left: 3px solid var(--warn); }
.jToday.warn b { color: var(--warn); }
.jShow { display: flex; align-items: center; gap: 4px; }
.jShow button[data-jshow] { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: calc(12px + var(--fs-up)); }
.jShow button[data-jshow].on { color: var(--ink2); border-color: var(--ink2); }
.jList { display: grid; gap: 2px; }
.jRow { display: grid; gap: 3px; text-align: left; width: 100%; padding: 9px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.jRow:hover { background: var(--pane); }
.jTop { display: flex; align-items: center; gap: 8px; }
.jTop .fine { margin-left: 2px; }
.jDir { font-size: calc(11px + var(--fs-up)); font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.jDir.buy { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.jDir.sell { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.jRes { margin-left: auto; font-family: var(--mono); font-weight: 600; }
.jRes.up { color: var(--up); } .jRes.down { color: var(--down); } .jRes.open { color: var(--muted); font-family: inherit; font-weight: 500; }
.jWhy { color: var(--muted); font-size: calc(12.5px + var(--fs-up)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jEmpty { padding: 6px 2px; }
.jStats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
.jStats div { display: grid; gap: 2px; padding: 8px; border-radius: 6px; background: var(--pane); text-align: center; }
.jStats b { font-family: var(--mono); font-size: calc(16px + var(--fs-up)); }
.jStats b.up { color: var(--up); } .jStats b.down { color: var(--down); }
.jStats span { font-size: calc(11.5px + var(--fs-up)); color: var(--muted); }
.jForm .mfoot { position: sticky; bottom: -14px; z-index: 1; margin: 0 -16px; padding: 10px 16px 14px; background: var(--pane); border-top: 1px solid var(--line); }
.jPic img { width: 100%; border-radius: 6px; border: 1px solid var(--line); display: block; }
.mfoot .danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }

/* ── practice (practice.js) ── */
.prBody { display: grid; gap: 14px; padding-bottom: 12px; }
.prHead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.prTitle { font-size: calc(15px + var(--fs-up)); }
.prSession { color: var(--muted); font-size: calc(12.5px + var(--fs-up)); margin-right: auto; }
/* practice home: a hero with the next step and your totals, then the skills in two groups, each card a small drawing
   of its exercise over a faint chart grid, with your results so far */
.prHome { display: grid; gap: 22px; container-type: inline-size; }
.prHero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 24px 26px; border: 1px solid var(--line2); border-radius: 14px;
  background: radial-gradient(90% 160% at 100% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%), var(--pane); }
.prHeroText { display: grid; gap: 10px; max-width: 640px; }
.prHero h2 { margin: 0; font-size: calc(23px + var(--fs-up)); line-height: 1.2; color: var(--ink2); letter-spacing: -0.01em; }
.prHero p { margin: 0; color: var(--muted); line-height: 1.5; }
.prHeroBtns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.prHeroBtns .primary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; }
.prHeroBtns svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.prHeroBtns .tbtn { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line2); background: var(--pane2); color: var(--ink2); }
.prHeroBtns .tbtn:hover { border-color: var(--line3); }
.prStats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(104px, auto); }
.prStats > div { display: grid; gap: 4px; padding: 4px 22px; border-left: 1px solid var(--line2); }
.prStats > div:first-child { border-left: 0; }
.prStats b { font-family: var(--mono); font-size: calc(28px + var(--fs-up)); font-weight: 500; color: var(--ink2); line-height: 1; font-variant-numeric: tabular-nums; }
.prStats b small { font-size: 0.55em; color: var(--muted); }
.prStats span { color: var(--muted); font-size: calc(12px + var(--fs-up)); white-space: nowrap; }
.prGroups { display: grid; gap: 22px; }
.prGroup { display: grid; gap: 12px; align-content: start; min-width: 0; }
.prGroupHead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.prGroupHead h3 { margin: 0; font-size: calc(12px + var(--fs-up)); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.prGroupHead span { color: var(--muted); font-size: calc(12.5px + var(--fs-up)); }
.prGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.prCard { display: grid; grid-template-rows: auto 1fr; padding: 0; overflow: hidden; text-align: left; border: 1px solid var(--line2); border-radius: 12px; background: var(--pane); color: var(--ink);
  cursor: pointer; font: inherit; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.prCard:hover, .prCard:focus-visible { border-color: var(--accent); outline: none; transform: translateY(-2px); box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 55%, transparent); }
.prMini { position: relative; display: block; height: 142px; padding: 32px 12px 10px; border-bottom: 1px solid var(--line); background-color: var(--bg);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 100% 28px, 44px 100%; background-position: 0 6px, 6px 0; }
.prMini svg { width: 100%; height: 100%; display: block; overflow: visible; stroke: none; stroke-width: 1; }
.prMini .pk-u { fill: var(--up); stroke: var(--up); } .prMini .pk-d { fill: var(--down); stroke: var(--down); } .prMini .pk-m { fill: var(--muted2); stroke: var(--muted2); }
.prMini rect.pk-u, .prMini rect.pk-d, .prMini rect.pk-m { stroke: none; }
.prMini .pk-box { fill: none; stroke: var(--accent-ink); stroke-width: 1.2; stroke-dasharray: 3 2.5; }
.prMini .pk-arrow { fill: none; stroke: var(--accent-ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.prMini .pk-band { fill: var(--accent); opacity: 0.1; }
.prMini .pk-line { fill: none; stroke: var(--accent-ink); stroke-width: 1.8; stroke-linecap: round; }
.prMini .pk-line.dash { stroke-dasharray: 4 3; stroke-width: 1.4; }
.prMini .pk-dot { fill: var(--accent-ink); }
.prMini .pk-t { font: 600 8.5px var(--mono); fill: var(--accent-ink); }
.prMini .pk-t.up { fill: var(--up); } .prMini .pk-t.down { fill: var(--down); }
.prMini .pk-res { stroke: var(--down); stroke-width: 1.4; opacity: 0.85; } .prMini .pk-sup { stroke: var(--up); stroke-width: 1.4; opacity: 0.85; }
.prMini .pk-win { fill: var(--up); opacity: 0.14; } .prMini .pk-loss { fill: var(--down); opacity: 0.14; }
.prMini .pk-now { stroke: var(--muted); stroke-dasharray: 3 3; } .prMini .pk-entry { stroke: var(--ink); stroke-width: 1.2; }
.prMini .pk-ticket { fill: var(--pane); stroke: var(--line2); stroke-width: 1; }
.prMini .pk-k { font: 9px var(--mono); fill: var(--muted); } .prMini .pk-v { font: 500 9px var(--mono); fill: var(--ink); } .prMini .pk-v.acc { fill: var(--accent-ink); font-weight: 600; }
.prMini .pk-rule { stroke: var(--line2); }
.prCardBody { display: grid; gap: 6px; align-content: start; padding: 14px 16px 16px; }
.prCardBody > b { font-size: calc(15px + var(--fs-up)); color: var(--ink2); }
.prTag { position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: calc(10.5px + var(--fs-up)); color: var(--ink); background: color-mix(in srgb, var(--pane) 88%, transparent);
  border: 1px solid var(--line2); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.prCard small { color: var(--muted); line-height: 1.45; }
.prMeter { display: grid; gap: 5px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.prMeter.none { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: calc(12.5px + var(--fs-up)); }
.prGo { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-ink); font-weight: 600; }
.prGo svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 0.15s; }
.prCard:hover .prGo svg { transform: translateX(3px); }
.prBar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.prBar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.prMeterTxt { font-size: calc(13px + var(--fs-up)); color: var(--ink); }
.prMeterTxt b { font-family: var(--mono); font-weight: 600; color: var(--ink2); }
.prMeterTxt b.up, .prMeterSub .up { color: var(--up); } .prMeterTxt b.down, .prMeterSub .down { color: var(--down); }
.prMeterSub { font-size: calc(12px + var(--fs-up)); color: var(--muted); }
/* four cards to a row; very wide: both groups on one row, four cards and two */
@container (min-width: 520px) { .prGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 960px) { .prGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (min-width: 1700px) {
  .prGroups { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; }
  .prGroup.g2 .prGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 720px) {
  .prHero { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 20px; }
  .prStats > div { padding: 2px 14px; } .prStats > div:first-child { padding-left: 0; }
  .prStats b { font-size: calc(22px + var(--fs-up)); }
}
.prStage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; min-height: 440px; }
.prStage.noChart { grid-template-columns: minmax(0, 560px); justify-content: center; min-height: 0; }
.prChart { min-height: 440px; height: 56vh; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; }
.prSide { display: grid; gap: 10px; align-content: start; }
.prMeta { margin: 0; color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.prPrompt { margin: 0; font-size: calc(15px + var(--fs-up)); font-weight: 600; color: var(--ink2); }
.prOpts { display: grid; gap: 8px; }
.prOpts.two { grid-template-columns: 1fr 1fr; }
.prOpt { padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--pane); color: var(--ink); cursor: pointer; font: inherit; font-weight: 500; text-align: left; }
.prOpts.two .prOpt { text-align: center; }
.prOpt:hover:not(:disabled) { border-color: var(--accent); }
.prOpt:disabled { opacity: 0.5; cursor: default; }
.prOpt.buy { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.prOpt.sell { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.prOpt.primaryOpt { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.prVerdict { font-size: calc(22px + var(--fs-up)); font-weight: 700; font-family: var(--mono); }
.prVerdict.ok { color: var(--up); } .prVerdict.no { color: var(--down); }
.prSide p { margin: 0; }
.prExplain { color: var(--ink); }
.prSide .kv span.up { color: var(--up); } .prSide .kv span.down { color: var(--down); }
.prLevels { display: grid; gap: 6px; }
/* progress: one card per skill, the main number large, then the details, the trend and a button */
.pgList { display: grid; gap: 10px; }
.pgRow { display: grid; grid-template-columns: 210px 150px minmax(0, 1fr) 160px auto; gap: 18px; align-items: center; padding: 14px 18px; border: 1px solid var(--line2); border-radius: 12px; background: var(--pane); }
.pgRow.none { grid-template-columns: 210px minmax(0, 1fr) auto; }
.pgName { display: grid; gap: 3px; } .pgName b { color: var(--ink2); font-size: calc(14.5px + var(--fs-up)); }
.pgName span { font-family: var(--mono); font-size: calc(11px + var(--fs-up)); color: var(--muted); }
.pgMain { display: grid; gap: 2px; } .pgMain b { font-family: var(--mono); font-size: calc(24px + var(--fs-up)); font-weight: 500; color: var(--ink2); line-height: 1.1; }
.pgMain span { color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.pgMain b.up, .pgDetail b.up { color: var(--up); } .pgMain b.down, .pgDetail b.down { color: var(--down); }
.pgDetail { color: var(--ink); font-size: calc(13px + var(--fs-up)); display: grid; gap: 8px; }
.pgMixed { display: flex; flex-wrap: wrap; gap: 6px; }
.pgMixed span { font-size: calc(11.5px + var(--fs-up)); color: var(--muted); border: 1px solid var(--line2); border-radius: 999px; padding: 2px 9px; }
.pgMixed i { font-style: normal; font-family: var(--mono); color: var(--ink); }
.pgEmpty { color: var(--muted); }
.pgRow .tbtn { border: 1px solid var(--line2); border-radius: 8px; padding: 7px 14px; color: var(--ink2); }
.pgRow .tbtn:hover { border-color: var(--accent); color: var(--accent-ink); }
.pgReset { margin-left: auto; }
.prSpark { width: 160px; height: 34px; color: var(--accent-ink); }
@media (max-width: 760px) {
  .prStage { grid-template-columns: minmax(0, 1fr); }
  .prChart { height: 46vh; min-height: 300px; }
  .pgRow, .pgRow.none { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btn" "main main" "detail detail"; gap: 10px 14px; }
  .pgName { grid-area: name; } .pgRow .tbtn { grid-area: btn; } .pgMain, .pgEmpty { grid-area: main; } .pgDetail { grid-area: detail; }
  .pgRow .prSpark, .pgRow > span:empty { display: none; }
}
.prOpts.three { grid-template-columns: 1fr 1fr 1.6fr; }
.prOpts.three .prOpt { text-align: center; }
/* practice: your own drawing tools on the chart (direction calls) */
.prTools { position: absolute; top: 8px; left: 8px; z-index: 4; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line2); border-radius: 9px;
  background: color-mix(in srgb, var(--pane) 92%, transparent); box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.6); }
.prTools button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.prTools button:hover:not(:disabled) { background: var(--pane2); color: var(--ink2); }
.prTools button.on { background: var(--accent-soft); color: var(--accent-ink); }
.prTools button:disabled { opacity: 0.35; cursor: default; }
.prTools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.prTools .sep { width: 1px; height: 20px; margin: 0 3px; background: var(--line2); }
.prChart.sketching { cursor: crosshair; }

/* market context in the Briefing panel (context.js): big traders' futures positions, correlations */
.mcBox { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.mcBox .sect { grid-template-columns: minmax(0, 1fr); }      /* only the watchlist table scrolls sideways */
.mcCot { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mcHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mcCot .plain { margin: 2px 0 4px; }
.mcRange { margin-top: 4px; }
.mcBar { position: relative; height: 6px; border-radius: 3px; background: var(--line2); margin: 2px 0; }
.mcBar i { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ink2); box-shadow: 0 0 0 1.5px var(--pane); }
.mcRange .kv span { font-size: calc(11px + var(--fs-up)); color: var(--muted); }
.mcSpark { width: 100%; height: 40px; margin-top: 4px; }
.mcSpark polyline { stroke: var(--accent-ink); stroke-width: 1.4; fill: none; vector-effect: non-scaling-stroke; }
.mcSpark .zero { stroke: var(--line3); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.mcSpark circle { fill: var(--accent-ink); stroke: none; }
.mcTable { border-collapse: collapse; width: 100%; }
.mcTable caption { text-align: left; color: var(--muted); font-size: calc(12px + var(--fs-up)); padding: 6px 0 2px; }
.mcTable th { text-align: right; font-weight: 500; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); padding: 2px 0; }
.mcTable td:not(:first-child) { text-align: right; padding-right: 0; }
.mcSym { border: 0; background: none; padding: 0; color: var(--ink); font: inherit; cursor: pointer; text-decoration: underline dotted var(--line3); text-underline-offset: 3px; }
.mcSym:hover, .mcSym:focus-visible { color: var(--accent-ink); }
.mcLink { border: 0; background: none; padding: 0; color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.mcLink:hover, .mcLink:focus-visible { text-decoration: underline; }
.mcGridHead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0 6px; }
.mcGridHead .seg { display: inline-flex; gap: 2px; background: var(--pane2); border-radius: 6px; padding: 2px; }
.mcGridHead .seg button { border: 0; background: transparent; color: var(--muted); font-size: calc(12px + var(--fs-up)); padding: 3px 8px; border-radius: 4px; cursor: pointer; }
.mcGridHead .seg button.on { background: var(--raise2); color: var(--ink2); }
.mcGridWrap { overflow-x: auto; }
.mcGrid { border-collapse: collapse; font-size: calc(11px + var(--fs-up)); }
.mcGrid th { font-weight: 500; color: var(--muted); padding: 3px 4px; white-space: nowrap; }
.mcGrid th[scope="col"] { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; height: 58px; }
.mcGrid th[scope="row"] { text-align: right; }
.mcGrid td { min-width: 38px; padding: 3px 4px; text-align: center; border: 1px solid var(--pane); color: var(--ink2); }
.mcGrid td.mcSelf { background: var(--pane2); }
.mcNote { margin: 0; }

/* ── Settings dialog: sections on the left, the chosen one on the right, Cancel / Ok below (as in other chart apps) ── */
.setModal { padding-top: 9vh; }
.setModal #modal { width: min(820px, 96vw); height: min(540px, 86vh); max-height: none; padding: 0; overflow: hidden; display: flex; border-radius: 12px; }
.setDlg { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.setHead { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px 24px; }
.setHead b { font-size: calc(19px + var(--fs-up)); font-weight: 600; color: var(--ink2); }
.setHead .x { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: calc(22px + var(--fs-up)); line-height: 1; cursor: pointer; }
.setHead .x:hover { background: var(--pane2); color: var(--ink2); }
.setBody { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.setNav { display: grid; align-content: start; gap: 2px; padding: 10px 14px 14px; overflow-y: auto; }
.setNav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: calc(14px + var(--fs-up)); text-align: left; white-space: nowrap; cursor: pointer; }
.setNav button svg { width: 20px; height: 20px; color: var(--muted); }
.setNav button:hover { background: var(--pane2); }
.setNav button.on { background: var(--pane2); color: var(--ink2); font-weight: 600; }
.setNav button.on svg { color: var(--ink2); }
.setPanes { overflow-y: auto; padding: 0 28px 20px 20px; }
.setPane[hidden] { display: none; }
.setPane h4 { margin: 16px 0 4px; font-size: calc(11px + var(--fs-up)); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.setRow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; font-size: calc(14px + var(--fs-up)); color: var(--ink); }
.setRow > span, .setCheck > span { display: grid; gap: 2px; min-width: 0; }
.setRow small, .setCheck small { font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.setRow select, .setRow input[type="number"] { width: 230px; max-width: 55%; background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 7px 9px; color: var(--ink); }
.setRow select:focus, .setRow input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.setRow input[type="color"] { width: 44px; height: 32px; padding: 3px; border: 1px solid var(--line2); border-radius: 6px; background: var(--pane); cursor: pointer; }
.setCheck { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: calc(14px + var(--fs-up)); color: var(--ink); cursor: pointer; }
.setCheck input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.setNote { margin: 4px 0 0; font-size: calc(12.5px + var(--fs-up)); color: var(--muted); }
.setRow > .setSound { display: flex; align-items: center; gap: 8px; width: 272px; max-width: 60%; }   /* a sound: its choice and a play button */
.setRow .setSound select { flex: 1; width: auto; max-width: none; min-width: 0; }
.setSound input[type="range"] { flex: 1; min-width: 0; margin: 0; accent-color: var(--accent); }
.setSound output { flex: none; width: 40px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.setPlay { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line2); border-radius: 50%; background: var(--pane); color: var(--ink); cursor: pointer; }
.setPlay:hover { border-color: var(--accent); color: var(--accent); }
.setPlay svg { width: 14px; height: 14px; stroke: none; }
.setFoot { display: flex; align-items: center; gap: 10px; padding: 14px 20px 14px 24px; border-top: 1px solid var(--line); }
.setFoot .grow { flex: 1; }
.setFoot button { padding: 8px 18px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); font-size: calc(14px + var(--fs-up)); cursor: pointer; }
.setFoot button:hover { border-color: var(--line3); }
.setFoot .primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.setFoot .primary:hover { background: var(--accent-hover); }
@media (max-width: 640px) {                                /* narrow: the sections become a row of tabs above the settings */
  .setModal { padding-top: 4vh; }
  .setModal #modal { height: auto; max-height: 92vh; }
  .setBody { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .setNav { display: flex; gap: 4px; padding: 4px 14px 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
  .setNav button { flex: none; padding: 8px 10px; gap: 8px; }
  .setPanes { padding: 0 18px 16px; }
  .setRow select, .setRow input[type="number"] { width: 170px; }
  .setRow > .setSound { width: 212px; }
}

/* theme cards: System / Dark / Light, in the Settings dialog and the profile menu */
.themeCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.themeCard { display: grid; gap: 6px; justify-items: center; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: calc(13px + var(--fs-up)); cursor: pointer; }
.themeCard input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.themeCard b { font-weight: 500; }
.themeCard .thumb { position: relative; width: 100%; height: 48px; display: flex; gap: 4px; padding: 6px; box-sizing: border-box; border: 1px solid var(--line2); border-radius: 8px; background: #101413; overflow: hidden; }
.themeCard .thumb i { flex: 1; border-radius: 3px; background: #2c3431; }
.themeCard .thumb.paper { background: #fbfcfa; }
.themeCard .thumb.paper i { background: #d9dfd8; }
.themeCard .thumb.system { background: linear-gradient(90deg, #101413 50%, #fbfcfa 50%); }
.themeCard .thumb.system i { background: #d9dfd8; }
.themeCard .thumb.system i:first-child { background: #2c3431; }
.themeCard .thumb.system i:nth-child(2) { background: linear-gradient(90deg, #2c3431 50%, #d9dfd8 50%); }
.themeCard:hover .thumb { border-color: var(--line3); }
.themeCard.on .thumb, .themeCard input:checked + .thumb { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.themeCard input:focus-visible + .thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.setPane .themeCards { max-width: 420px; margin: 8px 0 6px; }

/* the profile menu (avatar, top right) */
.acctPop { position: fixed; z-index: 45; width: 300px; min-width: 0; max-width: calc(100vw - 12px); max-height: calc(100vh - 12px); overflow-y: auto; padding: 8px; border-radius: 12px; }
.acctPop .acHead { display: grid; justify-items: center; gap: 3px; padding: 12px 8px 8px; text-align: center; min-width: 0; }
.acctPop .acAv { width: 52px; height: 52px; margin-bottom: 6px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: calc(19px + var(--fs-up)); font-weight: 700; }
.acctPop .acHead b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(15px + var(--fs-up)); color: var(--ink2); }
.acctPop .acMail { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(12.5px + var(--fs-up)); color: var(--muted); }
.acctPop .acPlan { margin-top: 4px; padding: 2px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); font-size: calc(11.5px + var(--fs-up)); font-weight: 600; }
.acctPop > button { padding: 9px 8px; font-size: calc(14px + var(--fs-up)); }
.acctPop > button svg { color: var(--muted); }
.acctPop > button small { font-family: var(--mono); }
.acctPop .acSize { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px 10px; font-size: calc(14px + var(--fs-up)); color: var(--ink); }
.acctPop .acSeg { display: flex; padding: 2px; border: 1px solid var(--line2); border-radius: 8px; }
.acctPop .acSeg button { padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: calc(12.5px + var(--fs-up)); cursor: pointer; }
.acctPop .acSeg button.on { background: var(--pane2); color: var(--ink2); font-weight: 600; }
.acctPop .themeCards { padding: 2px 8px 10px; }

/* ── heatmaps (heatmap.js) and the screener (screener.js) ── */
.hmPage, .scrPage { display: flex; flex-direction: column; gap: 10px; margin: 12px 16px 0; min-width: 0; }
.dialogBack.asPage .hmPage, .dialogBack.asPage .scrPage { margin: 0; }
.hmBar, .scrTop { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.hmTitle { border: 0; background: transparent; font: inherit; font-size: calc(19px + var(--fs-up)); font-weight: 600; color: var(--ink2); padding: 4px 8px 4px 2px; border-radius: 8px; cursor: pointer; }
.hmTitle:hover { background: var(--pane2); }
.hmTitle span { font-size: 0.7em; color: var(--muted); }
.hmDrop { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: calc(13.5px + var(--fs-up)); cursor: pointer; white-space: nowrap; }
.hmDrop:hover, .hmIcon:hover { background: var(--pane2); }
.hmDrop svg { width: 17px; height: 17px; color: var(--muted); }
.hmSw { width: 14px; height: 14px; border-radius: 3px; background: linear-gradient(90deg, #e2394c 0 33%, #363c3a 33% 66%, #1fbd7c 66%); flex: none; }
html[data-theme="paper"] .hmSw { background: linear-gradient(90deg, #cf3247 0 33%, #dde2de 33% 66%, #0f9160 66%); }
.hmIcon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; flex: none; }
.hmScr { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, var(--line2)); }
.hmScr svg { color: var(--accent-ink); }
.hmSep { width: 1px; height: 24px; background: var(--line2); margin: 0 4px; }
.hmSeg { display: inline-flex; padding: 2px; border: 1px solid var(--line2); border-radius: 8px; }
.hmSeg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; color: var(--muted); font: inherit; cursor: pointer; }
.hmSeg button.on { background: var(--pane2); color: var(--ink2); font-weight: 600; }
.hmCrumbs { display: flex; align-items: center; gap: 8px; font-size: calc(14px + var(--fs-up)); color: var(--muted); }
.hmCrumbs button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--accent-ink); font: inherit; cursor: pointer; padding: 2px 6px 2px 0; }
.hmCrumbs button svg { width: 15px; height: 15px; }
.hmCrumbs b { color: var(--ink2); }
.hmBox { position: relative; height: min(68vh, 720px); min-height: 320px; border-radius: 10px; overflow: hidden; background: var(--pane); touch-action: manipulation; }
.dialogBack.asPage .hmBox { height: calc(100vh - var(--tabs-h) - 200px); height: calc(100dvh - var(--tabs-h) - 200px); min-height: 360px; }
.hmBox canvas { display: block; position: absolute; inset: 0; }
.hmLoading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.hmFoot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 6px; }
.hmLegend { display: flex; gap: 3px; }
.hmLegend span { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; }
.hmLegend i { width: 100%; height: 8px; border-radius: 2px; }
.hmLegend small { font-size: calc(11px + var(--fs-up)); color: var(--muted); font-family: var(--mono); }
.hmPage:fullscreen { margin: 0; padding: 14px 16px; background: var(--bg); }
.hmPage:fullscreen .hmBox { height: auto; flex: 1; }
.hmMatrix .scrBar, .hmMatrix .scrBody { margin-left: 0; margin-right: 0; }
.hmMatrix td.link { cursor: pointer; }
.hmTip { position: fixed; z-index: 90; width: 300px; max-width: calc(100vw - 12px); padding: 12px 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--pane); color: var(--ink);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.38); pointer-events: none; font-size: calc(13px + var(--fs-up)); }
.hmTip.pinned { pointer-events: auto; }
.hmTip .fine { margin: 6px 0 0; }
.hmTipHead { display: flex; align-items: center; gap: 10px; }
.hmTipHead .symIco i, .hmTipHead .symIco.metal { width: 30px; height: 30px; font-size: 16px; }
.hmTipHead b { display: block; font-size: calc(15px + var(--fs-up)); color: var(--ink2); }
.hmTipHead span { display: block; color: var(--muted); font-size: calc(12px + var(--fs-up)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.hmTipPrice { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; font-family: var(--mono); }
.hmTipPrice b:first-child { font-size: calc(18px + var(--fs-up)); color: var(--ink2); }
.hmTipPrice small { color: var(--muted); font-family: var(--sans); }
.hmTipPerf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 2px; margin-top: 10px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.hmTipPerf small { display: block; color: var(--muted); font-size: calc(10.5px + var(--fs-up)); }
.hmTipPerf b { font: 500 calc(11.5px + var(--fs-up)) var(--mono); }
.hmTip dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 8px 0 0; }
.hmTip dt { color: var(--muted); }
.hmTip dd { margin: 0; text-align: right; font-family: var(--mono); }
.hmTipOpen { width: 100%; margin-top: 10px; }
.hmTipHint { opacity: 0.8; }

.scrKinds, .scrSets { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.scrKinds button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; color: var(--muted); font: inherit; font-size: calc(14.5px + var(--fs-up)); font-weight: 500; cursor: pointer; white-space: nowrap; }
.scrKinds button:hover, .scrSets button:hover { background: var(--pane2); color: var(--ink); }
.scrKinds button.on { background: var(--pane2); color: var(--ink2); font-weight: 600; }
.scrChips { display: flex; flex-wrap: wrap; gap: 8px; }
.scrChip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: calc(13.5px + var(--fs-up)); cursor: pointer; white-space: nowrap; }
.scrChip:hover { background: var(--pane2); }
.scrChip.on { padding: 0; border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); color: var(--accent-ink); }
.scrChip.on > button { height: 100%; border: 0; background: transparent; color: inherit; font: inherit; padding: 0 4px 0 12px; cursor: pointer; }
button.scrChip.on { padding: 0 12px; }
.scrChip .scrX { padding: 0 10px 0 6px !important; font-size: 17px !important; opacity: 0.8; }
.scrChip.locked { color: var(--muted); }
.scrChip.locked svg { width: 14px; height: 14px; }
.scrReset { color: var(--muted); border-style: dashed; }
.scrSets { border-bottom: 1px solid var(--line); align-items: center; }
.scrSets button { border: 0; background: transparent; padding: 9px 14px; color: var(--muted); font: inherit; font-size: calc(14px + var(--fs-up)); cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.scrSets button.on { color: var(--ink2); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.scrSets button.na { opacity: 0.65; }
.scrTf { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
.scrTf select { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; }
.scrTable { overflow: auto; max-height: min(62vh, 760px); border-bottom: 1px solid var(--line); }
.dialogBack.asPage .scrTable { max-height: calc(100vh - var(--tabs-h) - 270px); max-height: calc(100dvh - var(--tabs-h) - 270px); min-height: 240px; }
table.scrBig { font-size: calc(14px + var(--fs-up)); }
table.scrBig thead th { position: sticky; top: 0; z-index: 2; background: var(--pane); padding: 10px 10px; white-space: nowrap; }
table.scrBig thead th i { font-style: normal; font-size: 0.7em; margin-left: 4px; }
table.scrBig th.left, table.scrBig td.left { text-align: left; font-family: var(--sans); }
table.scrBig td { padding: 10px 10px; font-size: calc(13.5px + var(--fs-up)); }
table.scrBig td small { margin-left: 4px; color: var(--muted); font-family: var(--sans); font-size: 0.78em; }
table.scrBig .scrSym { position: sticky; left: 0; z-index: 1; background: var(--pane); text-align: left; min-width: 250px; max-width: 340px; }
table.scrBig thead .scrSym { z-index: 3; cursor: default; }
table.scrBig tbody tr:hover .scrSym { background: var(--pane2); }
table.scrBig td.scrSym { font-family: var(--sans); white-space: nowrap; }
.scrSymIn { display: flex; align-items: center; gap: 10px; overflow: hidden; }
table.scrBig td.scrSym .symIco i, table.scrBig td.scrSym .symIco.metal { width: 24px; height: 24px; font-size: 13px; }
table.scrBig .symCode { display: inline-block; min-width: 54px; padding: 2px 6px; border-radius: 4px; background: var(--pane2); color: var(--ink2); font: 600 calc(12.5px + var(--fs-up)) var(--mono); text-align: center; }
.scrName { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.scrSearch { display: inline-flex; align-items: center; gap: 6px; }
.scrSearch svg { width: 16px; height: 16px; color: var(--muted); }
.scrSearch input { width: 130px; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 500; outline: none; padding: 2px 0; }
.scrSearch input::placeholder { color: var(--muted); }
th.scrSym small { margin-left: 8px; color: var(--muted); font-family: var(--mono); }
.scrRate { font-family: var(--sans); color: var(--muted); }
.scrRate.buy { color: var(--up); } .scrRate.sell { color: var(--down); }
.scrLock svg { width: 14px; height: 14px; color: var(--muted2); vertical-align: -2px; }
td .na { color: var(--muted2); font-family: var(--sans); }
.scrEmpty { text-align: center !important; padding: 40px 10px !important; color: var(--muted); font-family: var(--sans) !important; }
.scrNA { display: flex; gap: 14px; align-items: flex-start; padding: 28px 18px; margin: 10px 0; border: 1px dashed var(--line2); border-radius: 12px; max-width: 720px; }
.scrNA svg { width: 26px; height: 26px; color: var(--muted); }
.scrNA p { margin: 6px 0 0; }
.scrFoot { margin: 0 0 8px; }
.scrPop { position: fixed; z-index: 85; width: 320px; max-width: calc(100vw - 12px); padding: 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--pane); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); display: flex; flex-direction: column; gap: 10px; }
.scrPopHead { display: flex; justify-content: space-between; align-items: center; }
.scrPresets { display: flex; flex-wrap: wrap; gap: 6px; }
.scrOpt { border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 7px; padding: 5px 10px; font: inherit; font-size: calc(12.5px + var(--fs-up)); cursor: pointer; text-align: left; }
.scrOpt:hover { background: var(--pane2); }
.scrOpt.on { border-color: var(--accent); color: var(--accent-ink); }
.scrPop > .scrOpt { width: 100%; }
.scrRow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scrRow select, .scrRow input, .scrPopQ { background: var(--bg); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; color: var(--ink); font: inherit; }
.scrRow input { width: 92px; }
.scrChecks { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.scrChecks label { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.scrChecks label:hover { background: var(--pane2); }
.scrChecks label span { flex: 1; }
.scrChecks small { color: var(--muted); font-family: var(--mono); }
.scrPopFoot { display: flex; justify-content: flex-end; }
@media (max-width: 640px) {
  .hmPage, .scrPage { margin: 10px 10px 0; }
  .hmBar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .scrKinds { flex: 1 1 100%; }
  .scrTop .grow { display: none; }
  .hmTitle { font-size: 16px; flex: none; }
  .hmDrop, .hmIcon { flex: none; }
  .hmSep { display: none; }
  .hmBox, .dialogBack.asPage .hmBox { height: calc(100dvh - var(--tabs-h) - 210px); min-height: 300px; }
  .hmLegend span { width: 40px; }
  .hmTip { width: calc(100vw - 20px); }
  .scrChips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .scrChip { flex: none; }
  table.scrBig .scrSym { min-width: 150px; max-width: 170px; }
  table.scrBig .scrName { display: none; }
  .scrSearch input { width: 70px; }
  .dialogBack.asPage .scrTable { max-height: calc(100dvh - var(--tabs-h) - 250px); }
}

/* ── the Journal page (journal.js, its own tab) and what the side panel gained ──
   A ledger, not a card kit: figures in one ruled strip, charts drawn as thin lines over hairline rules, green and red
   kept for results only. Strategies get one of eight muted hues (below) that never read as a win or a loss. */
:root { --st-iris: #8f9cf5; --st-amber: #d6a648; --st-plum: #b48ae0; --st-sky: #5cb6e0; --st-sand: #c4ab84; --st-slate: #8d9aa8; --st-orchid: #d88cc6; --st-ochre: #cf8d52; }
html[data-theme="paper"] { --st-iris: #4f5fd1; --st-amber: #a8791c; --st-plum: #8455b8; --st-sky: #2b84b3; --st-sand: #8f7650; --st-slate: #5d6b7a; --st-orchid: #b0559a; --st-ochre: #a85f24; }
.grid2 > .span2 { grid-column: 1 / -1; }
.jTag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: calc(11.5px + var(--fs-up)); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; margin-right: 6px; }
.jTag i { width: 8px; height: 8px; border-radius: 2px; background: var(--sc); flex: none; }
.jTag.none { color: var(--muted); } .jTag.none i { background: transparent; box-shadow: inset 0 0 0 1px var(--line3); }
.jPill { display: inline-block; font-size: calc(11px + var(--fs-up)); font-weight: 600; line-height: 1.5; padding: 0 7px; border-radius: 3px; color: var(--muted); background: var(--pane2); white-space: nowrap; }
.jPill.win { color: var(--up); background: color-mix(in srgb, var(--up) 15%, transparent); }
.jPill.loss { color: var(--down); background: color-mix(in srgb, var(--down) 15%, transparent); }
.jPill.open { background: transparent; box-shadow: inset 0 0 0 1px var(--line2); }
.jSide { font-size: calc(11.5px + var(--fs-up)); color: var(--muted); }
.jPageLink { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border: 1px solid var(--line2); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font: inherit; }
.jPageLink:hover { border-color: var(--line3); background: var(--pane); }
.jPageLink svg { color: var(--accent-ink); }
.jPageLink span { display: grid; } .jPageLink small { color: var(--muted); font-size: calc(11.5px + var(--fs-up)); }
.jMiniEq { height: 64px; margin: 2px 0 6px; }
.jStratSect .jStrats { display: grid; gap: 4px; }
.jStrat { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 26px; align-items: center; gap: 8px; }
.jStrat input { min-width: 0; background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 5px 7px; color: var(--ink2); font-weight: 500; }
.jStrat input:hover { border-color: var(--line2); } .jStrat input:focus { outline: none; border-color: var(--accent); background: var(--pane); }
.jSw { width: 18px; height: 18px; border-radius: 4px; border: 0; background: var(--sc); cursor: pointer; padding: 0; }
.jStratDel { width: 26px; height: 26px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.jStratDel:hover { color: var(--down); background: var(--pane); }
.jStratAdd { display: flex; gap: 8px; margin-top: 4px; }
.jStratAdd input { flex: 1; min-width: 0; background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 7px 9px; }
.jStratAdd input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.jp { min-height: 100%; }
.jpIn { max-width: 1440px; margin: 0 auto; padding: 22px 28px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.jp :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.jp .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.jp .num, .jp .jFig b, .jp .jDNet, .jp .jChip span, .jp .jWkT b, .jp .c-result, .jp .jCardRes, .jp .jSBar > b, .jp .jAvg b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.jpHead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.jpHead h1 { margin: 0; font-size: calc(24px + var(--fs-up)); font-weight: 600; color: var(--ink2); letter-spacing: -0.01em; }
.jpCount { margin: 0; color: var(--muted); }
.jpGap { flex: 1; }
.jpHead .primary { align-self: center; padding: 8px 14px; }
.jpHead .primary:hover { background: var(--accent-hover); }
.jpUnits, .jpSeg { align-self: center; display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; padding: 2px; gap: 2px; }
.jpUnits button, .jpSeg button { border: 0; background: transparent; color: var(--muted); padding: 4px 11px; border-radius: 4px; cursor: pointer; font-weight: 500; min-width: 34px; }
.jpUnits button:hover, .jpSeg button:hover { color: var(--ink); }
.jpUnits button.on, .jpSeg button.on { background: var(--pane2); color: var(--ink2); }
.jpSeg.small button { padding: 2px 9px; font-size: calc(12px + var(--fs-up)); }
.jpViews { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.jpViews button { border: 0; background: transparent; color: var(--muted); padding: 9px 0 8px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.jpViews button:hover { color: var(--ink); }
.jpViews button.on { color: var(--ink2); border-bottom-color: var(--ink2); }
.jpFilters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.jpSel select { background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 8px; max-width: 220px; }
.jpFind { display: inline-flex; align-items: center; gap: 6px; background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 0 8px; color: var(--muted); }
.jpFind:focus-within { border-color: var(--accent); }
.jpFind svg { width: 14px; height: 14px; }
.jpFind input { border: 0; background: transparent; outline: none; width: 110px; padding: 5px 0; color: var(--ink); }
.jpClear, .jpLinkBtn { border: 0; background: transparent; color: var(--accent-ink); cursor: pointer; padding: 4px 2px; font: inherit; }
.jpClear:hover, .jpLinkBtn:hover { text-decoration: underline; }
.jpIco { width: 30px; height: 30px; border: 1px solid var(--line2); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font-size: 17px; line-height: 1; }
.jpIco:hover { background: var(--pane); }
.jpNote { margin: 0; }
.jpNone, .jpEmpty { display: grid; justify-items: start; gap: 8px; padding: 28px 0; color: var(--muted); }
.jpNone p { margin: 0; }
.jpEmpty { justify-items: center; text-align: center; padding: 64px 16px; }
.jpEmpty svg { width: 180px; height: 108px; stroke: none; }
.jpEmpty rect { fill: var(--pane2); } .jpEmpty rect.u { fill: color-mix(in srgb, var(--up) 40%, var(--pane2)); } .jpEmpty rect.d { fill: color-mix(in srgb, var(--down) 40%, var(--pane2)); }
.jpEmpty h2 { margin: 6px 0 0; color: var(--ink2); font-size: calc(18px + var(--fs-up)); font-weight: 600; }
.jpEmpty p { margin: 0 0 8px; max-width: 46ch; }
.jpMore { justify-self: center; margin-top: 8px; border: 1px solid var(--line2); background: transparent; color: var(--ink); border-radius: 6px; padding: 8px 16px; cursor: pointer; }
.jpMore:hover { background: var(--pane); }
.jpBody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }

/* Overview: one ruled strip of figures, then the charts in two columns */
.jFigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line); }
.jFig { display: grid; align-content: start; gap: 3px; padding: 12px 16px 13px; border-left: 1px solid var(--line); min-width: 0; }
.jFig:first-child { border-left: 0; padding-left: 0; }
.jFig > span { color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.jFig b { font-size: calc(19px + var(--fs-up)); font-weight: 500; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jFig b.up, .jFig .up { color: var(--up); } .jFig b.down, .jFig .down { color: var(--down); }
.jFig small { color: var(--muted); font-size: calc(11.5px + var(--fs-up)); }
.jFig.lead { grid-column: span 2; }
.jFig.lead b { font-size: calc(34px + var(--fs-up)); letter-spacing: -0.02em; line-height: 1.1; }
.jSlash { color: var(--line3); }
.jpGrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px 32px; }
.jBox { display: grid; gap: 10px; align-content: start; min-width: 0; }
.jBox > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.jBox h2 { margin: 0; font-size: calc(14px + var(--fs-up)); font-weight: 600; color: var(--ink2); }
.jBox > header p { margin: 0; flex-basis: 100%; color: var(--muted); font-size: calc(12px + var(--fs-up)); max-width: 75ch; }
.jBox > header .jpSeg { margin-left: auto; }
.jEq { position: relative; height: 280px; margin: 0 44px 22px 0; touch-action: pan-y; }
.jEqSvg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.jEqSvg path { vector-effect: non-scaling-stroke; }
.jEqSvg .ln { fill: none; stroke: var(--ink2); stroke-width: 1.75; }
.jEqSvg .aU { fill: color-mix(in srgb, var(--up) 13%, transparent); stroke: none; }
.jEqSvg .aD { fill: color-mix(in srgb, var(--down) 13%, transparent); stroke: none; }
.jEqSvg .dd { fill: color-mix(in srgb, var(--down) 26%, transparent); stroke: none; }
.jEqSvg .zero { stroke: var(--line3); stroke-width: 1; stroke-dasharray: 3 4; fill: none; }
.jMiniEq .jEqSvg { position: static; height: 64px; }
.jAxY { position: absolute; left: 100%; margin-left: 8px; transform: translateY(-50%); font: calc(11px + var(--fs-up)) var(--mono); color: var(--muted); white-space: nowrap; }
.jAxX { position: absolute; top: 100%; margin-top: 6px; transform: translateX(-50%); font-size: calc(11px + var(--fs-up)); color: var(--muted); white-space: nowrap; }
.jAxX[style^="left:0"] { transform: none; } .jAxX[style="left:100%"], .jAxX.end { transform: translateX(-100%); }
.jEqCur { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line3); pointer-events: none; }
.jEqTip { position: absolute; top: 6px; transform: translateX(12px); background: var(--pane); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 9px; font-size: calc(12px + var(--fs-up)); line-height: 1.45; pointer-events: none; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28); z-index: 2; }
.jEqTip.flip { transform: translateX(calc(-100% - 12px)); }
.jBars { position: relative; height: 180px; margin-bottom: 22px; }
.jBars.per { height: 120px; margin-right: 30px; }
.jBars svg { width: 100%; height: 100%; display: block; stroke: none; }
.jBars rect { fill: var(--line3); }
.jBars.per rect { fill: color-mix(in srgb, var(--ink) 30%, transparent); }
.jFig b.pair { display: grid; font-size: calc(15px + var(--fs-up)); line-height: 1.3; }
.jBars rect.pos { fill: var(--up); } .jBars rect.neg { fill: var(--down); }
.jBars rect[data-jday] { cursor: pointer; } .jBars rect[data-jday]:hover { opacity: 0.75; }
.jBars .zero { stroke: var(--line2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.jBars.per .jAxY { top: 0; transform: none; }
.jSplit { display: flex; height: 10px; border-radius: 2px; overflow: hidden; gap: 2px; }
.jSplit .w { background: var(--up); } .jSplit .l { background: var(--down); } .jSplit .e { background: var(--line3); }
.jSplit span { min-width: 2px; }
.jSplitKey { display: flex; justify-content: space-between; color: var(--muted); font-size: calc(12px + var(--fs-up)); margin-bottom: 6px; }
.jSplitKey b { font-family: var(--mono); font-weight: 500; font-size: calc(15px + var(--fs-up)); margin-right: 4px; }
.jAvg { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: calc(12.5px + var(--fs-up)); }
.jAvg > span:first-child { color: var(--muted); }
.jAvgTrack { height: 6px; background: var(--pane2); border-radius: 1px; overflow: hidden; }
.jAvgTrack span { display: block; height: 100%; } .jAvgTrack .pos { background: var(--up); } .jAvgTrack .neg { background: var(--down); }
.jAvg b { font-weight: 500; text-align: right; min-width: 64px; }
.jSBars { display: grid; gap: 10px; }
.jSBar { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name net" "track track" "meta meta"; gap: 3px 10px; }
.jSName { grid-area: name; display: flex; align-items: center; gap: 7px; color: var(--ink2); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jSName i { width: 9px; height: 9px; border-radius: 2px; background: var(--sc); flex: none; }
.jSMeta { grid-area: meta; color: var(--muted); font-size: calc(11.5px + var(--fs-up)); }
.jSBar > b { grid-area: net; font-weight: 500; }
.jSTrack { grid-area: track; position: relative; height: 6px; background: var(--pane2); border-radius: 1px; }
.jSTrack.mixed::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line3); }
.jSFill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--sc); }
.jSTrack.mixed .jSFill.pos { left: 50%; } .jSTrack.mixed .jSFill.neg { left: auto; right: 50%; }
.jSFill.neg { background: repeating-linear-gradient(135deg, var(--sc) 0 3px, transparent 3px 5px); }
.jBox .kv b { font-weight: 500; }

/* Calendar: a ruled month with a column for each week's total; a day's net tints it, its trades are chips */
.jCalHead { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.jCalNav { display: flex; align-items: center; gap: 8px; }
.jCalNav h2 { margin: 0 6px; min-width: 9.5em; text-align: center; font-size: calc(17px + var(--fs-up)); font-weight: 600; color: var(--ink2); }
.jCalSum { margin: 0; color: var(--muted); flex: 1; }
.jCalSum b { font-family: var(--mono); font-weight: 500; }
.jCal { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.jWD, .jCells { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 82px; }
.jWD span { padding: 7px 8px; color: var(--muted); font-size: calc(12px + var(--fs-up)); border-bottom: 1px solid var(--line); background: var(--pane); }
.jWD .wk { text-align: right; }
.jCells { gap: 1px; background: var(--line); }
.jDayC { position: relative; container-type: inline-size; display: grid; align-content: start; gap: 5px; min-height: 108px; padding: 6px 7px 8px; border: 0; background: var(--bg); color: var(--ink); text-align: left; cursor: pointer; font: inherit; min-width: 0; }
.jDayC:hover { box-shadow: inset 0 0 0 1px var(--line3); }
.jDayC.pos { background: color-mix(in srgb, var(--up) calc(var(--t) * 1%), var(--bg)); }
.jDayC.neg { background: color-mix(in srgb, var(--down) calc(var(--t) * 1%), var(--bg)); }
.jDayC.out { background: var(--bg-deep); } .jDayC.out .jDN { color: var(--muted2); }
.jDayC.sel { box-shadow: inset 0 0 0 2px var(--ink2); }
.jDayC:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.jDN { font-size: calc(12.5px + var(--fs-up)); color: var(--muted); width: 22px; height: 22px; display: grid; place-items: center; margin: -2px 0 0 -3px; border-radius: 50%; }
.jDayC.today .jDN { color: var(--on-accent); background: var(--accent); font-weight: 600; }
.jDNet { position: absolute; top: 6px; right: 7px; font-size: calc(12.5px + var(--fs-up)); font-weight: 600; }
.jChips { display: grid; gap: 3px; min-width: 0; }
.jChip { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 2px 6px 2px 0; border-radius: 3px; background: color-mix(in srgb, var(--pane2) 85%, transparent); font-size: calc(11px + var(--fs-up)); line-height: 1.35; overflow: hidden; }
.jChip i { width: 3px; align-self: stretch; background: var(--sc, var(--line3)); flex: none; }
.jChip i.no { background: var(--line3); }
.jChip b { font-weight: 600; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.jChip em, .jChip > span { flex: none; }
.jChip em { font-style: normal; font-weight: 600; } .jChip em span { color: inherit; margin: 0; } .jChip.win em { color: var(--up); } .jChip.loss em { color: var(--down); } .jChip.open em, .jChip.even em { color: var(--muted); }
.jChip > span { margin-left: auto; white-space: nowrap; } .jChip.win > span { color: var(--up); } .jChip.loss > span { color: var(--down); }
.jMore { font-size: calc(11px + var(--fs-up)); color: var(--muted); padding-left: 2px; }
.jDots { display: none; gap: 3px; }
.jDots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line3); }
.jDots i.win { background: var(--up); } .jDots i.loss { background: var(--down); }
@container (max-width: 160px) { .jChip em span { display: none; } }
@container (max-width: 104px) { .jChip em { display: none; } }
@container (max-width: 96px) { .jChips { display: none; } .jDots { display: flex; } .jDNet { position: static; font-size: calc(11px + var(--fs-up)); } }
.jWkT { display: grid; align-content: start; justify-items: end; gap: 2px; padding: 8px 9px; background: var(--pane); font-size: calc(11.5px + var(--fs-up)); color: var(--muted); }
.jWkT b { font-size: calc(13px + var(--fs-up)); font-weight: 600; color: var(--ink2); } .jWkT b.up { color: var(--up); } .jWkT b.down { color: var(--down); }
.jCalWrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.jDayPane { display: grid; gap: 8px; align-content: start; position: sticky; top: 12px; padding: 12px 0 0; border-top: 1px solid var(--line2); }
@media (max-width: 1180px) { .jCalWrap { grid-template-columns: minmax(0, 1fr); } .jDayPane { position: static; } }
.jDayPane h3 { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; font-size: calc(15px + var(--fs-up)); font-weight: 600; color: var(--ink2); }
.jDayPane h3 b { font-family: var(--mono); font-weight: 500; }
.jDayPane p { margin: 0; }
.jWeek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.jWCol { display: grid; align-content: start; gap: 6px; padding: 0 6px 10px; background: var(--bg); min-height: 320px; min-width: 0; }
.jWCol.pos { background: color-mix(in srgb, var(--up) calc(var(--t) * 0.6%), var(--bg)); } .jWCol.neg { background: color-mix(in srgb, var(--down) calc(var(--t) * 0.6%), var(--bg)); }
.jWHead { display: flex; align-items: baseline; gap: 6px; margin: 0 -6px 2px; padding: 8px 8px 7px; border: 0; border-bottom: 1px solid var(--line); background: var(--pane); color: var(--muted); font: inherit; text-align: left; cursor: default; }
.jWHead b { color: var(--ink2); font-weight: 600; } .jWCol.today .jWHead b { color: var(--accent-ink); }
.jWHead em { margin-left: auto; font-style: normal; font-family: var(--mono); font-weight: 600; }
.jWTrade { display: grid; gap: 3px; text-align: left; padding: 7px 8px; border: 1px solid var(--line); border-left: 3px solid var(--line3); border-radius: 4px; background: var(--pane); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.jWTrade.win { border-left-color: var(--up); } .jWTrade.loss { border-left-color: var(--down); }
.jWTrade:hover { border-color: var(--line3); }
.jWTrade .jTop b { overflow: hidden; text-overflow: ellipsis; }
.jWLine { display: flex; justify-content: space-between; gap: 6px; font-family: var(--mono); font-size: calc(12px + var(--fs-up)); }
.jWNone { color: var(--muted2); font-size: calc(12px + var(--fs-up)); padding: 4px 2px; }

/* Gallery: chart cards */
.jGal { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.jCard { display: grid; grid-template-rows: auto 1fr; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--pane); color: var(--ink); cursor: pointer; font: inherit; overflow: hidden; min-width: 0; }
.jCard:hover { border-color: var(--line3); }
.jCardPic { display: block; aspect-ratio: 16 / 9; background: var(--bg-deep); border-bottom: 1px solid var(--line); overflow: hidden; }
.jCardPic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jPicGone { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: calc(12px + var(--fs-up)); }
.jCardBody { display: grid; gap: 5px; padding: 10px 12px 12px; }
.jCardTop { display: flex; align-items: center; gap: 7px; min-width: 0; }
.jCardTop b { color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jCardTop .jPill { margin-left: auto; }
.jCardRes { font-size: calc(20px + var(--fs-up)); font-weight: 500; color: var(--muted); letter-spacing: -0.01em; }
.jCardRes.up { color: var(--up); } .jCardRes.down { color: var(--down); }
.jCardMeta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: calc(12px + var(--fs-up)); min-width: 0; }
.jCardMeta .jTag { margin: 0; } .jSideM { display: none; }
.jLv { width: 100%; height: 100%; display: block; stroke-width: 1; }
.jLv .g { stroke: var(--line); }
.jLv .tz { fill: color-mix(in srgb, var(--up) 11%, transparent); stroke: none; } .jLv .sz { fill: color-mix(in srgb, var(--down) 11%, transparent); stroke: none; }
.jLv .tl { stroke: var(--up); stroke-dasharray: 4 4; } .jLv .sl { stroke: var(--down); stroke-dasharray: 4 4; } .jLv .el { stroke: var(--ink2); }
.jLv .pth { stroke: var(--muted); stroke-dasharray: 2 3; fill: none; } .jLv .pth.win { stroke: var(--up); } .jLv .pth.loss { stroke: var(--down); }
.jLv .ex { fill: var(--muted); stroke: var(--bg-deep); stroke-width: 2; } .jLv .ex.win { fill: var(--up); } .jLv .ex.loss { fill: var(--down); } .jLv .ex.open { fill: var(--ink2); }
.jLv text { font: 10px var(--mono); fill: var(--muted); stroke: none; }
.jLv .tt { fill: var(--up); } .jLv .st { fill: var(--down); } .jLv .et, .jLv .xt { fill: var(--ink); } .jLv .nt { font-family: var(--sans); fill: var(--muted2); }

/* Trades: the sortable list */
.jBulk { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; border-radius: 6px; background: var(--pane2); border: 1px solid var(--line2); }
.jBulk b { font-weight: 600; color: var(--ink2); margin-right: 4px; }
.jBulk button:not(.jpClear) { border: 1px solid var(--line3); background: transparent; color: var(--ink); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.jBulk button.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 50%, transparent); }
.jBulk button:not(.jpClear):hover { background: var(--pane); }
.jTbl { border-collapse: collapse; width: 100%; }
.jTbl th, .jTbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.jTbl thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); border-bottom-color: var(--line2); padding-top: 4px; padding-bottom: 4px; }
.jTbl th button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; padding: 4px 0; display: inline-flex; gap: 4px; }
.jTbl th button:hover, .jTbl th[aria-sort="ascending"] button, .jTbl th[aria-sort="descending"] button { color: var(--ink2); }
.jTbl th button i { font-style: normal; width: 10px; }
.jTbl .c-sel { width: 34px; padding-right: 0; } .jTbl input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.jTbl .c-result, .jTbl th.c-result { text-align: right; } .jTbl th.c-result button { flex-direction: row-reverse; }
.jTbl td.c-result { font-weight: 500; } .jTbl td.c-result.up { color: var(--up); } .jTbl td.c-result.down { color: var(--down); }
.jTbl td.c-strategy { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.jTbl tbody tr { cursor: pointer; }
.jTbl tbody tr:hover { background: var(--pane); }
.jTbl tbody tr.on { background: var(--mine); }
.jTbl tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.jTbl .jTop b { color: var(--ink2); }
.jpRules { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px 40px; align-items: start; max-width: 1180px; }

@media (max-width: 1000px) { .jpGrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .jpIn { padding: 14px 12px 28px; gap: 12px; }
  .jpHead h1 { font-size: 20px; }
  .jpUnits { order: 5; }
  .jpViews { gap: 18px; }
  .jpFind input { font-size: 16px; }
  .jFigs { grid-template-columns: 1fr 1fr; }
  .jFig { padding: 10px 10px 11px 0; border-left: 0; border-top: 1px solid var(--line); }
  .jFig:nth-child(odd):not(.lead) { border-left: 1px solid var(--line); padding-left: 12px; }
  .jpFilters { gap: 8px; }
  .jpSel { flex: 1 1 150px; } .jpSel select { width: 100%; max-width: none; }
  .jpFind { flex: 1 1 110px; } .jpFind input { width: 100%; }
  .jpFilters > .jpSeg { flex: 1 1 100%; } .jpFilters > .jpSeg button { flex: 1; }
  .jFig.lead { border-top: 0; padding-left: 0; }
  .jFig.lead b { font-size: 28px; }
  .jEq { height: 200px; margin-right: 40px; }
  .jWD, .jCells { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .jWD .wk, .jWkT { display: none; }
  .jWD span { padding: 6px 4px; text-align: center; }
  .jDayC { min-height: 58px; padding: 4px; gap: 3px; }
  .jDN { margin: 0; }
  .jCalNav h2 { min-width: 0; font-size: 16px; }
  .jCalSum { flex: 1 1 100%; order: 3; }
  .jWeek { grid-template-columns: minmax(0, 1fr); }
  .jWCol { min-height: 0; }
  .jGal { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .jCardRes { font-size: 16px; }
  .jCardMeta { flex-direction: column; align-items: flex-start; gap: 3px; }
  .jCardTop .jSide { display: none; } .jSideM { display: inline; }
  .jTbl .c-side, .jTbl .c-strategy { display: none; }
  .jTbl th, .jTbl td { padding: 8px 6px; }
  .jTbl .c-date .fine, .jTbl .jYr { display: none; }
  .jTbl .c-sel { width: 26px; } .jTbl td.c-pair .symIco { display: none; }
  .jTblWrap { overflow-x: auto; }
}

/* Briefing (app.js renderDetails): sections that fold, numbers first, small bars for measured rates. Colour always comes
   with an arrow or a word, so nothing depends on colour alone. Works from a narrow panel to a phone. */
#panel-details { gap: 10px; }
.bSec { border: 1px solid var(--line); border-radius: 8px; background: var(--raise); min-width: 0; }
.bHead { margin: 0; }
.bTog { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 12px; border: 0; background: none;
  cursor: pointer; text-align: left; font-size: calc(11.5px + var(--fs-up)); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-radius: 8px; }
.bTog:hover { color: var(--ink); background: var(--pane2); }
.bTog:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bTog svg { width: 16px; height: 16px; stroke-width: 1.8; transition: transform 0.15s; }
.bTog[aria-expanded="false"] svg { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .bTog svg { transition: none; } }
.bBody { display: grid; gap: 10px; padding: 2px 12px 12px; min-width: 0; }
.bBody[hidden] { display: none; }
.bSub { margin: 0; line-height: 1.45; }
.bStrong { color: var(--ink); }
.sr, .bSec .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* right now */
.bNow { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.bPair { font-weight: 600; color: var(--muted); }
.bPrice { font-size: calc(20px + var(--fs-up)); color: var(--ink2); font-weight: 600; }
.bChip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--ink); font-size: calc(12px + var(--fs-up)); white-space: nowrap; }
.bCard { display: grid; gap: 6px; padding: 10px; border-radius: 6px; background: var(--pane); border: 1px solid var(--line); }
.bRow { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.bRow b { color: var(--ink2); }
.bMeter { height: 8px; border-radius: 999px; background: var(--pane2); border: 1px solid var(--line); overflow: hidden; }
.bMeter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.bMeter.over i { background: var(--warn); }
.bStats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.bStat { display: grid; gap: 3px; align-content: start; padding: 9px 10px; border-radius: 6px; background: var(--pane); border: 1px solid var(--line); min-width: 0; }
.bStat b { color: var(--ink2); }
.bBigNum { font-size: calc(17px + var(--fs-up)); }
.bTag { justify-self: start; padding: 0 7px; border-radius: 4px; font-size: calc(11.5px + var(--fs-up)); font-weight: 600; border: 1px solid; }
.bTag.hi { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.bTag.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); background: color-mix(in srgb, var(--up) 10%, transparent); }
/* trend */
.bTrend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 5px; }
.bTrend li { display: grid; justify-items: center; gap: 1px; padding: 7px 2px; min-width: 0; border-radius: 6px; border: 1px solid var(--line); background: var(--pane); text-align: center; }
.bTf { font-weight: 600; color: var(--ink); font-size: calc(12px + var(--fs-up)); }
.bArrow { font-size: calc(18px + var(--fs-up)); line-height: 1.1; font-weight: 600; }
.bWord { font-size: calc(11px + var(--fs-up)); max-width: 100%; overflow-wrap: anywhere; }
.t-up { color: var(--up); } .t-down { color: var(--down-ink); } .t-side { color: var(--muted); }
html[data-theme="paper"] .t-down { color: var(--down); }
.bTrend li.t-up { border-color: color-mix(in srgb, var(--up) 45%, var(--line)); background: color-mix(in srgb, var(--up) 8%, var(--pane)); }
.bTrend li.t-down { border-color: color-mix(in srgb, var(--down) 45%, var(--line)); background: color-mix(in srgb, var(--down) 8%, var(--pane)); }
.bTrend li .bTf { color: var(--ink); }
.bBreaks { margin: 0; padding-left: 18px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.bBreaks b { color: var(--ink); font-weight: 600; }
.bBig { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
/* levels and patterns */
.bList { list-style: none; margin: 0; padding: 0; display: grid; }
.bLv { display: grid; gap: 6px; padding: 9px 0; border-top: 1px solid var(--line); }
.bLv:first-child { border-top: 0; padding-top: 2px; }
.bLvTop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.bLvTop > b { color: var(--ink2); }
.bQuiet { margin: 0; font-style: italic; }
.bOdds { display: grid; gap: 4px; }
.bBar { display: grid; grid-template-columns: minmax(96px, auto) minmax(40px, 1fr) 3.4em; align-items: center; gap: 8px; font-size: calc(12px + var(--fs-up)); }
.bBar > span:first-child { color: var(--muted); }
.bBar b { text-align: right; color: var(--ink2); font-weight: 600; }
.bTrack { height: 6px; border-radius: 999px; background: var(--pane2); overflow: hidden; }
.bTrack i { display: block; height: 100%; border-radius: inherit; }
.bBar.real .bTrack i { background: var(--accent); }
.bBar.rand .bTrack i { background: var(--line3); }
.bBar.rand b { color: var(--muted); }
.bVerdictRow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.bVerdict { padding: 1px 8px; border-radius: 4px; font-size: calc(12px + var(--fs-up)); font-weight: 600; border: 1px solid var(--line2); color: var(--ink); }
.bVerdict.v-more { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); }
.bVerdict.v-less { color: var(--down-ink); border-color: color-mix(in srgb, var(--down) 50%, transparent); }
html[data-theme="paper"] .bVerdict.v-less { color: var(--down); }
.bVerdict.v-few, .bVerdict.v-same { color: var(--muted); }
.bPills { display: flex; flex-wrap: wrap; gap: 4px; }
/* positions and correlations (context.js) inside its own section: its titles read as sub-headings */
.bSec .mcBox .sect h3 { text-transform: none; letter-spacing: 0; font-size: calc(13px + var(--fs-up)); color: var(--ink); }
@media (max-width: 420px) { .bBar { grid-template-columns: minmax(84px, auto) minmax(30px, 1fr) 3.2em; } .bBody { padding: 2px 10px 10px; } }

/* ── the phone app (FOREX_BOT/mobile; mobile.js adds html.native) ───────────────────────────────────────────────────
   The page runs edge to edge: the status bar, the notch and the home bar are kept clear with the safe-area insets
   (Android's WebView gets them as --safe-area-inset-* from the app, iOS as env()). Panels open full screen below the
   status bar; the rest of the phone layout is the same in a phone's browser ("phones" below). */
html.native {
  --sa-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sa-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --sa-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sa-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  -webkit-tap-highlight-color: transparent;
}
html.native body { background: var(--bg-deep); overscroll-behavior: none; }
html.native .app { padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); }
html.native .signIn { padding: calc(16px + var(--sa-t)) calc(16px + var(--sa-r)) calc(16px + var(--sa-b)) calc(16px + var(--sa-l)); }
html.native .home { top: calc(var(--tabs-h) + var(--sa-t)); padding-bottom: var(--sa-b); }
html.native .tabPage { top: calc(var(--tabs-h) + var(--sa-t)); padding-bottom: var(--sa-b); }
html.native .dialogBack.asPage { top: calc(var(--tabs-h) + var(--sa-t)); padding-bottom: var(--sa-b); }
/* panels, toasts and dialogs keep clear of the status bar and the home bar (the phone layout itself is below) */
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) and (pointer: coarse) {
  html.native .side { padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); }
  html.native .panelHead .x { width: 44px; height: 44px; }
  html.native .dialogBack:not(.asPage) { padding-top: calc(var(--sa-t) + 6vh); }
  html.native .menu > button { min-height: 40px; }
}
/* the lock screen (Face ID / fingerprint), and the sheet that offers it once */
.mLock { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px; background: var(--bg-deep); }
.mLockCard { display: grid; justify-items: center; gap: 12px; text-align: center; width: min(340px, 100%); }
.mLockCard .brand { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--pane2); color: var(--ink); }
.mLockCard .brand .mark { width: 30px; height: 30px; }
.mLockCard b { font-size: calc(19px + var(--fs-up)); color: var(--ink); }
.mLockCard p { margin: 0 0 10px; color: var(--muted); }
.mLockCard button { width: 100%; min-height: 48px; border-radius: 10px; font-size: calc(15px + var(--fs-up)); font-weight: 600; border: 0; cursor: pointer; }
.mLockCard .primary { background: var(--accent); color: var(--on-accent); }
.mLockCard .mLockOut { background: transparent; color: var(--muted); font-weight: 500; }
.mSheetBack { position: fixed; inset: 0; z-index: 250; display: grid; align-items: end; background: rgba(0, 0, 0, 0.5); }
.mSheet { display: grid; gap: 10px; padding: 22px 20px calc(18px + var(--sa-b, 0px)); background: var(--pane); border-top: 1px solid var(--line2); border-radius: 16px 16px 0 0; }
.mSheet b { font-size: calc(17px + var(--fs-up)); color: var(--ink); }
.mSheet p { margin: 0 0 6px; color: var(--muted); }
.mSheet button { min-height: 48px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--ink); font-size: calc(15px + var(--fs-up)); cursor: pointer; }
.mSheet .primary { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.siBio { min-height: 44px; border-radius: 8px; border: 1px solid var(--accent); background: transparent; color: var(--accent-ink); font-weight: 600; cursor: pointer; }

/* ── Line history (linehistory.js): the answer first, big; details folded ── */
.lhHead { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.lhHead select, .lhName { width: 100%; font-size: calc(12.5px + var(--fs-up)); }
.lhName { font-weight: 600; color: var(--ink2); }
.lhCtl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lhRange { display: inline-flex; align-items: center; gap: 4px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.lhRange input { width: 60px; }
.lhCtl .lhSeg { margin-left: auto; }   /* the time windows on the right */
.lhSeg { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.lhSeg button { border: 0; background: transparent; color: var(--muted); padding: 4px 8px; cursor: pointer; font-size: calc(12px + var(--fs-up)); }
.lhSeg button.on { background: var(--accent-soft); color: var(--accent-ink); }
.lhBody { display: grid; gap: 28px; padding-top: 4px; }
.lhBody.busy { opacity: 0.6; }
.lhCard { display: grid; gap: 26px; }
.lhBlock { display: grid; gap: 10px; }
.lhTop { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lhPill { font-weight: 600; font-size: calc(13px + var(--fs-up)); padding: 4px 10px; border-radius: 999px; background: var(--pane2); color: var(--ink2); }
.lhPill.ok { background: color-mix(in srgb, var(--up) 20%, transparent); color: var(--up); }
.lhPill.bad { background: color-mix(in srgb, var(--down) 20%, transparent); color: var(--down-ink); }
.lhCount { font-size: calc(12.5px + var(--fs-up)); color: var(--muted); } .lhCount b { color: var(--ink2); font-size: calc(15px + var(--fs-up)); }
.lhSay { margin: 0; font-size: calc(15px + var(--fs-up)); line-height: 1.4; color: var(--ink2); }
.lhTiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lhTile { display: grid; gap: 3px; padding: 12px 8px; border-radius: 8px; background: var(--pane2); border-top: 3px solid var(--muted2); text-align: center; }
.lhTile b { font-size: calc(24px + var(--fs-up)); line-height: 1.1; font-family: var(--mono); }
.lhTile span { font-size: calc(12px + var(--fs-up)); color: var(--ink); }
.lhTile small { font-size: calc(11px + var(--fs-up)); color: var(--muted); }
.lhTile.ok { border-top-color: var(--up); } .lhTile.ok b { color: var(--up); }
.lhTile.bad { border-top-color: var(--down); } .lhTile.bad b { color: var(--down-ink); }
.lhTile.mid { border-top-color: var(--warn); } .lhTile.mid b { color: var(--warn); }
.lhCompare { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center; }
.lhStack { display: flex; height: 20px; border-radius: 5px; overflow: hidden; gap: 1px; background: var(--line); }
.lhStack.faint { height: 12px; opacity: 0.55; }
.lhHint { margin: 0; line-height: 1.45; }
.lhStack i { display: grid; place-items: center; font-style: normal; font-size: calc(11px + var(--fs-up)); font-weight: 600; color: #fff; min-width: 2px; }
.lhStack.faint i { font-size: 0; }
.ok.lhDot, .lhStack i.ok { background: var(--up); } .bad.lhDot, .lhStack i.bad { background: var(--down); }
.mid.lhDot, .lhStack i.mid { background: var(--warn); color: #1a1405; } .none.lhDot, .lhStack i.none { background: var(--muted2); }
.lhVerdict { margin: 0; padding: 12px 14px; line-height: 1.45; border-radius: 6px; background: var(--pane2); border-left: 3px solid var(--muted2); }
.lhVerdict.ok { border-left-color: var(--up); } .lhVerdict.bad { border-left-color: var(--down); }
.lhStrip { display: grid; gap: 6px; padding-bottom: 18px; position: relative; }
.lhLane { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); align-items: center; gap: 6px; }
.lhLaneT { font-size: calc(11px + var(--fs-up)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lhLaneTrack { position: relative; height: 14px; border-bottom: 1px dashed var(--line2); }
.lhDot { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; opacity: 0.85; }
.lhDot:hover, .lhDot.on { opacity: 1; outline: 2px solid var(--ink2); outline-offset: 1px; z-index: 1; }
.lhYears { position: absolute; left: calc(7.5em + 6px); right: 0; bottom: 0; height: 14px; }
.lhYears span { position: absolute; transform: translateX(-50%); font-size: calc(10.5px + var(--fs-up)); color: var(--muted); }
.lhRules summary { cursor: pointer; color: var(--accent-ink); font-size: calc(12.5px + var(--fs-up)); }
.lhVizHead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; }
.lhYChart { display: flex; align-items: stretch; justify-content: center; gap: 3px; height: 150px; padding-top: 4px; }
.lhYCol { flex: 1; min-width: 0; max-width: 56px; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 3px; border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 6px; color: var(--muted); }
.lhYCol:disabled { cursor: default; }
.lhYCol:not(:disabled):hover .lhYBar, .lhYCol.on .lhYBar { outline: 2px solid var(--ink2); outline-offset: 1px; }
.lhYCol.on .lhYL { color: var(--ink2); font-weight: 600; }
.lhYN { font-size: calc(10.5px + var(--fs-up)); text-align: center; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.lhYArea { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.lhYBar { display: flex; flex-direction: column; gap: 1px; border-radius: 4px 4px 2px 2px; overflow: hidden; min-height: 0; }
.lhYBar i { display: block; min-height: 2px; }
.lhYBar i.ok { background: var(--up); } .lhYBar i.bad { background: var(--down); } .lhYBar i.mid { background: var(--warn); } .lhYBar i.none { background: var(--muted2); }
.lhYCol .lhYL { font-size: calc(10.5px + var(--fs-up)); text-align: center; border-top: 1px solid var(--line2); padding-top: 4px; white-space: nowrap; }
.lhYChart.many { height: 175px; }
.lhYChart.many .lhYL { writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; border-top: 0; padding: 4px 0 0; line-height: 1; }
.lhYChart.many .lhYCol { gap: 2px; }
.lhLegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: calc(12px + var(--fs-up)); color: var(--muted); }
.lhLegend span { display: inline-flex; align-items: center; gap: 6px; }
.lhLegend i { width: 10px; height: 10px; border-radius: 3px; }
.lhLegend i.ok { background: var(--up); } .lhLegend i.bad { background: var(--down); } .lhLegend i.mid { background: var(--warn); } .lhLegend i.none { background: var(--muted2); }
.lhChips .lhYearX { border-color: var(--accent); color: var(--accent-ink); }
.lhRules { padding-top: 14px; border-top: 1px solid var(--line); }
.lhRules ul { margin: 10px 0; padding-left: 18px; display: grid; gap: 6px; }
.lhRules p { line-height: 1.5; }
.lhLevels { width: 100%; font-size: calc(12px + var(--fs-up)); }
.lhLevels tr[data-lhlevel] { cursor: pointer; } .lhLevels tr.on { background: var(--accent-soft); }
.lhH { margin: 0; font-size: calc(11.5px + var(--fs-up)); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.lhVisits { display: grid; gap: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.lhVHead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; min-width: 0; }
.lhStep { display: inline-flex; align-items: center; gap: 2px; }
.lhStep button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.lhStep button:hover:not(:disabled) { background: var(--pane2); }
.lhStep button:disabled { opacity: 0.3; cursor: default; }
.lhStep svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lhPos { min-width: 4.5em; text-align: center; font-size: calc(12.5px + var(--fs-up)); color: var(--muted); font-variant-numeric: tabular-nums; }
.lhChips { display: flex; flex-wrap: wrap; gap: 6px; }
.lhChips button { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: calc(12.5px + var(--fs-up)); transition: background 0.15s, color 0.15s, border-color 0.15s; }
.lhChips button:hover { color: var(--ink2); border-color: var(--line3); }
.lhChips button.on { background: var(--ink2); color: var(--pane); border-color: var(--ink2); font-weight: 600; }
.lhList { display: grid; gap: 6px; min-width: 0; }
.lhVisits, .lhCard, .lhBody { min-width: 0; }
.lhRow { display: flex; align-items: center; gap: 4px; padding-right: 8px; border-radius: 12px; background: transparent; border: 1px solid var(--line2); transition: border-color 0.15s; }   /* a frame only */
.lhRow:hover { border-color: var(--line3); }
.lhRow.on { border-color: var(--accent); }
.lhShow { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 10px 4px 10px 10px; cursor: pointer; border-radius: 12px; }
.lhIco { flex: none; display: grid; place-items: center; width: 26px; height: 26px; color: var(--muted); }   /* just the sketch, no box */
.lhIco svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lhIco circle { fill: currentColor; }
.lhIco.ok { color: var(--up); }
.lhIco.bad { color: var(--down-ink); }
.lhIco.mid { color: var(--warn); }
.lhMain { flex: 1; min-width: 0; display: grid; gap: 2px; }
.lhTitle { font-weight: 600; color: var(--ink2); font-size: calc(13.5px + var(--fs-up)); line-height: 1.25; }
.lhMeta { font-size: calc(12px + var(--fs-up)); color: var(--muted); line-height: 1.3; }
.lhMoves { flex: none; display: grid; gap: 3px; justify-items: end; font-family: var(--mono); font-size: calc(12px + var(--fs-up)); font-variant-numeric: tabular-nums; }
.lhMoves .up { color: var(--up); } .lhMoves .dn { color: var(--down-ink); }
.lhWatch { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 1.5px solid var(--accent); border-radius: 50%; background: transparent; color: var(--accent-ink); cursor: pointer; transition: transform 0.15s, background 0.15s, color 0.15s; }   /* an outlined circle */
.lhWatch:hover { background: var(--accent); color: var(--on-accent); transform: scale(1.06); }
.lhWatch svg { width: 16px; height: 16px; fill: currentColor; margin-left: 2px; }
.lhOut.ok { color: var(--up); } .lhOut.bad { color: var(--down-ink); } .lhOut.mid { color: var(--warn); } .lhOut.none { color: var(--muted); }
.lhStart { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) { .floatbar .fbText span { display: none; } .lhShow { min-height: 56px; } .lhWatch { width: 40px; height: 40px; } .lhDot { width: 12px; height: 12px; margin-left: -6px; top: 1px; } }

/* ── phones: the chart gets the screen (app.js phone section) ────────────────────────────────────────────────────────
   The same two queries as app.js PHONE_Q: up to 640px wide, or a touch screen on its side up to 500px tall. The tab
   strip (while a chart is on screen), the bottom bar, the panels' bar and the drawing tools give their room to the chart;
   one toolbar row stays; ☰ opens a sheet with the rest. Full screen (html.mFull) leaves the chart alone. */
.mOnly, .mFullExit { display: none; }
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) and (pointer: coarse) {
  html:root { --bot-h: 0px; }
  html:root:not(.mPage) { --tabs-h: 0px; }
  html:root:not(.mPage) .tabStrip { display: none; }
  .app { grid-template-columns: 0 minmax(0, 1fr) 0; grid-template-rows: var(--tabs-h) var(--top-h) minmax(0, 1fr) 0;
    grid-template-areas: "tabs tabs tabs" "top top top" "tools chart icons" "bottom bottom bottom"; }
  html.mTools .app { grid-template-columns: var(--rail-w) minmax(0, 1fr) 0; }
  html:not(.mTools) .tools { visibility: hidden; border: 0; padding: 0; }
  .iconbar, .bottombar { display: none; }
  /* the toolbar: symbol, interval, chart type, indicators, layers · pencil, full screen, ☰ */
  .toolbar { gap: 2px; padding: 0 4px; }
  .toolbar > * { order: 30; }
  .toolbar #symbolBtn { order: 1; padding: 0 8px 0 6px; gap: 4px; }
  .toolbar #intervals { order: 2; }
  .toolbar #chartTypeBtn { order: 3; }
  .toolbar #indicatorsBtn { order: 4; }
  .toolbar #overlaysBtn { order: 5; }
  .toolbar #alertBtn { order: 6; }
  .toolbar #replayBtn { order: 7; }
  .toolbar .grow { order: 8; display: block; flex: 1 0 0; }
  .toolbar #mToolsBtn { order: 9; }
  .toolbar #fullBtn { order: 10; display: flex !important; }
  .toolbar #mMoreBtn { order: 11; }
  .toolbar :is(#homeBtn, #paletteBtn, #compareBtn, #layoutBtn, #alertBtn, #replayBtn, #undoBtn, #redoBtn, #layoutSaveBtn, #modeTag, #planBtn, #askBtn, #settingsBtn, #shareBtn, #shotBtn, .sep) { display: none !important; }
  .toolbar :is(#indicatorsBtn, #overlaysBtn, #alertBtn, #replayBtn) { width: var(--tb-h); padding: 0; justify-content: center; }
  .toolbar :is(#indicatorsBtn, #overlaysBtn, #alertBtn, #replayBtn) span { display: none; }
  .mOnly { display: flex; }
  #mToolsBtn.on, #mMoreBtn.on { color: var(--accent-ink); background: var(--accent-soft); }
  #mMoreBtn { position: relative; }
  #mMoreBtn.dot::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--down); box-shadow: 0 0 0 2px var(--bg); }
  /* on the chart: the name, layers and the sell / buy box on one line; open, high, low, close while the crosshair is out */
  .legend { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; top: 4px; left: 6px; max-width: calc(100% - var(--axis-w, 60px) - 12px); }
  .legend > .row { flex: 1 0 100%; }
  .legend > .row:first-child, .legend > .row.quote { flex: none; }
  .legend .row .fine { display: none; }
  .legend .title { font-size: 13px; }
  .legend .layersChip { padding: 0 6px; font-size: 10.5px; }
  .legend .ohlc:not(.hov) { display: none; }
  .legend .ohlc { font-size: 10px; }
  .legend .row.quote { margin: 0; gap: 3px; }
  .legend .quote button { display: inline-flex; align-items: baseline; gap: 4px; padding: 1px 6px; font-size: 12px; line-height: 16px; }
  .legend .quote button small { font-size: 8.5px; }
  .legend .quote .spr { font-size: 10px; }
  .chartMark { font-size: 12px; gap: 5px; opacity: 0.45; }
  .chartMark svg { width: 18px; height: 16px; }
  /* full screen: the chart alone, the button at its top right brings the bars back */
  html.mFull:root { --tabs-h: 0px; --top-h: 0px; }
  html.mFull .tabStrip, html.mFull .toolbar { display: none; }
  html.mFull .app { grid-template-columns: 0 minmax(0, 1fr) 0; }
  html.mFull .tools { visibility: hidden; }
  html.mFull .mFullExit { display: grid; }
}
@media (max-width: 640px) {
  .toolbar .intervals button[data-tf]:not(.on) { display: none; }      /* the interval in use; ▾ has them all */
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) and (pointer: coarse) {
  html:root { --top-h: 40px; --tb-h: 34px; --tb-icon: 19px; --tb-font: 13px; --rail-w: 40px; --btn: 34px; --icon: 20px; }
  .toolbar :is(#alertBtn, #replayBtn) { display: flex !important; }
  .toolbar .intervals button { padding: 0 7px; }
  /* panels open as a drawer on the right, the chart still in sight */
  .side { position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(420px, 62vw); height: auto; z-index: 50; box-shadow: -10px 0 30px rgba(0, 0, 0, 0.45); }
}
.mFullExit { position: absolute; top: 8px; right: calc(var(--axis-w, 60px) + 8px); z-index: 8; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line2);
  background: color-mix(in srgb, var(--pane) 88%, transparent); color: var(--ink2); place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.mFullExit svg { width: 20px; height: 20px; }
/* the ☰ sheet: from the bottom upright, from the right on its side */
.mMoreBack { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.45); }
.mMore { width: 100%; max-height: 82vh; max-height: 82dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--pane); border-top: 1px solid var(--line2);
  border-radius: 16px 16px 0 0; padding: 0 12px calc(14px + var(--sa-b, 0px)); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4); }
@media (orientation: landscape) and (max-height: 500px) {
  .mMoreBack { justify-content: flex-end; align-items: stretch; }
  .mMore { width: min(440px, 72vw); max-height: none; height: 100%; border-radius: 0; border-top: 0; border-left: 1px solid var(--line2);
    padding: calc(var(--sa-t, 0px)) calc(12px + var(--sa-r, 0px)) calc(14px + var(--sa-b, 0px)) 12px; }
}
.mmHead { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 0; background: var(--pane); border-bottom: 1px solid var(--line); }
.mmMe { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: inherit; text-align: left; padding: 4px; border-radius: 10px; cursor: pointer; }
.mmMe:active { background: var(--pane2); }
.mmAv { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.mmAv > * { width: 100%; height: 100%; object-fit: cover; }
.mmWho { display: grid; min-width: 0; }
.mmWho b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink2); }
.mmWho small { color: var(--muted); font-size: 12px; }
.mmClock { color: var(--muted); font-size: 12px; white-space: nowrap; }
.mmX { width: 40px; height: 40px; font-size: 24px; flex: none; }
.mmSec { padding: 10px 0 4px; }
.mmSec h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.mmGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; }
.mmTile { position: relative; display: grid; justify-items: center; align-content: start; gap: 5px; min-height: 64px; padding: 9px 2px 6px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); cursor: pointer; font-size: 11.5px; line-height: 1.2; text-align: center; }
.mmTile:hover, .mmTile:active { background: var(--pane2); }
.mmTile.on { color: var(--accent-ink); background: var(--accent-soft); }
.mmTile svg { width: 22px; height: 22px; }
.mmTile span { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mmBadge { position: absolute; top: 4px; right: calc(50% - 24px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--down); color: #fff; font: normal 700 10px/16px var(--sans); }
.mmChips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.mmChips button { min-width: 44px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; font-size: 13px; }
.mmChips button.on { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.mmScale { margin-top: 8px; }
.mmScale span { color: var(--muted); font-size: 12px; margin-right: 4px; }
.mmTabs { display: grid; gap: 4px; }
.mmTab { display: flex; align-items: center; border-radius: 10px; background: var(--pane2); }
.mmTab.on { box-shadow: inset 0 0 0 1px var(--accent); }
.mmTabGo { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.mmTabGo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mmTabGo svg { width: 18px; height: 18px; }
.mmTabX { width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; flex: none; }

/* ── pop-up notices (app.js "pop-up notices", index.html #nTop / #nBot) ──────────────────────────────────────────────
   Glass cards in two docks so several stack: top (can't reach, a call, messages) under the toolbar, bottom (alerts,
   notes, plan, newer version) above the bottom bar. A small coloured icon says the kind. Phones: full width less 12px,
   inside the safe area, never over the toolbar. Without backdrop-filter the card is solid. */
.nDock { position: fixed; z-index: 130; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 24px)); right: calc(var(--rail-w) + 14px); pointer-events: none; }
.nDock > * { pointer-events: auto; }
.nTop { top: calc(var(--tabs-h) + var(--top-h) + 10px); }
.nBot { bottom: calc(var(--bot-h) + 12px); justify-content: flex-end; }
@media (min-width: 900px) { body:has(#side:not(.closed)) .nBot { right: calc(var(--rail-w) + var(--side-w, 370px) + 14px); } }
.nTop > #netBar { order: 0; } .nTop > .rtcRing { order: 1; } .nTop > .msgToasts { order: 2; }
.nBot > .alPops { order: 0; } .nBot > .toasts { order: 1; } .nBot > #planBar { order: 2; } .nBot > #updateBar { order: 3; }
.nDock .toasts, .nDock .alPops, .nDock .msgToasts { position: static; display: grid; gap: 8px; width: auto; right: auto; bottom: auto; top: auto; }
.nDock .toasts { justify-items: end; pointer-events: none; }
.nDock .toasts > .nCard { max-width: 100%; }
.nCard { --nk: var(--accent); position: static; transform: none; display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; width: auto; margin: 0;
  padding: 10px 12px; color: var(--ink); text-align: left; font-size: calc(13px + var(--fs-up)); line-height: 1.4;
  --n-sub: color-mix(in srgb, var(--ink) 78%, var(--pane));
  background: color-mix(in srgb, var(--pane) 84%, transparent); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 15px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: nIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); pointer-events: auto; touch-action: none; }
html[data-theme="paper"] .nCard { background: color-mix(in srgb, var(--pane) 86%, transparent); border-color: rgba(12, 17, 14, 0.09); box-shadow: 0 12px 30px rgba(20, 30, 25, 0.16); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .nCard { background: var(--pane); } }
.nCard.k-ok, .nCard.k-update, .nCard.k-plan { --nk: var(--accent); } .nCard.k-info { --nk: var(--st-sky); } .nCard.k-warn, .nCard.k-alert { --nk: var(--warn); }
.nCard.k-err { --nk: var(--down); } .nCard.k-muted { --nk: var(--muted); } .nCard.k-call { --nk: var(--up); }
.nIco { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: var(--nk); background: color-mix(in srgb, var(--nk) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nk) 26%, transparent); }
.nIco svg { width: 18px; height: 18px; stroke-width: 1.7; }
.nText { flex: 1 1 190px; min-width: 0; display: grid; gap: 1px; overflow-wrap: anywhere; }
.nText b { color: var(--ink2); font-weight: 600; }
.nText small { color: var(--n-sub); font-size: calc(12px + var(--fs-up)); }
.nBtns { display: flex; gap: 6px; margin-left: auto; flex: none; align-items: center; }
.nCard.updateBar { flex-wrap: wrap; }
.nCard.updateBar a.primary { padding: 6px 12px; border-radius: 9px; }
.nCard .nX { width: 32px; height: 32px; padding: 0 !important; font-size: 18px; border: 0 !important; color: var(--muted) !important; }
.nCard.alPop { display: grid; padding: 10px 12px 12px; }
.alPop .alPopHead .nIco { width: 28px; height: 28px; }
.nCard.msgToast, .nCard.rtcRing { width: auto; max-width: 100%; cursor: pointer; }
.nCard.nDrag { animation: none; transition: none; }
.nCard.nOut { animation: nOut 0.2s ease-in forwards; pointer-events: none; }
.nTop .nCard { --n-from: -10px; }
@keyframes nIn { from { opacity: 0; transform: translateY(var(--n-from, 10px)) scale(0.98); } }
@keyframes nOut { to { opacity: 0; transform: translateY(var(--n-from, 10px)) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .nCard, .nCard.nOut { animation: none; } }
/* phones (app.js PHONE_Q): full width less 12px, centred and capped on its side, inside the safe area */
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) and (pointer: coarse) {
  .nDock { width: auto; left: max(calc(12px + var(--sa-l, 0px)), calc(50% - 240px)); right: max(calc(12px + var(--sa-r, 0px)), calc(50% - 240px)); }
  .nTop { top: calc(var(--sa-t, 0px) + var(--tabs-h) + var(--top-h) + 8px); }
  html.mFull .nTop { top: calc(var(--sa-t, 0px) + 56px); }
  .nBot, html.native .nBot { bottom: calc(var(--sa-b, 0px) + 12px); }
  .nDock .toasts { justify-items: stretch; }
  .nCard .nBtns button, .nCard .nBtns a.primary { min-height: 36px; }
  .nDock .toasts > :nth-last-child(n+3), .nDock .alPops > :nth-last-child(n+3), .nDock .msgToasts > :nth-last-child(n+3) { display: none; }
}
/* a call shown big: the cards keep clear of its name bar and its buttons */
html.rtcBigOn .nTop { top: calc(var(--sa-t, 0px) + 56px); }
html.rtcBigOn .nBot { bottom: calc(var(--sa-b, 0px) + 84px); }
.rtcRing .msgAv { flex: none; width: 44px; height: 44px; font-size: 15px; }
.nDock .nFold { display: none !important; }
/* secondary lines inside a card: lighter than --muted so they keep 4.5:1 over anything the glass shows through */
.nCard small, .nCard .alPopTime { color: var(--n-sub); }
