/* ==========================================================================
   Forms
   ========================================================================== */

/* min-width: 0 is load-bearing, not defensive styling. A flex/grid item's
   automatic minimum size is its content's min-content size, and form
   controls (notably input[type=date] and input[type=number]) carry a large
   intrinsic minimum that `width: 100%` does not override in WebKit. Without
   this the field refuses to shrink, pushes past the dialog, and - because
   .modal__body scrolls - the whole panel becomes pannable sideways. */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field__label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--color-text-secondary);
}

.field__hint {
  font-size: var(--fs-caption);
  color: var(--color-text-secondary);
}

/* Look stage 4: the form controls' own values, defined once here and used by
   every view (Settings reads them too).
   --field-bg: a filled field, a step off its surface (tile-2 on dark, tile on
   light, as the grouped lists in Settings do), with a hairline and radius 10.
   --seg-track / --seg-thumb: the Apple segmented control, a translucent grey
   capsule and a raised thumb. --switch-off: the Apple switch's grey. */
:root {
  --field-bg: var(--tile-2);
  --seg-track: rgba(118, 118, 128, 0.24);
  --seg-thumb: #636366;
  --seg-ink: #ffffff;
  --seg-lift: 0 3px 8px rgba(0, 0, 0, 0.18), 0 3px 1px rgba(0, 0, 0, 0.04);
  --switch-off: rgba(118, 118, 128, 0.32);
}

:root[data-theme="light"] {
  --field-bg: var(--tile);
  --seg-track: rgba(118, 118, 128, 0.12);
  --seg-thumb: #fff;
  --seg-ink: var(--text-1);
  --switch-off: rgba(118, 118, 128, 0.28);
}

/* A field is a step off its surface. On light, a window (.win: the page's
   recessed panel, near the tile colour) is where tile would vanish, so its
   fields take the next step down. */
:root[data-theme="light"] .win {
  --field-bg: var(--tile-2);
}

/* A white modal has no step to put a light track on: the track is a shade
   stronger there so the segmented control still reads as a control. */
:root[data-theme="light"] .modal .segmented {
  --seg-track: rgba(118, 118, 128, 0.18);
}

.field__hint.is-error {
  color: var(--loss);
}

.input,
.select {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-body);
  color: var(--color-text-primary);
  transition: border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
  width: 100%;
  /* Controls must be allowed to shrink below their intrinsic minimum;
     see the note on .field above. box-sizing is already border-box from
     the reset, so max-width: 100% cannot be defeated by padding. */
  min-width: 0;
  max-width: 100%;
}

/* WebKit gives date/time/number controls an intrinsic width that ignores
   `width: 100%`; these declarations are what actually let them fit a
   narrow dialog on iOS. */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="number"] {
  min-width: 0;
  max-width: 100%;
}

/* ---- Date/time controls on WebKit ----
   `min-width: 0` alone is not enough. While the control keeps its native
   appearance, iOS Safari sizes it from the *shadow* content - the
   ::-webkit-date-and-time-value box - and that box has its own intrinsic
   width plus a centring margin, neither of which the host element's width
   can override. The result is a field that renders wider than its
   container and pushes past the dialog edge.

   Dropping the native appearance is what hands sizing back to CSS; the
   shadow-part rules then stop the inner value box from re-inflating it.
   Everything else about the control (the native picker, the value format,
   the locale) is unaffected - only its box sizing changes. */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value {
  /* iOS centres this box and lets it set the control's width. Left-align
     it, let it shrink, and it stops driving the outer size. */
  text-align: left;
  min-width: 0;
  margin: 0;
}

input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit {
  min-width: 0;
  overflow: hidden;
}

/* Removing the native appearance also removes the calendar affordance on
   WebKit, so restore a visible one that stays inside the field. */
input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.5;
  cursor: pointer;
}

/* The focus ring is the accent at 30%, not --color-accent-soft (13%): a
   ring meant to say "you are here" has to be visible at a glance. */
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.3);
}

/* iOS Safari auto-zooms the page on focusing any text input/textarea/select
   under 16px, which is what made New Trade / Add Challenge / Growth
   Simulator's number fields feel like a "moving", mis-scaled panel on
   phones - this is the shared root cause, fixed once here rather than
   per-view. Scoped to mobile widths only so desktop's 15px stays as-is. */
@media (max-width: 880px) {
  .input,
  .select,
  .cselect__trigger,
  textarea.input {
    font-size: 16px;
  }
}

.input.is-invalid {
  border-color: var(--color-loss);
}

.input.is-invalid:focus {
  border-color: var(--color-loss);
  box-shadow: 0 0 0 3px var(--color-loss-soft);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input:hover:not(:focus) {
  border-color: var(--color-border-strong);
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 15px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--color-text-primary);
  cursor: pointer;
}

/* ---- Custom select (enhances native .select; see js/components/select.js) ---- */

.cselect {
  position: relative;
  width: 100%;
}

/* Native <select> kept as the source of truth, visually removed but still
   focusable-by-name / present for FormData. */
.cselect__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  pointer-events: none;
}

.cselect__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--color-text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}

.cselect__trigger:hover {
  border-color: var(--color-border-strong);
}

.cselect.is-open .cselect__trigger,
.cselect__trigger:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.3);
}

.cselect__trigger[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.cselect__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cselect__chevron {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  transition: transform var(--dur-fast) var(--ease-standard);
}

.cselect.is-open .cselect__chevron {
  transform: rotate(180deg);
  color: var(--color-text-secondary);
}

.cselect__panel {
  /* Portaled to <body> and positioned via inline left/top/width when open
     (see select.js) - this deliberately escapes any ancestor's stacking
     context or overflow clipping, which `position: absolute` nested inside
     .cselect could not (e.g. .stagger-item's persistent transform from its
     entrance animation creates a new stacking context that trapped a
     nested z-index). */
  position: fixed;
  z-index: var(--z-dropdown);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  display: none;
  flex-direction: column;
  gap: 2px;
  max-height: 264px;
  overflow-y: auto;
  animation: cselect-pop var(--dur-fast) var(--ease-decel);
}

.cselect__panel.is-open {
  display: flex;
}

@keyframes cselect-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cselect__option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-footnote);
  color: var(--color-text-secondary);
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere; /* the list is as wide as its field: a long name takes a second line, never a sideways scroll */
  transition: background-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard);
}

/* The highlighted option - keyboard (aria-activedescendant) and pointer
   both move it (select.js), so there is one highlight, never a hover and a
   keyboard focus pointing at different rows. */
.cselect__option.is-focused {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.cselect__option.is-active {
  color: var(--color-accent);
  font-weight: var(--fw-medium);
  background: var(--color-accent-soft);
}

/* minmax(0, 1fr), never a bare 1fr: a bare `1fr` track floors at its
   content's min-content size, which for a form control is large enough to
   blow the dialog out sideways. Same fix, same reason as .grid-cols-N in
   layout.css. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  min-width: 0;
}

@media (max-width: 700px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Segmented control (tabs) ---- */

/* Apple segmented control (look stage 4): a capsule track, a raised thumb on
   the one selected segment (--seg-track / --seg-thumb, defined at the top).
   css/look-tapebook.css no longer restyles it. */
.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--seg-track);
  border: 0;
  box-shadow: none;
  border-radius: var(--radius-pill);
  position: relative;
  gap: 0;
}

/* The same weight on every option, active and inactive alike: weighting only the
   active one would change the option widths - and with them the thumb measured
   from them - on every switch, and the other labels would visibly shift. The
   selected state is the thumb behind the label. */
.segmented__option {
  position: relative;
  z-index: 1;
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--color-text-primary);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard);
}

.segmented__option:hover {
  color: var(--color-text-primary);
}

.segmented__option.is-active {
  color: var(--color-text-primary);
}

.segmented__thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  /* left: 0 is load-bearing, not a reset.
     Every positioner in the app writes translateX(active.offsetLeft), and
     offsetLeft is measured from the offsetParent's PADDING edge. Without an
     explicit `left`, an absolutely positioned box falls back to its static
     position - the start of the CONTENT box - so the track's own 3px padding
     was counted twice and the thumb sat ~3.5px right of the label it is
     meant to sit behind. Pinning left: 0 puts its origin on the padding edge,
     the same origin offsetLeft uses. Measured on the Journal tab bar: 3.4px
     off before, 0.0px after. Worst on the narrowest option ("List", 35px),
     where 3.5px is 10% of the pill - which is what read as an uneven,
     half-missed highlight. Fixes every .segmented in the app at once, with
     no change to any of the four JS positioners. */
  left: 0;
  /* The thumb's geometry is written inline in JS from a measurement taken
     at render time. It is a decoration that by definition can never be
     wider than the track it slides in, so this invariant is stated here
     rather than trusted to every call site re-measuring on resize. Without
     it a stale width (dialog measured wide, then narrowed) overflows its
     container and makes the whole panel pannable. */
  max-width: 100%;
  border-radius: var(--radius-pill);
  /* The thumb is a step off the track in both themes (--seg-thumb). */
  background: var(--seg-thumb);
  border: 0;
  /* Raised a hair off the track; no lit edge. */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform var(--dur-base) var(--ease-spring),
    width var(--dur-base) var(--ease-spring);
}

/* ---- Touch target sizing ----
   Bumps tap targets toward the ~44px recommendation on phones/tablets
   and genuine touch input, without changing the tighter desktop-mouse
   sizing. */
@media (max-width: 880px), (pointer: coarse) {
  .btn--icon {
    width: 44px;
    height: 44px;
  }

  .segmented__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: var(--space-3) var(--space-5);
  }

  /* Rows that are whole controls simply get 44px. */
  .collapsible-toggle,
  .check-item {
    min-height: 44px;
  }

  /* Small controls keep their look and get a 44px tap area around it
     (the license tag's pattern, layout.css): the switch (26px) and the
     inline text links (about 20px). */
  .set-switch::after,
  .link-button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
  .link-button {
    position: relative;
  }
}

/* ---- Toggle switch ----
   The only switch in the app is Settings' .set-switch (css/views/settings.css),
   which reads --switch-off from the top of this file. The generic .switch that
   stood here had no user and is gone. */

/* ---- Slider ---- */

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--color-border-strong);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--color-accent);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-standard);
}

.slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px rgba(var(--color-accent-rgb), 0.2);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--color-accent);
  cursor: pointer;
}

/* `outline: none` above hid keyboard focus on the Growth Simulator sliders
   entirely; the ring moves to the thumb, where the value is. */
.slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(var(--color-accent-rgb), 0.35);
}
.slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(var(--color-accent-rgb), 0.35);
}


/* Account colour picker (js/components/account-form.js, audit Etap 6.4). */
.acct-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.acct-swatch {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  color: #fff;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.acct-swatch svg {
  opacity: 0;
}

.acct-swatch.is-active {
  box-shadow: 0 0 0 2px var(--color-surface-raised), 0 0 0 4px var(--sw);
}

.acct-swatch.is-active svg {
  opacity: 1;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.6));
}

/* Used by another account: dimmed, still selectable. */
.acct-swatch.is-used {
  opacity: 0.4;
}

/* Focus must read on every swatch: undimmed, and the outline clear of the
   selection ring (which on the accent swatch is the outline's own colour). */
.acct-swatch:focus-visible {
  opacity: 1;
  outline-offset: 5px;
}

.acct-swatch:hover {
  opacity: 1;
  outline: 2px solid var(--line);
  outline-offset: 3px;
}

/* Phone: two even rows of four at a full 44px touch target, rather than
   a ragged wrap. */
@media (max-width: 700px) {
  .acct-swatches {
    display: grid;
    grid-template-columns: repeat(4, 44px);
  }

  .acct-swatch {
    width: 44px;
    height: 44px;
  }

  [data-type-picker] .chip {
    min-height: 44px;
  }
}


/* ==========================================================================
   v12 trade form (dev/mockups/redesign/v12.html, "New trade")
   One column in the panel at the right edge: Cancel, the title and Save in
   one head; account and symbol; Long / Short; entry, stop and exit; the
   tile with the risk, what it is at the stop and the result in R; setup and
   when it opened; notes; a place to drop a screenshot. A mistake stands at
   its field. What the mockup does not draw sits under "More details".
   ========================================================================== */

.modal.modal--trade .modal__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 8px;
  border-bottom: 0;
}

.modal.modal--trade .modal__title {
  grid-column: 2;
  grid-row: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

.modal.modal--trade [data-modal-close] {
  display: none;
}

.modal.modal--trade .jf-ghost {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.modal.modal--trade .jf-go {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.jf-ghost,
.jf-go {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.jf-ghost {
  background: var(--tile);
  color: var(--text-1);
}

.jf-ghost:hover {
  background: var(--tile-2);
}

.jf-go {
  background: var(--lead);
  color: var(--on-lead);
  font-weight: 600;
}

.jf-go:hover {
  filter: brightness(1.06);
}

.jf-ghost:focus-visible,
.jf-go:focus-visible,
.jf-seg__opt:focus-visible,
.jf-link:focus-visible,
.jf-x:focus-visible,
.jf-drop:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
}

.modal.modal--trade .modal__body {
  padding: 8px 18px 18px;
}

.trade-form.jf {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jf-row {
  display: grid;
  gap: 8px;
}

.jf-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.jf-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.jf-field {
  min-width: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--tile);
}

.jf-field > label {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.jf-opt {
  font-weight: 400;
  color: var(--text-2);
}

.jf-input,
.jf-select {
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
  color-scheme: inherit;
}

.jf-input::placeholder {
  color: var(--text-3);
  font-weight: 400;
}

.jf-input:focus,
.jf-select:focus {
  outline: none;
}

.jf-field:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--lead);
}

.jf-select option {
  background: var(--desk-hi);
  color: var(--text-1);
}

.jf-field--notes textarea {
  min-height: 56px;
  resize: vertical;
  font-weight: 400;
}

.jf-static {
  min-height: 28px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
}

.jf-dt {
  display: flex;
  gap: 8px;
}

.jf-dt .jf-input {
  min-width: 0;
}

.jf-dt .jf-input[type="time"] {
  flex: 0 0 auto;
  width: 5.5em;
}

/* A refused save, and the live notes (the stop on the wrong side is red as in
   the mockup; the others are amber and inform only). */
.jf-field.has-error,
.jf-fig.has-error,
.jf-field.has-flag-loss {
  box-shadow: inset 0 0 0 1.5px var(--loss);
}

.jf-field.has-flag-warn {
  box-shadow: inset 0 0 0 1.5px var(--warn);
}

.jf-msgs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.jf-msgs:empty {
  display: none;
}

.jf-msg {
  margin: 0 4px;
  font-size: 13px;
  color: var(--warn);
}

.jf-msg--error {
  color: var(--loss);
}

/* A refused save's message, standing in its field's box (or right under the
   row the field shares): inside a box the box pads it. */
.jf-field > .jf-msg--at {
  margin: 4px 0 0;
}

/* Long / Short, and the smaller choices in the tile. */
.jf-seg {
  display: grid;
  gap: 0;
  padding: 2px;
  border-radius: 999px;
  background: var(--seg-track);
}

.jf-seg--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.jf-seg--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.jf-seg__opt {
  min-height: 40px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
}

.jf-seg__opt:hover {
  color: var(--text-1);
}

.jf-seg__opt.is-active {
  background: var(--seg-thumb);
  color: var(--seg-ink);
  box-shadow: var(--seg-lift);
}

.jf-seg--sm .jf-seg__opt {
  min-height: 34px;
  font-size: 13px;
}

/* The tile: risk, at the stop, the result in R. */
.jf-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--tile);
}

.jf-figs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.jf-fig {
  min-width: 0;
  border-radius: 12px;
}

.jf-fig__v {
  display: flex;
  align-items: baseline;
  gap: 2px;
  min-height: 32px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.jf-fig__v i {
  font-style: normal;
  font-size: 14px;
  color: var(--text-2);
}

.jf-fig__in {
  field-sizing: content;
  min-width: 2ch;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

.jf-fig__in::placeholder {
  color: var(--text-3);
}

.jf-fig__in:focus {
  outline: 2px solid var(--lead);
  outline-offset: 3px;
  border-radius: 6px;
}

.jf-fig > label,
.jf-fig__k {
  display: block;
  font-size: 13px;
  color: var(--text-2);
}

.jf-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 14px;
  font-size: 13px;
  color: var(--text-2);
}

.jf-meta b {
  font-weight: 500;
  color: var(--text-1);
}

.jf-meta b.text-profit {
  color: var(--gain);
}

.jf-meta b.text-loss {
  color: var(--loss);
}

.jf-hint {
  display: block;
  font-size: 13px;
  color: var(--text-2);
}

.jf-hint[hidden] {
  display: none;
}

/* The screenshot drop zone. */
.jf-drop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: var(--tile);
  text-align: center;
  color: var(--text-2);
  cursor: pointer;
}

.jf-drop:hover {
  background: var(--tile-2);
  color: var(--text-1);
}

.jf-drop.is-over {
  background: var(--tile-2);
  box-shadow: inset 0 0 0 1.5px var(--lead);
  color: var(--text-1);
}

.jf-drop.is-off {
  cursor: default;
  font-size: 13px;
}

.jf-drop__hint {
  font-size: 13px;
  color: var(--text-2);
}

.jf-drop.is-off .jf-drop__hint {
  display: none;
}

.jf-drop__files {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jf-drop__files:empty {
  display: none;
}

.jf-drop__files li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  background: var(--tile-2);
  font-size: 13px;
  color: var(--text-1);
}

.jf-drop__files li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.jf-x {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--tile-2);
  color: var(--text-2);
  cursor: pointer;
}

.jf-x:hover {
  color: var(--text-1);
}

/* More details. */
.jf-more {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.jf-more > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.jf-more > summary::-webkit-details-marker {
  display: none;
}

.jf-more > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.jf-more[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.jf-more > summary:hover {
  color: var(--text-1);
}

.jf-more > summary:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
  border-radius: 8px;
}

.jf-more__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 6px;
}

.jf-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jf-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.jf-block__head > label,
.jf-block__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.jf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--lead);
  cursor: pointer;
}

.jf-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.jf-partials {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jf-partial {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.jf-partial .jf-field {
  flex: 1 1 0;
}

.jf-partial .jf-field--pct {
  flex: 0 0 96px;
}

.jf-partial .jf-x {
  align-self: center;
}

.jf-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-size: 13px;
  color: var(--text-2);
}

/* The tick box and the choice dot in an account dialog (Delete account, New
   challenge, the backup day): the sign-in page's box (auth/auth.css .check
   input) - 22px, a tile with a hairline, the lead colour when chosen - not the
   browser's 13px one. Set here with one more selector than access.css's
   `.acct-check input`, which keeps the row's layout. */
.acct-check input[type="checkbox"],
.acct-check input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  margin: -1px 0 0;
  border-radius: 6px;
  background: var(--tile);
  box-shadow: inset 0 0 0 1.5px var(--line);
  cursor: pointer;
}

.acct-check input[type="radio"] {
  border-radius: 50%;
}

.acct-check input[type="checkbox"]:checked,
.acct-check input[type="radio"]:checked {
  background: var(--lead);
  box-shadow: none;
}

.acct-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--on-lead);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.acct-check input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--on-lead);
}

.acct-check input[type="checkbox"]:focus-visible,
.acct-check input[type="radio"]:focus-visible {
  outline: 2px solid var(--lead);
  outline-offset: 2px;
}

.acct-check label {
  cursor: pointer;
}

/* Phone: the same column, the figures stacked a step tighter. */
@media (max-width: 700px) {
  /* The mockup's phone sheet: account, symbol, setup and the opened date each
     have the whole width, so none of them is cut short. */
  .jf-row--stack {
    grid-template-columns: minmax(0, 1fr);
  }

  .jf-row--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jf-row--3 > .jf-field:last-child {
    grid-column: 1 / -1;
  }

  .jf-figs {
    gap: 6px;
  }

  .jf-fig__v {
    font-size: 19px;
  }


  /* 16px: iOS zooms into anything smaller on focus. */
  .jf-input,
  .jf-select,
  .jf-fig__in {
    font-size: 16px;
  }
}

/* The trade form is a bottom sheet up to 880 px (modal.css): its last field clears the home indicator. */
@media (max-width: 880px) {
  .modal.modal--trade .modal__body {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
}
