/* In-app windows and the settings window.
 *
 * The difference between software that feels bought and software that feels generated is almost
 * entirely in this file: one-pixel borders instead of shadows, 26-30px title bars instead of 48,
 * hairline separators, hover states that change by a few percent rather than lighting up, and no
 * rounded-everything. A desk tool is dense on purpose - the density is the product.
 */

/* --------------------------------------------------------------- window */

@keyframes win-in { from { opacity: 0; transform: scale(.985) translateY(5px); } to { opacity: 1; transform: none; } }

.win {
  animation: win-in .12s cubic-bezier(.2,.7,.3,1);
  position: fixed;
  display: flex;
  flex-direction: column;
  min-width: 260px;
  min-height: 160px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 26px rgba(0, 0, 0, .42);
  overflow: hidden;
  color: var(--ink);
}

.win.focused {
  border-color: #3a3a41;
}

/* Moving a window must not repaint text at sub-pixel offsets, which is what makes a drag look
   blurry and cheap. Snap to whole pixels and drop pointer events on the contents mid-drag. */
.win.dragging {
  user-select: none;
}
.win.dragging .win-body { pointer-events: none; }

.win-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0 2px 0 11px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  cursor: default;
}

.win.focused .win-head { background: var(--panel-3); }

.win-title {
  font-family: var(--ui-display);
  letter-spacing: -.005em;
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-dim);
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.win.focused .win-title { color: var(--ink); }

.win-controls { display: flex; flex: 0 0 auto; }

.win-btn {
  width: 30px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-md)/1 var(--ui);
  cursor: pointer;
  transition: background .09s linear, color .09s linear;
}
.win-btn:hover { background: var(--panel-3); color: var(--ink); }
.win-close:hover { background: var(--sell); color: #fff; }

.win-body {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

.win-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.win-foot[hidden] { display: none; }

/* Bottom-right resize grip. The diagonal hatch is the universal signal, and it gives the pointer a
   target that is easier to hit than a 6px edge. */
.win-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: se-resize;
  background:
    linear-gradient(135deg, transparent 0 46%, var(--ink-faint) 46% 54%, transparent 54% 100%),
    linear-gradient(135deg, transparent 0 72%, var(--ink-faint) 72% 80%, transparent 80% 100%);
  opacity: .5;
}
.win-grip:hover { opacity: 1; }
.win.collapsed .win-body,
.win.collapsed .win-foot,
.win.collapsed .win-grip { display: none; }
.win.maximised { border-radius: 0; }

/* ------------------------------------------------------- settings window */

.set-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* top tab strip */
.set-tabs {
  display: flex;
  flex: 0 0 auto;
  gap: 1px;
  padding: 0 8px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.set-tabs::-webkit-scrollbar { display: none; }

.set-tab {
  flex: 0 0 auto;
  height: 29px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-md)/1 var(--ui);
  cursor: pointer;
  white-space: nowrap;
  transition: color .09s linear;
}
.set-tab:hover { color: var(--ink-dim); }
.set-tab.on {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.set-split {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

/* left nav tree */
.set-nav {
  flex: 0 0 176px;
  display: flex;
  flex-direction: column;
  padding: 5px 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.set-navitem {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 25px;
  padding: 0 10px 0 4px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  font: var(--t-md)/1 var(--ui);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background .09s linear, color .09s linear;
}
.set-navitem:hover { background: var(--panel-2); color: var(--ink); }
.set-navitem.on {
  background: var(--panel-2);
  border-left-color: var(--accent);
  color: var(--ink);
}

/* the starred entries are the ones that change what data is loaded, not just how it looks */
.set-star {
  display: inline-block;
  width: 13px;
  flex: 0 0 13px;
  text-align: center;
  color: var(--accent);
  font-size: var(--t-xs);
}

/* right pane */
.set-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.set-crumb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font-size: var(--t-sm);
  color: var(--ink-faint);
  background: var(--bg);
}
.set-crumb i { font-style: normal; color: var(--ink-faint); }
.set-crumb b { color: var(--ink); font-weight: 600; }

.set-page {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 3px 14px 14px;
}

.set-note {
  padding: 7px 0 9px;
  color: var(--ink-faint);
  font-size: var(--t-sm);
  line-height: 1.55;
  max-width: 62ch;
}

/* A section heading, not an error. Red at the top of a settings page reads as something being
   wrong; these lines are context. */
.set-head {
  padding: 12px 0 5px;
  color: var(--ink-dim);
  font-weight: 600;
  font-size: var(--t-sm);
  font-weight: 600;
}

/* a layout row naming a field that does not exist is meant to be loud */
.set-missing {
  margin: 4px 0;
  padding: 5px 8px;
  border-left: 2px solid var(--sell);
  background: rgba(207, 74, 69, .08);
  color: var(--sell-hi);
  font-size: var(--t-sm);
}

/* rows */
.set-page .fld {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 30px;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
}
.set-page .fld:last-child { border-bottom: 0; }
.set-page .fld-label {
  color: var(--ink-dim);
  font-size: var(--t-md);
  line-height: 1.35;
}
.set-page .fld:hover .fld-label { color: var(--ink); }
.set-page .fld-help {
  grid-column: 1 / -1;
  margin-top: -1px;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  line-height: 1.5;
  max-width: 62ch;
}
.set-page .fld-disabled .fld-label { color: var(--ink-faint); }
.set-page .fld-disabled .fld-help { color: #5b6472; }

.fld-multi { display: flex; gap: 6px; align-items: center; }

/* colour swatch: a native input styled down to a chip, because the OS picker is better than
   anything worth hand-rolling */
.swatchwrap { display: inline-flex; }
.swatch {
  width: 34px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
  cursor: pointer;
}
.swatch::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch::-webkit-color-swatch { border: 0; border-radius: 1px; }
.swatch::-moz-color-swatch { border: 0; border-radius: 1px; }

/* Read-only blocks. The reference prints fixed facts about the loaded instrument above a source
   page - tick size, contract multiplier, the session range. They are stated, not editable, so they
   are set apart from the control rows rather than dressed up as one. */
.set-info {
  margin: 0;
  padding: 6px 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink-dim);
  font: var(--t-sm)/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-x: auto;
}

.set-source {
  margin: 6px 0 10px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--r);
}
.set-source b { color: var(--ink); font-size: var(--t-md); }
.set-source > span { color: var(--ink-faint); font-size: var(--t-sm); margin-left: 6px; }
.set-source .set-info {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: var(--t-xs);
}

/* a page-level action, not a row control, so it sits on its own line */
.set-btn { margin: 9px 0 4px; }

/* footer */
.set-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.set-foot .spacer { flex: 1 1 auto; }
.set-foot .btn.round {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  font-size: var(--t-md);
}

/* ------------------------------------------------------- symbol window */

.sym-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.sym-root .search {
  flex: 0 0 auto;
  margin: 9px 11px;
  width: calc(100% - 22px);
}
.sym-root .symlist {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* --------------------------------------------------------------- phone */

@media (max-width: 640px) {
  /* On a phone a floating window is a worse modal, so windows dock to the full screen and keep
     only the close control. Dragging a 360px-wide window around a 390px screen helps nobody. */
  .win {
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .win-grip { display: none; }
  .win-btn:not(.win-close) { display: none; }
  .set-nav { flex: 0 0 128px; }
  /* Panel names in the rebuilt tabs are the reference tool's own - "Initial Balance, Stats",
     "Poor High, Poor Low" - and they do not fit a 128px nav on one line. Wrapping to two lines
     keeps the whole name readable; truncating it would leave two panels reading "Poor High, P…". */
  .set-navitem {
    height: auto;
    min-height: 30px;
    padding: 5px 8px 5px 4px;
    align-items: flex-start;
    white-space: normal;
    line-height: 1.25;
  }
  .set-star { margin-top: 1px; }
  .set-page .fld { min-height: 36px; }
}

/* ------------------------------------------------------ workspaces window */

.ws-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.ws-bar {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.ws-list { flex: 1 1 auto; overflow-y: auto; padding: 5px 7px 12px; }

.ws-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
}
.ws-row:hover { background: var(--panel-2); }
.ws-row.on { background: var(--sel); border-left-color: #6d6d75; }
.ws-tick { width: 12px; flex: 0 0 12px; color: var(--ink); font-size: var(--t-sm); }
.ws-name { flex: 1 1 auto; font-weight: 600; font-size: var(--t-md); }

/* The row actions stay hidden until the row is under the pointer: four icons on every row turns a
   list into a control panel, and the common action is loading, not managing. */
.ws-acts { display: flex; gap: 1px; opacity: 0; }
.ws-row:hover .ws-acts, .ws-row.on .ws-acts { opacity: 1; }

.ws-icon {
  width: 24px;
  height: 22px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-sm) var(--mono);
  cursor: pointer;
}
.ws-icon:hover { background: var(--line); color: var(--ink); }
.ws-icon:last-child:hover { background: var(--sell); color: #fff; }

/* ------------------------------------------- floating toolbar on a drawing */

/* Sits a few pixels from the object it edits. Deliberately small and dark: it overlays the chart,
   so anything larger hides the thing being edited. */
.dw-bar {
  position: fixed;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 6px 18px rgba(0, 0, 0, .45);
  user-select: none;
}

.dw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 26px;
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-dim);
  font: var(--t-sm) var(--mono);
  cursor: pointer;
}
.dw-btn:hover { background: var(--panel-3); color: var(--ink); }
.dw-btn.on { background: var(--sel); color: var(--ink); }
.dw-del:hover { background: var(--sell); color: #fff; }
.dw-wide { min-width: 54px; }

.dw-dot {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  border: 1px solid #00000060;
}
.dw-rule { width: 14px; background: currentColor; border-radius: 1px; }
.dw-wlabel { font-size: var(--t-xs); }
.dw-sep { width: 1px; height: 15px; margin: 0 3px; background: var(--line-2); }

/* popovers hanging off the toolbar */
.dw-pop {
  animation: win-in .1s cubic-bezier(.2,.7,.3,1);
  position: fixed;
  z-index: 56;
  padding: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 6px 18px rgba(0, 0, 0, .45);
}

.dw-grid {
  display: grid;
  grid-template-columns: repeat(5, 20px);
  gap: 4px;
  align-items: center;
}
.dw-swatch {
  width: 20px;
  height: 20px;
  border: 1px solid #00000060;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
}
.dw-swatch.on { outline: 2px solid var(--ink); outline-offset: 1px; }

.dw-list { display: flex; flex-direction: column; min-width: 130px; }
.dw-wrow, .dw-mrow {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 7px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font: var(--t-sm) var(--ui);
  text-align: left;
  cursor: pointer;
}
.dw-wrow:hover, .dw-mrow:hover { background: var(--panel-3); }
.dw-wrow.on { background: var(--sel); }
.dw-wrow i { width: 40px; background: currentColor; border-radius: 1px; }
.dw-mrow .tick { width: 11px; color: var(--ink); }

/* the per-drawing settings window reuses the field primitives */
.dw-swatches { display: flex; gap: 4px; align-items: center; }
.dw-width {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  cursor: pointer;
}
.dw-width.on { border-color: #4a4a52; background: var(--sel); }
.dw-width i { width: 18px; background: var(--ink); border-radius: 1px; }

/* ------------------------------------------------ keyboard reference card */

.kb-root { padding: 16px 18px 4px; }
.kb-head { font-size: 17px; font-weight: 600; color: var(--ink); }
.kb-sub { margin: 2px 0 16px; font-size: var(--t-sm); color: var(--ink-faint); }

.kb-cols { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.kb-col { flex: 1 1 240px; display: flex; flex-direction: column; gap: 14px; min-width: 220px; }

.kb-sec {
  padding: 11px 12px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.kb-title {
  margin-bottom: 8px;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  
  
}
.kb-rows { display: flex; flex-direction: column; gap: 6px; }
.kb-row { display: flex; align-items: baseline; gap: 10px; }
.kb-keys { display: inline-flex; gap: 3px; flex: 0 0 auto; min-width: 92px; }
.kb-desc { color: var(--ink-dim); font-size: var(--t-sm); line-height: 1.35; }

/* A key chip, not a button: it is telling you what to press, not offering to be pressed. */
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  background: var(--panel-3);
  border: 1px solid #2f2f36;
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink);
  font: var(--t-xs) var(--mono);
  text-align: center;
}

.kb-hint { color: var(--ink-faint); font-size: var(--t-xs); }
.btn.danger { color: var(--sell-hi); }
.btn.danger:hover { background: var(--sell); color: #fff; border-color: var(--sell); }

/* ---------------------------------------------------- select instrument */

.ip-root { display: flex; height: 100%; min-height: 0; }

.ip-side {
  flex: 0 0 210px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.ip-search { margin: 10px 11px; }
.ip-venues { flex: 1 1 auto; overflow-y: auto; padding: 0 6px 10px; }

.ip-venue {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-dim);
  font: var(--t-md) var(--ui);
  text-align: left;
  cursor: pointer;
}
.ip-venue:hover { background: var(--panel-2); color: var(--ink); }
.ip-venue.on { background: var(--sel); border-left-color: #6d6d75; color: var(--ink); }
.ip-fav { color: var(--ink-faint); }
.ip-fav.on { color: #d0a05a; }

/* A venue with no ingest says so rather than looking selectable and then showing nothing. */
.ip-soon {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  font-style: normal;
}
.ip-venue.soon { color: var(--ink-faint); }

.ip-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.ip-tabs {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.ip-tab {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-md) var(--ui);
  cursor: pointer;
}
.ip-tab:hover { color: var(--ink-dim); }
.ip-tab.on { color: var(--ink); border-bottom-color: #d0a05a; }

.ip-cols {
  flex: 1 1 auto;
  display: flex;
  gap: 0;
  overflow: auto;
  padding: 8px 4px 12px;
}
.ip-col { flex: 1 1 0; min-width: 168px; padding: 0 8px; }
.ip-colhead {
  padding: 4px 6px 8px;
  color: var(--ink-dim);
  font-size: var(--t-sm);
}

.ip-row {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 23px;
  padding: 0 6px;
  border-radius: var(--r);
  cursor: pointer;
}
.ip-row:hover { background: var(--panel-2); }
.ip-row.on { background: var(--sel); }
.ip-star {
  width: 14px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: var(--t-sm);
  cursor: pointer;
  padding: 0;
}
.ip-star.on { color: #d0a05a; }
.ip-sym { flex: 1 1 auto; color: var(--ink); font-size: var(--t-sm); font-family: var(--mono); }
.ip-meta { color: var(--ink-faint); font-size: var(--t-xs); font-family: var(--mono); }
.ip-local { color: var(--buy); }
.ip-fetch { color: var(--ink-dim); }
.ip-none { color: var(--ink-faint); }

@media (max-width: 640px) {
  .ip-root { flex-direction: column; }
  .ip-side { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .ip-venues { display: flex; gap: 4px; overflow-x: auto; padding: 0 8px 8px; }
  .ip-venue { width: auto; flex: 0 0 auto; }
  .ip-cols { flex-direction: column; }
  /* Stacked, a column must be as tall as its rows and no taller. With the desktop flex-grow
     left on, two groups shared the window height between them - one symbol at the top, the
     next group half a screen below it, and the gap read as a list that had failed to load. */
  .ip-col { flex: 0 0 auto; min-width: 0; }
}

/* A shortcut with no handler is greyed and labelled rather than listed as if it worked. */
.kb-unbound { opacity: .42; }
.kb-or { color: var(--ink-faint); font-size: var(--t-xs); margin: 0 2px; }

/* ---------------------------------------------- keyboard reference card */

.keys-root { padding: 16px 18px 10px; }

/* Columns rather than one long list: the point of a reference card is that it is taken in at a
   glance. CSS columns balance the groups without the layout having to know how many there are. */
.keys-cols {
  column-count: 3;
  column-gap: 16px;
}
@media (max-width: 780px) { .keys-cols { column-count: 2; } }
@media (max-width: 520px) { .keys-cols { column-count: 1; } }

.keys-group {
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  padding: 11px 12px 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.keys-group h3 {
  margin: 0 0 9px;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  font-weight: 500;
  
}

.keys-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
}
.keys-combo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 96px;
}
.keys-label { color: var(--ink-dim); font-size: var(--t-sm); line-height: 1.35; }
.keys-or { color: var(--ink-faint); font-size: var(--t-xs); font-style: normal; margin: 0 2px; }

/* A shortcut with no handler is greyed and labelled rather than listed as though it worked. A
   card that promises a key which does nothing costs someone a real attempt to use it. */
.keys-unbound { opacity: .45; }
.keys-todo {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  white-space: nowrap;
}

.keys-foot {
  padding: 6px 2px 2px;
  color: var(--ink-faint);
  font-size: var(--t-xs);
}

/* A key chip, not a button: it tells you what to press, it does not offer to be pressed. */
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  background: var(--panel-3);
  border: 1px solid #2f2f36;
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink);
  font: var(--t-xs) var(--mono);
  text-align: center;
}

/* The focused panel dims its own chrome slightly less than the unfocused ones, so which chart the
   menu bar is about is legible without a coloured frame shouting about it. */
body.panel:not(.has-focus) .bar,
body.panel:not(.has-focus) .tabs { opacity: .82; }

/* A per-indicator settings window: the same shell as the chart settings window, minus the left
   nav. One indicator's panels fit across the top, so a second level of navigation would be a
   tree with one branch. */
.ind-root .set-pane { flex: 1 1 auto; min-height: 0; }
.ind-root .set-page { padding: 10px 16px 16px; }

/* --------------------------------------------------------- object tree */

.ot-root { padding: 5px 7px 12px; }

.ot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-left: 2px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
}
.ot-row:hover { background: var(--panel-2); }
.ot-row.on { background: var(--sel); border-left-color: #6d6d75; }

.ot-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 2px; }
.ot-name { flex: 0 0 auto; color: var(--ink); font-size: var(--t-sm); }
.ot-where {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  font-family: var(--mono);
}

/* State is spelled out rather than shown as an icon. Half these rows are read while looking for
   something that went missing, and "hidden" answers that faster than a crossed-out eye. */
.ot-btn {
  flex: 0 0 auto;
  min-width: 48px;
  height: 19px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-xs) var(--mono);
  cursor: pointer;
}
.ot-btn:hover { border-color: var(--line-2); color: var(--ink); }
.ot-btn.on { color: var(--ink-dim); }

.ot-x {
  flex: 0 0 auto;
  width: 20px;
  height: 19px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-sm) var(--mono);
  cursor: pointer;
}
.ot-x:hover { background: var(--sell); color: #fff; }

/* ------------------------------------------------------------- templates */

.tpl-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.tpl-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}
.tpl-scope { color: var(--ink-dim); font-size: var(--t-sm); }
.tpl-list { flex: 1 1 auto; overflow-y: auto; padding: 5px 7px 12px; }

.tpl-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r);
}
.tpl-row:hover { background: var(--panel-2); }
.tpl-name { flex: 0 0 auto; color: var(--ink); font-size: var(--t-md); font-weight: 600; }
.tpl-meta {
  flex: 1 1 auto;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  font-family: var(--mono);
}
.tpl-apply { flex: 0 0 auto; }
.tpl-x {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-faint);
  font: var(--t-sm) var(--mono);
  cursor: pointer;
}
.tpl-x:hover { background: var(--sell); color: #fff; }

/* --------------------------------------------------------- indicators menu */

.im-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.im-search { margin: 10px 12px 8px; }

.im-split { display: flex; flex: 1 1 auto; min-height: 0; }

.im-side {
  flex: 0 0 128px;
  padding: 2px 6px 10px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.im-cathead {
  padding: 6px 8px 5px;
  color: var(--ink-faint);
  font-size: var(--t-xs);
  
}
.im-cat {
  display: block;
  width: 100%;
  padding: 6px 9px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-dim);
  font: var(--t-md) var(--ui);
  text-align: left;
  cursor: pointer;
}
.im-cat:hover { background: var(--panel-2); color: var(--ink); }
.im-cat.on { background: var(--sel); color: var(--ink); }

.im-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 8px 12px; }

.im-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--r);
  cursor: pointer;
}
.im-row:hover { background: var(--panel-2); }
.im-tick { width: 13px; flex: 0 0 13px; color: var(--ink); font-size: var(--t-sm); }
.im-row.on .im-name { color: var(--ink); }
.im-name { flex: 1 1 auto; color: var(--ink-dim); font-size: var(--t-md); }
.im-abbrev { color: var(--ink-faint); font-size: var(--t-xs); font-family: var(--mono); }

/* the gear only invites itself when the row is under the pointer */
.im-gear {
  width: 24px;
  height: 22px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-faint);
  font-size: var(--t-sm);
  cursor: pointer;
  opacity: 0;
}
.im-row:hover .im-gear { opacity: 1; }
.im-gear:hover { background: var(--line); color: var(--ink); }

/* ------------------------------------------------------- colour field */

.cf { display: inline-flex; align-items: center; gap: 6px; }

.cf-swatch {
  width: 26px;
  height: 22px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  cursor: pointer;
}
.cf-swatch:hover { border-color: #4a4a52; }

/* the hex IS the control, so it gets the width and the mono face */
.cf-hex {
  width: 84px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
  font: var(--t-sm) var(--mono);
  text-transform: lowercase;
}
.cf-hex:hover { border-color: var(--line-2); }
.cf-hex:focus { border-color: #4a4a52; outline: none; }

.cf-pop {
  position: fixed;
  z-index: 70;
  padding: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.55), 0 8px 22px rgba(0,0,0,.45);
}
.cf-grid { display: grid; grid-template-columns: repeat(6, 22px); gap: 5px; }
.cf-chip {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #00000055;
  border-radius: var(--r);
  cursor: pointer;
}
.cf-chip.on { outline: 2px solid var(--ink); outline-offset: 1px; }

/* the native picker, demoted to one row at the bottom */
.cf-more {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: var(--t-xs);
  cursor: pointer;
}
.cf-native { width: 22px; height: 18px; padding: 0; border: 1px solid var(--line-2); border-radius: 3px; background: none; cursor: pointer; }

/* ------------------------------------------------------- native (Win32) windows
   A Win32 tool window is a HARD OBJECT: a 1px border, a solid title bar, square buttons, and no
   soft edge anywhere. Drop shadows, easing and translucency are what make a window look like it
   belongs to a web page rather than to the desktop, so under the native chrome they all go. */
[data-chrome-native] .win,
[data-chrome-native] .menu,
[data-chrome-native] .ctx,
[data-chrome-native] .pop {
  box-shadow: none;
  border: 1px solid var(--line);
  border-radius: 0;
}
/* The focused window's title bar takes the system accent with white text - the single strongest
   signal in the whole Win32 language for "this is the window you are typing into". */
[data-chrome-native] .win-head { background: var(--panel-2); border-radius: 0; }
[data-chrome-native] .win.focused .win-head { background: var(--sel); }
[data-chrome-native] .win.focused .win-title { color: #fff; }
[data-chrome-native] .win-head button { border-radius: 0; }
[data-chrome-native] .win.focused .win-head button { color: #fff; }
[data-chrome-native] .win.focused .win-head button:hover { background: rgba(255, 255, 255, .22); }

/* Nothing eases. A native control changes state on the frame it is clicked. */
[data-chrome-native] * { transition: none !important; }

/* A selected LIST ROW is the same solid accent bar, and everything printed on it goes white -
   the symbol, the "on disk" date, the row's meta. The ink variables stay black under the light
   native chrome, so without this the chosen instrument was black-on-blue and its availability
   text green-on-blue, which is to say unreadable and invisible respectively. */
[data-chrome-native] .ip-row.on,
[data-chrome-native] .ip-row.on *,
[data-chrome-native] .ws-row.on,
[data-chrome-native] .ws-row.on *,
[data-chrome-native] .ot-row.on,
[data-chrome-native] .ot-row.on *,
[data-chrome-native] .dw-wrow.on,
[data-chrome-native] .dw-wrow.on *,
[data-chrome-native] .pick-row.on,
[data-chrome-native] .pick-row.on *,
[data-chrome-native] .pick-cat.on,
[data-chrome-native] .pp-item.on,
[data-chrome-native] .symrow.on,
[data-chrome-native] .symrow.on * {
  color: #fff;
}

/* Menus: square, hard-bordered, and the highlight is a solid accent bar across the full row. */
[data-chrome-native] .ctx-item:hover,
[data-chrome-native] .ctx-item.sel {
  background: var(--sel);
  color: #fff;
  border-radius: 0;
}

/* Win32 scrollbars are square, chunky, and always visible - they are part of the frame, not an
   overlay that fades in. */
[data-chrome-native] ::-webkit-scrollbar { width: 16px; height: 16px; }
[data-chrome-native] ::-webkit-scrollbar-track { background: var(--panel-2); }
[data-chrome-native] ::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 1px solid var(--panel-2);
  border-radius: 0;
}
[data-chrome-native] ::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
[data-chrome-native] ::-webkit-scrollbar-corner { background: var(--panel-2); }

/* ---------------------------------------------------------- send feedback */

.fb-root { display: flex; flex-direction: column; padding: 14px 16px 10px; }
.fb-label {
  font-size: var(--t-md);
  color: var(--ink);
  margin: 0 0 6px;
}
.fb-label + .fb-label { margin-top: 12px; }
.fb-input {
  font: var(--t-md) var(--ui);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px 9px;
  height: 30px;
  width: 100%;
  box-sizing: border-box;
}
.fb-input:hover { border-color: var(--line-2); }
.fb-input:focus { border-color: var(--focus); outline: none; }
.fb-input:disabled { opacity: .6; }
.fb-input::placeholder { color: var(--ink-faint); }
.fb-text {
  height: auto;
  min-height: 120px;
  resize: none;
  line-height: 1.45;
  margin-bottom: 12px;
}
.fb-input + .fb-label { margin-top: 12px; }
.fb-error { color: var(--sell-hi); font-size: var(--t-sm); line-height: 1.4; margin: -4px 0 8px; }
.fb-error[hidden] { display: none; }
.fb-done { padding: 28px 6px 10px; }
.fb-done-title { font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.fb-done-sub { font-size: var(--t-sm); color: var(--ink-dim); line-height: 1.5; }
.btn:disabled, .btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary:disabled:hover { background: #d8d8dc; border-color: #d8d8dc; }
