/* The editor of a trade's note and tags (lot J2, jnote-editor.js), the same on the trader space and on the desk, and the
   marks of a trade's note in their tables. The tokens of the page that loads it (--surface-*, --text, --mute, --acc,
   --focus); one blue key (Save); no green nor violet: green and red stay the result's. A modal centred in the window:
   it never makes the page scroll. */
.jn-dlg {
  width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0; overflow: auto;
  color: var(--text); background: var(--surface-2, #13161a); border: 1px solid var(--hair-2, var(--line-2, #2c2c2e));
  border-radius: 10px; box-shadow: 0 24px 64px -24px rgb(0 0 0 / 0.8);
}
.jn-dlg::backdrop { background: rgb(0 0 0 / 0.6); }
.jn-form { display: grid; gap: 8px; padding: 16px; }
.jn-head { display: grid; gap: 2px; margin-bottom: 4px; }
.jn-h { margin: 0; font-size: 16px; font-weight: 650; }
.jn-trade { margin: 0; color: var(--mute); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.jn-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.jn-label { margin: 6px 0 0; color: var(--mute); font-size: 12.5px; font-weight: 600; }
.jn-count { color: var(--dim); font-size: 12px; }
.jn-count[data-over="true"] { color: var(--warn); }
.jn-note, .jn-tag {
  width: 100%; box-sizing: border-box; color: var(--text); background: var(--surface, #0e1013); font: inherit; font-size: 14px;
  border: 1px solid var(--hair-2, var(--line-2, #2c2c2e)); border-radius: 6px; padding: 8px 10px;
}
.jn-note { min-height: 104px; resize: vertical; line-height: 1.45; }
.jn-note:focus-visible, .jn-tag:focus-visible, .jn-btn:focus-visible, .jn-x:focus-visible, .jn-pick:focus-visible, .jn-key:focus-visible, .jn-chipkey:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
}
.jn-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.jn-chips:empty { display: none; }
.jn-chip {
  display: inline-flex; align-items: center; gap: 2px; padding-block: 2px; padding-inline: 10px 2px; font-size: 13px;
  background: var(--surface-3, #191d23); border: 1px solid var(--hair-2, var(--line-2, #2c2c2e)); border-radius: 999px;
}
.jn-x { width: 28px; height: 28px; border: 0; border-radius: 999px; color: var(--mute); background: transparent; font-size: 16px; cursor: pointer; }
.jn-add { display: flex; gap: 6px; }
.jn-add .jn-tag { flex: 1; min-width: 0; }
.jn-mine { display: flex; flex-wrap: wrap; gap: 6px; }
.jn-pick {
  min-height: 32px; padding: 0 10px; font: inherit; font-size: 12.5px; color: var(--mute); background: transparent;
  border: 1px dashed var(--hair-3, var(--line-strong, #6b6b6f)); border-radius: 999px; cursor: pointer;
}
.jn-msg { min-height: 1.3em; margin: 0; color: var(--warn); font-size: 12.5px; }
.jn-private { margin: 0; color: var(--dim); font-size: 12px; }
.jn-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.jn-btn {
  min-height: 40px; padding: 0 16px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer;
  background: var(--surface-3, #191d23); border: 1px solid var(--hair-2, var(--line-2, #2c2c2e)); border-radius: 6px;
}
.jn-save { color: #fff; background: var(--acc); border-color: transparent; }
.jn-btn:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) {
  .jn-btn:not(:disabled):hover { background: var(--surface-4, #232830); }
  .jn-save:not(:disabled):hover { background: color-mix(in srgb, var(--acc) 86%, #fff); }
  .jn-x:hover, .jn-pick:hover { color: var(--text); }
  .jn-key:hover, .jn-chipkey:hover { color: var(--text); border-color: var(--hair-3, var(--line-strong, #6b6b6f)); }
}

/* the key that opens a trade's editor, in a table row: a small pencil; filled when the trade has a note or a tag */
.jn-key {
  display: inline-grid; place-items: center; width: 28px; height: 24px; padding: 0; color: var(--dim); cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 5px;
}
.jn-key svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.jn-key[data-has="true"] { color: var(--text); }
.jn-key[data-has="true"] svg { fill: currentColor; fill-opacity: 0.25; }
.jn-key:disabled { opacity: 0.4; cursor: default; }

/* the desk's history: the key's column stays narrow */
.tbl .jn-cell { width: 32px; padding-inline: 2px; text-align: center; }
/* a phone: the 44 px key is its own margin (the row's 6 px each side made the table 6 px wider than a 360 px screen) */
.term[data-form="phone"] .tbl td.jn-cell, .term[data-form="phone"] .tbl th.jn-cell { padding-inline: 0; }

/* a finger: every key of the editor and of a row at least 44 px high (the history row grows with it) */
@media (pointer: coarse) {
  .jn-key { width: 44px; height: 44px; }
  .jn-btn, .jn-pick, .jn-tag { min-height: 44px; }
  .jn-x { width: 44px; height: 44px; }
}
