/* Own visual identity. Deliberately NOT Exocharts' palette: they use blue=buy / red=sell on a
   near-black ground with their bundled condensed face. This is green/red on a cool dark ground.
   The LAYOUT follows theirs; the look does not.

   Two rules do most of the work in making this read as an application rather than a web page:

   1. Chrome is unselectable and takes a default cursor. Being able to drag-select the word "Tick"
      out of a toolbar is the single loudest tell that something is a document pretending to be a
      tool. Data stays selectable, because copying a number is a real thing to want.

   2. Labels are set in the UI face, numbers in tabular monospace. A trading screen is read by
      scanning columns of digits; when the digits are proportional the columns wobble and the eye
      has to re-find the decimal point on every row. Mono everywhere is the other failure mode -
      it reads as a terminal hobby project rather than a product.

   The type scale is three sizes and the radius is 2px everywhere. Restraint is the whole effect:
   more sizes and rounder corners is what "generated" looks like. */

:root {
  /* A NEUTRAL near-black ground, not a blue-tinted one. The cool slate ramp that ships as the
     default in every CSS framework is the single most recognisable "generated" signature; real
     desk tools sit on neutral grey so that the only colour on screen is data. */
  --bg: #0f0f11;
  --panel: #151517;
  --panel-2: #1b1b1e;
  --panel-3: #232327;
  --line: #252529;
  --line-2: #33333a;
  --grid: #1a1a1d;

  --ink: #e6e6e8;
  --ink-dim: #989ba3;
  --ink-faint: #6b6e76;

  /* Buy and sell are a true green and a true red, not mint and coral. Pastel market colours read
     as decoration; these read as a position. */
  --buy: #21924f;
  --buy-hi: #35c46f;
  --sell: #c2382f;
  --sell-hi: #e85449;

  /* Selection and focus are NEUTRAL. There is deliberately no brand accent in the chrome: the
     moment an active tab is brand-blue, the thing reads as a web app rather than an instrument.
     Colour is spent on data only. */
  --sel: #26262b;
  --focus: #9aa0a6;

  /* Segoe UI Variable is the current native Windows face and the reason the chrome reads as part
     of the OS rather than as a web page; the rest of the stack covers everything else. */
  --ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, system-ui, Roboto,
        "Helvetica Neue", Arial, sans-serif;
  /* Display cut, for the few places set larger than body text. */
  --ui-display: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI",
        -apple-system, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* three sizes, no more */
  --t-xs: 10px;
  --t-sm: 11px;
  --t-md: 12px;

  /* Two radii, like a current native OS: small on controls, larger on floating surfaces.
     2px everywhere was the 2011 read - flat colour and quiet borders stay, the corners soften. */
  --r: 5px;
  --r-surface: 9px;

  /* chrome band heights, kept in one place so the chart's share of the screen is a decision
     rather than an accident */
  --h-menu: 24px;
  --h-tabs: 25px;
  --h-bar: 32px;
  --h-info: 22px;
  --h-status: 20px;
}

/* Interaction feel: one fast linear transition everywhere. Eased or bouncy transitions on a
   control that reports market state make the state look uncertain. */
button,
select,
input {
  transition: background-color .08s linear, color .08s linear, border-color .08s linear;
}
:focus { outline: none; }
:focus-visible { outline: 1px solid var(--focus); outline-offset: -1px; }
::selection { background: var(--sel); }

/* thin, quiet scrollbars instead of the OS defaults */
* { scrollbar-width: thin; scrollbar-color: #26303e transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
*::-webkit-scrollbar-track { background: transparent; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: var(--t-md)/1.5 var(--ui);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

/* A column flex, not a fixed grid template. A template of `auto auto auto auto 1fr auto` assumes
   exactly six visible children forever; hide one and the 1fr row is orphaned, leaving a band of
   background where the chart should be. Flex makes no such assumption. */
body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
body > .stage { flex: 1 1 auto; min-height: 0; }

/* Chrome does not behave like text. Data does. */
.menubar,
.tabs,
.bar,
.rail,
.statusbar,
.tape-head,
.win-head,
.set-tabs,
.set-nav,
.set-crumb,
.ctxmenu {
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}
.info,
.tape-rows,
.set-page,
.symlist { user-select: text; }

/* Every figure lines up in its column - through TABULAR FIGURES in the UI face, not by switching
   to a fixed-width one. A monospace price list reads as a code listing; a tabular sans reads as a
   chart, and the columns are just as straight. */
.info b,
.stat b,
.sb b,
.val,
.tape-row,
.s-days,
.s-range,
.im-abbrev,
.tpl-meta,
.ot-where,
.ip-sym,
.ip-meta,
input[type="number"] {
  font-family: var(--ui);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* The hex field stays monospace: it is a CODE, not a quantity, and the fixed width is what makes
   a mistyped digit visible. */
.cf-hex { font-family: var(--mono); }

/* --------------------------------------------------------------- menu bar */

.menubar {
  display: flex;
  align-items: center;
  gap: 0;
  height: var(--h-menu);
  padding: 0 4px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.menubar::-webkit-scrollbar { display: none; }

.mi {
  font: inherit;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  padding: 0 9px;
  height: 100%;
  border-radius: 0;
  cursor: pointer;
}
.mi:hover { color: var(--ink); background: var(--panel-2); }
.mi.on { color: var(--ink); background: var(--panel-3); }

.conn { display: inline-flex; gap: 10px; align-items: center; flex: 0 0 auto; padding-left: 4px; }
.conn i {
  font-style: normal;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--t-xs);
}
.conn i::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-faint);
}
.conn i.up { color: var(--ink-dim); }
.conn i.up::before {
  background: var(--buy-hi);
}

/* The build, centred between two spacers. Quiet on purpose: it is there to be found when
   something looks wrong, not to be read every day. */
.appver {
  flex: 0 0 auto;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  letter-spacing: .02em;
  white-space: nowrap;
}

.stat-sep { width: 1px; height: 12px; background: var(--line); margin: 0 8px; flex: 0 0 auto; }
.stat {
  color: var(--ink-faint);
  font-size: var(--t-xs);
  flex: 0 0 auto;
  margin-left: 11px;
}
.stat b { color: var(--ink-dim); font-weight: 400; }

/* ------------------------------------------------------- stage + left rail */

.stage { display: flex; min-height: 0; overflow: hidden; }

.rail {
  flex: 0 0 auto;
  width: 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 2px 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail button {
  font: inherit;
  font-size: var(--t-xs);
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  padding: 6px 0 6px 2px;
  cursor: pointer;
}
.rail button:hover { color: var(--ink); background: var(--panel-2); }
.rail button.on {
  color: var(--ink);
  background: var(--sel);
  border-left-color: var(--line-2);
}

/* Drawing tools sit above the plugin toggles; the rule keeps two different kinds of control from
   reading as one list. A tool ARMS the pointer, a plugin toggles something on the chart. */
.rail button.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 0 5px 2px;
  color: var(--ink-faint);
}
.rail button.tool:hover { color: var(--ink); background: var(--panel-2); }
.rail button.tool.on {
  color: var(--ink);
  background: var(--sel);
  border-left-color: var(--line-2);
}
.rail-sep {
  height: 1px;
  margin: 5px 5px 5px 4px;
  background: var(--line);
  flex: 0 0 auto;
}

/* Rail tooltip. The native title attribute takes a second to appear and cannot put the shortcut
   on its own line, and a tool palette is exactly where someone is hunting for a shortcut. */
.railtip {
  position: fixed;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 18px rgba(0, 0, 0, .4);
  color: var(--ink);
  font-size: var(--t-sm);
  white-space: nowrap;
  pointer-events: none;
}
.railtip b {
  color: var(--ink-faint);
  font-weight: 400;
  font-family: var(--mono);
  font-size: var(--t-xs);
}

/* With a note the tip becomes two lines: the name and its shortcut on the first, what the thing is
   FOR underneath. A single row cannot carry both, and the note is the half worth reading - the
   toolbar labels are abbreviations chosen to fit, so expanding one is not the same as explaining
   it. Capped in width so a note wraps rather than running off a narrow window. */
.railtip.has-note {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 10px;
  max-width: 300px;
  white-space: normal;
}
.railtip.has-note i {
  grid-column: 1 / -1;
  color: var(--ink-dim);
  font-size: var(--t-xs);
  font-style: normal;
  line-height: 1.45;
}

/* indicator toggles in the toolbar */
.toggles { display: inline-flex; gap: 0; flex: 0 0 auto; }
.toggles button {
  font: inherit;
  font-size: var(--t-sm);
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 5px 7px 3px;
  cursor: pointer;
}
.toggles button:hover { color: var(--ink-dim); background: var(--panel-2); }
.toggles button.on { color: var(--ink); border-bottom-color: var(--line-2); }

/* ------------------------------------------------------------- status bar */

.statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--h-status);
  padding: 0 9px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: var(--t-xs);
  color: var(--ink-faint);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.statusbar::-webkit-scrollbar { display: none; }
.sb { flex: 0 0 auto; }
/* The status bar's one button: a quiet text control in the bar's own type, not a pill. */
.sb-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 18px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
  cursor: pointer;
}
.sb-btn:hover { color: var(--ink); border-color: var(--line); background: var(--panel-2); }
.sb-btn svg { width: 11px; height: 11px; }
.sb b { color: var(--ink-dim); font-weight: 400; }
.sb.dim { color: #39424e; }
/* The readouts are BUTTONS: same type and colour as the labels they replaced, plus a hover lift
   and a chevron on the two that open dropdowns - the reference's own status bar grammar. */
button.sb {
  height: 18px;
  padding: 0 6px;
  margin: 0 -2px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button.sb:hover { color: var(--ink); background: var(--panel-2); }
button.sb:hover b { color: var(--ink); }
.sb-chev { color: var(--ink-faint); font-size: 10px; margin-left: 3px; }
button.sb:hover .sb-chev { color: var(--ink); }

/* ------------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: var(--h-tabs);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  font: inherit;
  font-size: var(--t-sm);
  color: var(--ink-faint);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 11px;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
}
.tab:hover { color: var(--ink-dim); background: var(--panel); }
.tab.on { color: var(--ink); background: var(--panel); }
/* the active tab is joined to the toolbar below it by a break in the border, the way a real
   tab strip works - a coloured underline alone reads as a nav bar */
.tab.on::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--panel);
}
/* The active tab is identified by being lifted out of the strip - lighter ground, joined to the
   toolbar below - not by a coloured underline. A brand bar across the top of a tab is a nav
   pattern from the web, not a tab pattern from an application. */
.tab.on::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--line-2);
}
.tab-label { overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.tab-x { color: var(--ink-faint); font-size: var(--t-md); line-height: 1; }
.tab-x:hover { color: var(--sell-hi); }
.tab-add { color: var(--ink-faint); padding: 0 12px; font-size: var(--t-md); }

/* ---------------------------------------------------------------- toolbar */

.bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 7px;
  background: var(--bg);
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.bar::-webkit-scrollbar { display: none; }

.ctl {
  font: inherit;
  font-size: var(--t-sm);
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex: 0 0 auto;
}
.ctl:hover { color: var(--ink); background: var(--panel-2); }
.ctl:active { background: var(--panel-3); }
.ctl.strong {
  font-family: var(--ui-display);
  letter-spacing: -.01em;
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
  background: var(--panel-2);
}
.ctl.strong:hover { background: var(--panel-3); }
.ctl.dim { color: var(--ink-faint); }
.ctl.dim:hover { color: var(--ink-dim); }
.ctl.tiny { padding: 0 5px; color: var(--ink-faint); font-family: var(--mono); }
.ctl.tiny:hover { color: var(--ink); background: var(--panel-3); }
.ctl.icon { padding: 0 6px; font-size: var(--t-md); color: var(--ink-faint); }
.ctl.icon:hover { color: var(--ink); }
.ctl.date {
  color-scheme: dark;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: var(--t-sm);
  width: 112px;
  padding: 0 4px;
}
.ctl.date::-webkit-calendar-picker-indicator { opacity: .4; }
.ctl.date:hover { color: var(--ink); }

.div { width: 1px; height: 16px; background: var(--line); opacity: .6; flex: 0 0 auto; margin: 0 6px; }
.spacer { flex: 1 1 auto; }

/* the tick stepper reads as one object, not three loose buttons */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex: 0 0 auto;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.cap { color: var(--ink-faint); font-size: var(--t-sm); padding: 0 6px 0 7px; }
.stepper .ctl { border-radius: 0; border: 0; height: 100%; }
/* A typable field that does not look like a form field until you are in it: the toolbar reads as
   a strip of values, and a boxed input in the middle of it would read as the odd one out. */
.val {
  width: 44px;
  min-width: 44px;
  height: 100%;
  text-align: center;
  color: var(--ink);
  font-size: var(--t-sm);
  font-family: var(--mono);
  padding: 0 2px;
  background: transparent;
  border: 0;
  outline: none;
}
.val:hover { background: var(--panel-2); }
.val:focus { background: var(--bg); color: var(--ink); }
/* the native number spinners duplicate the +/- buttons either side of this */
.val::-webkit-outer-spin-button,
.val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.val { -moz-appearance: textfield; appearance: textfield; }

/* A clamped tick is drawing a coarser row than the number claims, so the number says so. */
.val.clamped { color: #d0a05a; }

.meta { color: var(--ink-faint); font-size: var(--t-sm); flex: 0 0 auto; }
.live.on {
  color: var(--buy-hi);
  border: 1px solid #2c4a38;
  border-radius: var(--r);
  padding: 1px 5px;
  font-size: var(--t-xs);
  
}

/* ------------------------------------------------------------------- info */

.info {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 14px;
  padding: 0 11px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
  white-space: nowrap;
  height: var(--h-info);
  align-items: center;
}
.info::-webkit-scrollbar { display: none; }
.info span { display: inline-flex; gap: 5px; align-items: baseline; }
.info i { color: var(--ink-faint); font-style: normal; font-size: var(--t-sm); }
.info b { font-weight: 600; color: var(--ink); }
.muted { color: var(--ink-faint); }
.pos { color: var(--buy-hi); }
.neg { color: var(--sell-hi); }

main { position: relative; overflow: hidden; flex: 1 1 auto; min-width: 0; }
main canvas { width: 100%; }

/* ------------------------------------------------------------------- tape */

.tape {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  font-size: var(--t-sm);
  overflow: hidden;
}
.tape-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 4px 8px;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
  font-size: var(--t-xs);
}
.tape-rows { overflow: hidden; }
.tape-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 1px 8px;
  font-size: var(--t-sm);
}
.tape-row.buy { color: var(--buy-hi); }
.tape-row.sell { color: var(--sell-hi); }
.tape-row.big { background: var(--panel-3); font-weight: 600; }
.tape-row .t { color: var(--ink-faint); }
canvas { display: block; height: 100%; touch-action: none; cursor: crosshair; }

.axis {
  padding: 4px 9px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: var(--t-sm);
  min-height: 22px;
  overflow: hidden;
  white-space: nowrap;
}

/* ------------------------------------------------------------ context menu */

/* Motion, one rule: floating surfaces ARRIVE - a 100ms fade with a 4px rise - and data never
   animates. That is the whole of the reference's flow; anything longer reads as decoration. */
@keyframes menu-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ctxmenu {
  position: fixed;
  z-index: 60;
  min-width: 224px;
  max-height: 84vh;
  overflow-y: auto;
  padding: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-surface);
  /* one tight shadow plus a hairline: large soft shadows read as a web page */
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .45);
  animation: menu-in .1s cubic-bezier(.2,.7,.3,1);
}
.ctxmenu.compact { min-width: 120px; }

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--r);
  cursor: pointer;
  color: var(--ink);
  font-size: var(--t-md);
}
/* a token, not a literal: a hardcoded dark bar is a black stripe on any light theme */
.ctx-item:hover { background: var(--panel-3); }
.ctx-item.danger { color: var(--sell-hi); }
.ctx-item .tick { width: 11px; color: var(--ink); flex: 0 0 auto; font-size: var(--t-sm); }
.ctx-label { flex: 1 1 auto; }
.ctx-arrow { color: var(--ink-faint); margin-left: 14px; font-size: var(--t-md); }
/* A keyboard accelerator is right-aligned and quiet: it is a reminder, not a second label. */
.ctx-accel { color: var(--ink-faint); margin-left: 20px; font-family: var(--mono); font-size: var(--t-xs); }
.ctx-item.has-sub.open { background: var(--panel-3); }
.ctx-item.has-sub.open .ctx-arrow { color: var(--ink); }

/* Amber marks an entry that DOES something rather than sets something: nothing checks back to
   confirm it happened, so it is worth distinguishing from the toggles above it. */
.ctx-item.act { color: #d0a05a; }
.ctx-item.act:hover { color: #e8bd76; }

/* A submenu is a sibling of the root on the body, so it needs its own stacking context. */
.ctxsub { z-index: 61; }

.ctx-sep {
  margin: 5px 8px 3px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: var(--t-xs);
}
.ctx-sep:empty { padding-top: 0; margin-bottom: 3px; }

/* ---------------------------------------------------------------- fields */

/* Dialog chrome lives in windows.css: settings and the instrument picker are real in-app windows,
   not modals. The field primitives below are shared by both. */

.fld {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.fld:last-child { border-bottom: 0; }
.fld-disabled .fld-label { color: var(--ink-faint); }
.fld-disabled .fld-input { opacity: .35; cursor: not-allowed; }
.fld-label { color: var(--ink); font-size: var(--t-md); }
.fld-help { grid-column: 1 / -1; color: var(--ink-faint); font-size: var(--t-xs); line-height: 1.5; }

.fld-input {
  font: inherit;
  font-size: var(--t-sm);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 3px 6px;
  height: 24px;
}
.fld-input:hover { border-color: var(--line-2); }
.fld-input:focus { border-color: var(--line-2); }
/* The checkbox has to answer one question from across the room: is it on?
 *
 * A grey accent-color left checked and unchecked nearly the same weight - a slightly darker small
 * square either way - which on a panel of thirty of them is unreadable. Checked is now a FILLED
 * accent box with a white tick; unchecked is an empty inset well. Two different shapes and two
 * different weights, not two shades of the same grey. */
input[type="checkbox"].fld-input {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm, 2px);
  display: inline-grid;
  place-content: center;
  flex: none;
}
input[type="checkbox"].fld-input::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
input[type="checkbox"].fld-input:checked {
  background: var(--sel);
  border-color: var(--sel);
}
input[type="checkbox"].fld-input:checked::after { opacity: 1; }
input[type="checkbox"].fld-input:hover { border-color: var(--sel); }
input[type="checkbox"].fld-input:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }
input[type="number"].fld-input { width: 92px; text-align: right; }
select.fld-input { min-width: 154px; cursor: pointer; }

/* short free-text fields: marker label prefixes and the like */
input.txt {
  font: var(--t-sm) var(--mono);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 3px 6px;
  height: 24px;
  width: 92px;
}
input.txt:hover { border-color: var(--line-2); }
input.txt:focus { border-color: var(--line-2); outline: none; }

.rowpick { display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
.chip {
  font: inherit;
  font-size: var(--t-sm);
  color: var(--ink-dim);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 2px 8px;
  cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip.on { color: var(--ink); background: var(--sel); border-color: var(--line-2); }

.btn {
  font: inherit;
  font-size: var(--t-sm);
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0 12px;
  height: 24px;
  cursor: pointer;
}
.btn:hover { color: var(--ink); background: var(--panel-2); border-color: var(--line-2); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.primary {
  background: #d8d8dc;
  border-color: #d8d8dc;
  color: #111113;
  font-weight: 600;
}
.btn.primary:hover { background: #ececf0; border-color: #ececf0; color: #111113; }

/* ----------------------------------------------------------- symbol picker */

.search {
  font: inherit;
  font-size: var(--t-md);
  padding: 6px 9px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.search:focus { border-color: #4a4a52; }
.symlist { overflow-y: auto; padding: 3px 7px 12px; }
.symrow {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "sym venue" "days range";
  gap: 2px 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: var(--r);
  padding: 6px 9px;
  cursor: pointer;
}
.symrow:hover { background: var(--panel-2); }
.symrow.on { background: var(--sel); border-left-color: #6d6d75; }
.s-sym { grid-area: sym; font-weight: 600; font-size: var(--t-md); }
.s-venue { grid-area: venue; color: var(--ink-dim); font-size: var(--t-sm); }
.s-days { grid-area: days; color: var(--ink-faint); font-size: var(--t-xs); }
.s-range { grid-area: range; color: var(--ink-faint); font-size: var(--t-xs); text-align: right; }
.s-quote { color: var(--ink-faint); font-weight: 400; }
.s-range em { font-style: normal; }
.s-range .ok { color: var(--buy-hi); }
.s-range .fetch { color: var(--ink-dim); }
.s-range .none { color: var(--ink-faint); }
.pad { padding: 14px; }

/* --------------------------------------------------------------- phone */

@media (max-width: 640px) {
  /* Chrome that costs a row of pixels has to earn it on a phone, and most of it does not. */
  .cap, .meta, .stat { display: none; }
  .fld { grid-template-columns: 1fr; }
  .fld-input, .rowpick { justify-self: start; }
  .ctl { height: 26px; }
  .rail { width: 26px; }
}

/* Coarse pointers need a bigger target than a mouse does, but only the ones you actually press. */
@media (pointer: coarse) {
  .ctl, .btn, .toggles button, .rail button { min-height: 28px; }
  .win-btn { width: 38px; height: 34px; }
}

/* ------------------------------------------------------------- tab strip */

.tabstrip { display: flex; align-items: stretch; min-width: 0; }
.tabstrip .tabs { flex: 1 1 auto; min-width: 0; }
.tabstrip[hidden] { display: none; }

.tabs-hide {
  flex: 0 0 auto;
  width: 24px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-faint);
  font-size: 8px;
  cursor: pointer;
}
.tabs-hide:hover { color: var(--ink); background: var(--panel); }

/* The reveal handle. Deliberately tiny and always present: a control that hides itself with no
   way back is a trap, and a full-width bar to un-hide something defeats the point of hiding it. */
.tabs-show {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  width: 26px;
  height: 11px;
  border: 0;
  border-bottom-left-radius: var(--r);
  background: var(--bg);
  color: var(--ink-faint);
  font-size: 7px;
  line-height: 1;
  cursor: pointer;
}
.tabs-show:hover { color: var(--ink); }
.tabs-show[hidden] { display: none; }

body.panel { position: relative; }

/* ------------------------------------------------- TV-style quick timeframes */

.tf-quick { display: inline-flex; gap: 1px; flex: 0 0 auto; }
.tfq { padding: 0 7px; min-width: 30px; justify-content: center; font-variant-numeric: tabular-nums; }
/* the active period is a quiet pill, not a coloured underline - the TV grammar, our palette */
.tfq.on { background: var(--sel); color: var(--ink); }
.tf-caret { padding: 0 5px; color: var(--ink-faint); }
.tf-caret:hover { color: var(--ink); }

@media (max-width: 900px) {
  /* the quick row is a luxury; on a narrow panel the caret carries the whole job */
  .tf-quick { display: none; }
}

/* ------------------------------------------------------- native chrome (Win32)
   Colour and radius come from the theme as custom properties; these are the SHAPE rules a Win32
   control has that a token cannot express. Scoped to the flag so no other theme is touched. */
[data-chrome-native] .ctl,
[data-chrome-native] input,
[data-chrome-native] textarea,
[data-chrome-native] select,
[data-chrome-native] button {
  border-radius: 0;
}
/* Win32 fields are inset: a dark line on the top and left, light on the bottom and right. */
[data-chrome-native] input:not([type=checkbox]):not([type=range]),
[data-chrome-native] textarea,
[data-chrome-native] .field {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top-color: color-mix(in srgb, var(--line) 70%, #000);
  border-left-color: color-mix(in srgb, var(--line) 70%, #000);
  box-shadow: none;
}
/* and buttons are the inverse - raised, not inset */
[data-chrome-native] button.ctl,
[data-chrome-native] .btn {
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-color: color-mix(in srgb, var(--line) 70%, #000);
  border-right-color: color-mix(in srgb, var(--line) 70%, #000);
}
[data-chrome-native] button.ctl:active,
[data-chrome-native] .btn:active {
  border-color: color-mix(in srgb, var(--line) 70%, #000);
  border-bottom-color: var(--line);
  border-right-color: var(--line);
}
/* Selection is the system accent, filled, with white text - never a tint or an underline. */
[data-chrome-native] .ctl.on,
[data-chrome-native] .tab.active {
  background: var(--sel);
  color: #fff;
}
/* Focus is a 1px dotted rectangle inside the control, which is the Win32 focus rectangle. */
[data-chrome-native] :focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: -3px;
}

/* A Win32 toolbar toggle is a TINT with a 1px border, not a solid accent fill: the accent is
   reserved for the one selected item in a list. Solid-filling every active plugin turned the rail
   into a column of blue chips, which is the opposite of what a checked toolbar button looks like. */
[data-chrome-native] .rail button.on {
  background: color-mix(in srgb, var(--sel) 20%, var(--bg));
  border: 1px solid var(--sel);
  border-left-width: 3px;
  color: var(--ink);
}
[data-chrome-native] .rail button:hover {
  background: color-mix(in srgb, var(--sel) 10%, var(--bg));
}
