/*
 * The journal view's own styling.
 *
 * REUSES `method.css` RATHER THAN COPYING IT. The journal container carries
 * BOTH `method-view` and `journal-view`, so panels, grids, tags, counts and
 * the colour tokens come from the one place that already defines them. A
 * second copy of that visual language would drift, and this repo has paid for
 * a drifting copy more than once.
 *
 * The cost is a class named `method-view` doing duty as the app's general page
 * shell. That is a naming problem rather than a structural one, and renaming a
 * stylesheet that was reviewed two PRs ago is not worth bundling into this
 * change — noted here so the next person knows it was seen, not missed.
 *
 * Everything below is scoped under `.journal-view` and adds only what the
 * journal needs: forms, figures and the entry panel.
 */
.method-view.journal-view {
  /* Keep the journal on the shared dashboard surfaces without changing the
     separate method accents that carry domain meaning. The journal fixture
     inlines this stylesheet without dashboard tokens, so each alias falls
     back to the same Planner value (#423) when the shared app tokens are
     absent. */
  --m-ink: var(--ink, #1f2933);
  --m-ink-soft: var(--muted, #56626e);
  --m-ink-faint: var(--faint, #5f6b78);
  --m-ground: var(--ground, #e7eaee);
  --m-card: var(--surface, #f7f8fa);
  --m-rule: var(--line, #cbd2da);
  --m-warn: var(--accent, #6e5217);
  --m-warn-ground: var(--accent-soft, #efe4cb);
  --j-action: var(--action, var(--m-accent));
  --j-action-fill: var(--action-fill, var(--m-accent));
  --j-action-soft: var(--action-soft, var(--m-ground));
  --j-focus: var(--focus, var(--m-accent));
  --j-muted: var(--muted, var(--m-ink-soft));
  --j-surface-2: var(--surface-2, var(--m-ground));
  --j-line: var(--line, var(--m-rule));
  --j-line-strong: var(--line-strong, var(--m-rule));
  --j-on-action: var(--on-action, #ffffff);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .method-view.journal-view {
    --m-ink: var(--ink, #e3e7ea);
    --m-ink-soft: var(--muted, #a3aeb9);
    --m-ink-faint: var(--faint, #96a2ae);
    --m-ground: var(--ground, #161c22);
    --m-card: var(--surface, #1e262e);
    --m-rule: var(--line, #2c3640);
    --m-warn: var(--accent, #e3c47a);
    --m-warn-ground: var(--accent-soft, #3a3019);
  }
}
:root[data-theme="dark"] .method-view.journal-view {
  --m-ink: var(--ink, #e3e7ea);
  --m-ink-soft: var(--muted, #a3aeb9);
  --m-ink-faint: var(--faint, #96a2ae);
  --m-ground: var(--ground, #161c22);
  --m-card: var(--surface, #1e262e);
  --m-rule: var(--line, #2c3640);
  --m-warn: var(--accent, #e3c47a);
  --m-warn-ground: var(--accent-soft, #3a3019);
}
.method-view.journal-view .btn:not(:disabled):hover { color: var(--j-action); border-color: var(--j-action); }
.method-view.journal-view .btn:disabled {
  color: var(--j-muted);
  background: var(--j-surface-2);
  border-color: var(--j-line);
  cursor: not-allowed;
  opacity: 1;
}
.journal-view .panel-entry { border-color: var(--j-action); }
.journal-view .panel-detail { border-left: 4px solid var(--j-line-strong); scroll-margin-top: 16px; }
/* #406: the detail is the LAST panel on a long page. The reveal scrolls to
 * its heading (scroll-margin keeps it clear of the viewport edge) and the
 * back control returns to the row — or monitor button — that opened it. */
.journal-view .journal-detail-back { display: block; min-height: 44px; margin: 0 0 2px; }

.journal-view .fields,
.method-view .fields,
.obs-panel .fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.journal-view label,
.method-view .fields label,
.obs-panel .fields label,
.obs-panel label.wide {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .82rem; color: var(--m-ink-soft);
}
/* The direction select carries words, not just a value (#138), and its
   options were clipped to "Long — profits if th…" in a single 9rem track at
   the wide layout. Two tracks hold the whole option; below 480px the fields
   grid is one column, so the span is left off rather than forcing an
   implicit second track. */
@media (min-width: 480px) {
  .journal-view .fields .field-direction { grid-column: span 2; }
}
.journal-view label.wide { display: block; margin-bottom: 12px; }
/* A one-line label with the clarification UNDER the input (#420): a wrapped
   label pushed the stop input below its neighbours' row. */
.journal-view .fields label .field-hint {
  font-size: .74rem; line-height: 1.3; color: var(--m-ink-soft); opacity: .85;
}

.journal-view input,
.journal-view select,
.journal-view textarea,
.obs-panel input,
.obs-panel select {
  font: inherit; font-size: .9rem;
  min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--m-rule); border-radius: 8px;
  background: var(--m-card); color: var(--m-ink);
  width: 100%; min-width: 0;
}
.journal-view textarea { min-height: 66px; resize: vertical; }
.journal-view input:focus-visible,
.journal-view select:focus-visible,
.journal-view textarea:focus-visible {
  outline: 2px solid var(--j-focus); outline-offset: 1px;
}
.obs-panel input:focus-visible,
.obs-panel select:focus-visible {
  outline: 2px solid var(--focus, var(--m-accent)); outline-offset: 1px;
}

/* The planned-risk preview (#123): one line of figures, one line of caveat,
   between the numbers it is made of and the rationale below them. */
.journal-view .entry-risk {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--j-line-strong);
  border-radius: 0 8px 8px 0;
  background: var(--m-ground);
}
.journal-view .entry-risk-line { margin: 0 0 4px; font-size: .9rem; color: var(--m-ink); }
.journal-view .entry-risk-line strong { font-variant-numeric: tabular-nums; }
.journal-view .entry-risk-note { margin: 0; font-size: .78rem; color: var(--m-ink-soft); }
/* #429: the dated reference close under the entry fields — reference
 * wording in the same quiet ink, its Use-this-price press a full target.
 * Its own class, not entry-risk-note: consumers of that selector must keep
 * finding the risk block's own caveats, not this one. */
.journal-view .entry-reference { display: grid; gap: 3px; margin: -4px 0 8px; }
.journal-view .entry-reference-note { margin: 0; font-size: .78rem; color: var(--m-ink-soft); }
.journal-view .entry-reference .entry-reference-use { min-height: 44px; justify-self: start; }
/* #427: the exchange rate and its date, only for an AUD account and a USD trade. */
.journal-view .entry-fx {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end;
  margin: 10px 0; padding: 0 0 10px; border-bottom: 1px dashed var(--m-rule);
}
.journal-view .entry-fx[hidden] { display: none; }
.journal-view .entry-fx label { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: var(--m-ink-soft); min-width: 0; }
.journal-view .entry-fx input { font: inherit; font-size: .9rem; max-width: 12rem; }
.journal-view .entry-fx .entry-risk-note { flex-basis: 100%; }
/* #586: the Tiingo close on offer, on its own line beneath the boxes, offered or in use alike. */
.journal-view .entry-fx .entry-fx-suggestion { flex-basis: 100%; margin: 0; font-size: .85rem; }
.journal-view .entry-fx .entry-fx-suggestion[hidden] { display: none; }
.journal-view .entry-fx .entry-fx-suggestion .btn { min-height: 44px; margin-left: 6px; }
/* #634: the guaranteed-stop mark and the deal ticket's two figures, CFD account only. */
.journal-view .entry-guaranteed {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end;
  grid-column: 1 / -1; margin: 4px 0; padding: 8px 0; border-top: 1px dashed var(--m-rule); border-bottom: 1px dashed var(--m-rule);
}
.journal-view .entry-guaranteed[hidden] { display: none; }
.journal-view .entry-guaranteed label { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; color: var(--m-ink-soft); min-width: 0; }
.journal-view .entry-guaranteed label.check { flex-basis: 100%; flex-direction: row; align-items: center; gap: 8px; min-height: 44px; font-size: .9rem; color: inherit; }
.journal-view .entry-guaranteed label.check input { width: 20px; height: 20px; min-height: 0; flex: none; }
.journal-view .entry-guaranteed input[type="text"] { font: inherit; font-size: .9rem; max-width: 12rem; }
.journal-view .entry-guaranteed .entry-risk-note { flex-basis: 100%; margin: 0; }

.journal-view .btn {
  font: inherit; font-size: .85rem; line-height: 1;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--m-rule); border-radius: 8px;
  background: var(--m-card); color: var(--m-ink); cursor: pointer;
}
.journal-view .btn-primary {
  background: var(--j-action-fill); border-color: var(--j-action-fill); color: var(--j-on-action);
}
.journal-view .btn:focus-visible { outline: 2px solid var(--j-focus); outline-offset: 2px; }
.journal-view .btn-primary:disabled,
.journal-view .btn-primary:disabled:hover {
  color: var(--j-muted);
  background: var(--j-surface-2);
  border-color: var(--j-line);
}

/*
 * THE PRIMARY BUTTON'S LABEL DISAPPEARED ON HOVER.
 *
 * `method.css` has `.method-view .btn:hover { color: var(--m-accent) }`, while
 * the primary button uses the action colour as its background. Keep the
 * primary label white through hover and keyboard focus rather than inheriting
 * the generic green label colour.
 *
 * Stated as its own rule rather than by weakening the shared hover, because
 * the shared one is right for every other button in both views.
 */
.journal-view .btn-primary:hover,
.journal-view .btn-primary:focus-visible {
  color: var(--j-on-action);
  background: var(--j-action-fill);
  border-color: var(--j-action-fill);
}

.journal-view .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.journal-view .why { margin: 0; font-size: .82rem; color: var(--m-depart); flex-basis: 100%; }

.journal-view .linkish {
  font: inherit; font-weight: 650; background: none; border: 0; padding: 0;
  color: var(--j-action); cursor: pointer; text-align: left;
  /* A row target on a phone still needs to be reachable with a thumb. */
  min-height: 44px;
}
.journal-view .linkish:focus-visible { outline: 2px solid var(--j-focus); outline-offset: 2px; }
.journal-view tr.is-selected {
  background: var(--j-action-soft);
  box-shadow: inset 3px 0 0 var(--j-action);
}

.journal-view table.grid td.n { text-align: right; font-variant-numeric: tabular-nums; }

.journal-view .figures,
.journal-view .state-counts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 12px; margin: 14px 0;
}
.journal-view .figures div,
.journal-view .state-counts div { border-top: 1px solid var(--m-rule); padding-top: 8px; }
.journal-view .figures dt,
.journal-view .state-counts dt { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--m-ink-faint); }
.journal-view .figures dd,
.journal-view .state-counts dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }

.journal-view blockquote {
  margin: 8px 0 0; padding: 10px 14px;
  border-left: 3px solid var(--m-rule); background: var(--m-ground);
}
.journal-view blockquote cite { display: block; margin-top: 6px; font-size: .78rem; color: var(--m-ink-faint); font-style: normal; }

.journal-view ul.exits,
.journal-view ul.amendments { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; font-size: .88rem; }

.journal-view .close-form { margin-top: 18px; border-top: 1px solid var(--m-rule); padding-top: 14px; }
/* #414: the add form's footnote clears its button. */
.journal-view .add-note { margin-top: 8px; }
.journal-view .capital-note { margin: 0 0 12px; }
.journal-view .notice-alert { border-color: var(--m-accent); background: color-mix(in srgb, var(--m-accent) 8%, var(--m-card)); }

/* The streak caution (#29 item 7, #413): quiet, never a gate, one run over
   the whole journal (#685). */
.journal-view .streak-caution {
  border: 1px solid var(--m-rule);
  border-left: 3px solid var(--m-warn);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 14px 0 0;
  background: var(--m-warn-ground);
  font-size: .92rem;
}
.journal-view .streak-caution p { margin: 0 0 6px; max-width: 46rem; }
.journal-view .streak-caution p:last-of-type { margin-bottom: 0; }
.journal-view .streak-caution .streak-seed { font-size: .78rem; color: var(--m-ink-faint); }
.journal-view .streak-unknown { border-left-color: var(--m-rule); background: transparent; }
.journal-view .streak-unknown p { color: var(--m-ink-soft); margin-bottom: 0; }
.journal-view .streak-caution .linkish { display: block; margin-top: 4px; }

@media (prefers-color-scheme: dark) {
  .journal-view tr.is-selected { background: var(--j-action-soft); }
}
:root[data-theme="dark"] .journal-view tr.is-selected { background: var(--j-action-soft); }

.journal-view .journal-tools {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 18px 0 0;
}
.journal-view .journal-tools .hint {
  font-size: .82rem; color: var(--m-ink-soft); flex: 1 1 18rem; min-width: 0;
}

/* The candidate an entry was started from (#87).
   Set apart from the form fields because it is evidence rather than input:
   nothing in it is editable, and it says so by not looking editable. */
.journal-view .candidate {
  border: 1px solid var(--m-line, #d9d9d9);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 0 0 16px;
}
.journal-view .candidate-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 0 0 6px;
}
.journal-view .candidate-head button { min-height: 44px; }
.journal-view .candidate-source,
.journal-view .candidate-direction,
.journal-view .candidate-label {
  margin: 6px 0 4px;
  font-size: 0.85rem;
  color: var(--m-muted, #5b6772);
}
.journal-view .candidate-direction { font-weight: 650; }
.journal-view .candidate-label { font-weight: 650; }
.journal-view .candidate-notes {
  margin: 0 0 8px;
  padding-left: 1.1em;
  font-size: 0.85rem;
}
.journal-view .candidate-notes li { margin: 2px 0; }
/* #373: the attached evidence folds, so the entry price, stop and sizing a
   phone user came for are not several screens below it. Native
   details/summary carries the expanded state and the keyboard toggle; this
   only makes the summary a real touch target and gives it visible focus. */
.journal-view .candidate-evidence { margin: 6px 0 0; }
.journal-view .candidate-evidence > summary {
  min-height: 44px;
  /* NOT display:flex: Chromium drops the native disclosure triangle with it,
     and the triangle is the only thing saying this line opens. The 44px
     target comes from padding plus line-height instead. */
  padding: 10px 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--m-ink, #1f2730);
}
.journal-view .candidate-evidence > summary:focus-visible {
  outline: 2px solid var(--j-focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.journal-view .candidate-evidence > summary::marker { color: var(--m-muted, #5b6772); }
.journal-view .candidate-evidence[open] > summary { margin-bottom: 4px; }

/* The recorded process assessment (#92).

   THE GRADE IS THE HEADLINE OF THIS PANEL, and the first rendered pass showed
   it was not reading like one: plain text, indistinguishable from the
   explanation under it, on a panel whose entire point is that one word. The
   answer also ran straight into its question — "not before or after it
   Followed" — because the state had no styling to separate it.

   Colour is never the only signal. `followed` and `departed` carry different
   WORDS as well as different colours, and `unrecorded` is deliberately quiet
   rather than green: nothing was assessed, and a neutral badge that reads as
   a pass is the exact failure `gradeTrade` fails closed to avoid. */
.journal-view .panel-process { margin: 0 0 18px; }
.journal-view .process-grade {
  margin: 2px 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.journal-view .process-followed { color: var(--m-accent); }
.journal-view .process-departed { color: var(--m-depart); }
.journal-view .process-unrecorded { color: var(--m-ink-faint); }

.journal-view .answers { margin: 10px 0 0; padding-left: 0; list-style: none; }
.journal-view .answers li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 7px 0;
  border-top: 1px solid var(--m-rule);
}
.journal-view .answer-label { flex: 1 1 14rem; min-width: 0; }
/* The separator the first render was missing. A badge, not a trailing word. */
.journal-view .answer-state {
  flex: 0 0 auto;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--m-rule);
  color: var(--m-ink-soft);
}
.journal-view .answer-followed { background: color-mix(in srgb, var(--m-accent) 14%, var(--m-card)); color: var(--m-accent); }
.journal-view .answer-departed { background: color-mix(in srgb, var(--m-depart) 14%, var(--m-card)); color: var(--m-depart); }
.journal-view .answer-note {
  flex: 1 1 100%;
  margin: 2px 0 0;
  font-size: .85rem;
  color: var(--m-ink-soft);
}
.journal-view .answer-unreadable { color: var(--m-ink-faint); font-size: .85rem; }

.journal-view .answer-history { margin: 12px 0 0; }
.journal-view .answer-history ul { margin: 0; padding-left: 1.1em; }
.journal-view .answer-history li {
  margin: 3px 0;
  font-size: .82rem;
  color: var(--m-ink-soft);
}

.journal-view .process-form { margin: 12px 0 0; }
.journal-view .process-question {
  padding: 10px 0;
  border-top: 1px solid var(--m-rule);
}
.journal-view .process-form .actions { margin-top: 12px; }
.journal-view .process-form button { min-height: 44px; }

.journal-view .disciplined-loss {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--m-accent);
  background: var(--m-ground);
  font-size: .85rem;
  color: var(--m-ink-soft);
}

/*
 * The account (#125). Its container carries `journal-view` as well, so
 * forms, buttons, figures and correction lists come from above; these are
 * only the pieces the journal has no equivalent of. Tokens only, so the dark
 * theme needs nothing of its own.
 */
.account-view .account-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.account-view .account-choice { min-height: 44px; }
.account-view .account-choice.is-selected { border: 2px solid var(--j-action); font-weight: 650; }
.account-view .account-title { margin: 0 0 12px; }
.account-view .account-age { margin: 0 0 8px; font-size: .9rem; color: var(--m-ink-soft); }
.account-view .account-age-old {
  padding: 8px 10px;
  border-left: 3px solid var(--m-warn);
  background: var(--m-warn-ground);
  color: var(--m-ink);
}
.account-view .account-breach {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--m-depart);
  color: var(--m-ink);
}
.account-view .account-note,
.account-view .account-rule { margin: 8px 0 0; font-size: .82rem; color: var(--m-ink-soft); }
/* The stop-rule provenance tags (#258) — same palette as the method page. */
.account-view .tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}
.account-view .tag-book { background: color-mix(in srgb, var(--m-accent) 14%, var(--m-card)); color: var(--m-accent); }
.account-view .tag-tuned { background: color-mix(in srgb, var(--m-tuned) 14%, var(--m-card)); color: var(--m-tuned); }
.account-view .tag-unknown { background: color-mix(in srgb, var(--m-ink-soft) 6%, var(--m-card)); color: var(--m-ink-soft); }
.account-view .row-actions,
.obs-panel .row-actions { white-space: nowrap; }
.account-view .row-actions .btn,
.obs-panel .row-actions .btn { min-height: 44px; }
.account-view .account-edit,
.obs-panel .account-edit { padding: 6px 0 10px; }
.account-view .account-edit p,
.obs-panel .account-edit p { margin: 0 0 8px; }
/* #428: edit, retire and reactivate. Retired is a state, not an alarm: the
   warm warning ground the method page uses for "look at this", no red. */
.account-view .tag-retired { background: var(--m-warn-ground); color: var(--m-warn); border: 1px solid var(--m-warn); }
/* #609: a CFD account's kind; ink over a tint of itself, one rule for both themes. */
.account-view .tag-cfd, .journal-view .tag-cfd { background: color-mix(in srgb, var(--m-accent) 14%, var(--m-card)); color: var(--m-accent); }
.account-view .close-out-figures { margin-top: 12px; }
.account-view .account-picker-retired { align-items: center; margin-top: -8px; }
.account-view .account-picker-label { font-size: .82rem; color: var(--m-ink-soft); margin-right: 4px; }
.account-view .account-choice.is-retired { color: var(--m-ink-soft); }
.account-view .account-title .btn-small { min-height: 44px; margin-left: 8px; font-size: .85rem; vertical-align: middle; }
.account-view .account-retired p { margin: 0 0 8px; }
.account-view .account-details h3 { margin: 18px 0 6px; font-size: 1rem; }
.account-view .account-cfd-terms h3 { margin: 18px 0 6px; font-size: 1rem; }
/* #774 4d: an account's own settings, one per row, each with its source. */
.account-view .account-setting-list { list-style: none; padding: 0; margin: 0; }
.account-view .account-setting { padding: 10px 0; border-bottom: 1px solid var(--m-rule); overflow-wrap: anywhere; }
.account-view .account-setting h3 { margin: 0 0 4px; font-size: 1rem; }
.account-view .account-setting-value { margin: 0 0 6px; }
/* #774: each limit with its own Correct and Remove; the corrections fold away. */
.account-view .limit-history { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.account-view .limit-history > li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 0; border-bottom: 1px solid var(--m-rule); overflow-wrap: anywhere; }
.account-view .limit-history > li > .actions { display: flex; gap: 8px; margin-left: auto; }
.account-view .limit-history .btn-small { min-height: 44px; }
.account-view .limit-history .account-edit { flex-basis: 100%; }
.account-view .limit-corrections { margin: 0 0 12px; }
.account-view .limit-corrections summary { min-height: 44px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
/* #774: the Account panel — a row per field: label, value, its own control.
   On a phone the label sits over the value and the control beside it. */
.account-view .account-fields { margin: 0 0 12px; }
.account-view .account-field {
  display: grid; grid-template-columns: 10rem minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--m-rule);
}
.account-view .account-field dt { font-size: .88rem; color: var(--m-ink-soft); }
.account-view .account-field dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.account-view .account-field-value { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.account-view .account-field-value input, .account-view .account-field-value select { min-height: 44px; max-width: 20rem; }
.account-view .account-field-value .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account-view .account-field-control .btn-small { min-height: 44px; }
@media (max-width: 520px) {
  .account-view .account-field { grid-template-columns: minmax(0, 1fr) auto; }
  .account-view .account-field dt { grid-column: 1 / -1; }
}

/*
 * THE READINGS TABLE STACKS AT PHONE WIDTH. The first compact render kept
 * five columns in the table's scroll box, which put Correct and Remove —
 * the only way to change a figure — out of sight to the right, and broke
 * every date across two lines. At the edge `method.css` breaks at, each
 * reading becomes a block: date and figure on one line, then the note, when
 * it was entered, and its actions, all in view.
 */
@media (max-width: 560px) {
  .account-view table.readings,
  .account-view table.readings tbody,
  table.obs-table,
  table.obs-table tbody { display: block; }
  .account-view table.readings thead,
  table.obs-table thead { display: none; }
  .account-view table.readings tr[data-reading],
  table.obs-table tr[data-observation] {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--m-rule);
  }
  .account-view table.readings tr[data-reading] > th,
  .account-view table.readings tr[data-reading] > td,
  table.obs-table tr[data-observation] > th,
  table.obs-table tr[data-observation] > td { padding: 0; border: 0; }
  .account-view table.readings td.note,
  .account-view table.readings td.entered,
  .account-view table.readings td.row-actions,
  table.obs-table td.note,
  table.obs-table td.row-actions { grid-column: 1 / -1; }
  .account-view table.readings td.note-none,
  table.obs-table td.note-none { display: none; }
  .account-view table.readings td.entered::before { content: 'Entered '; }
  /* #609: a CFD reading's margin figures, each on its own line under its name. */
  .account-view table.readings td.margin-figure { grid-column: 1 / -1; text-align: left; }
  .account-view table.readings td.margin-figure::before { content: attr(data-label) ' '; color: var(--m-ink-soft); }
  .account-view table.readings td.row-actions,
  table.obs-table td.row-actions { display: flex; gap: 8px; white-space: normal; margin-top: 4px; }
  .account-view table.readings tr.edit-row,
  .account-view table.readings tr.edit-row > td,
  table.obs-table tr.edit-row,
  table.obs-table tr.edit-row > td { display: block; padding: 0; }
}

/* #29 outcome report. */
.journal-view .thresholds { margin: 10px 0; padding-left: 1.2rem; display: grid; gap: 6px; }
.journal-view .outcome-mode { margin-top: 18px; border-top: 1px solid var(--m-rule); padding-top: 12px; }
.journal-view .outcome-mode h3 { margin: 0 0 6px; }
.journal-view .withheld { color: var(--m-ink-faint); }
/* A phone gets each state as a block: the outcome sentence under its name and
   count, rather than a third column scrolled out of view. */
@media (max-width: 600px) {
  .journal-view table.outcome-states thead { display: none; }
  .journal-view table.outcome-states tr { display: grid; grid-template-columns: 1fr auto; }
  .journal-view table.outcome-states td:last-child { grid-column: 1 / -1; padding-top: 0; }
  /* #317: a symbol as a block — outcome and process under its name and count. */
  .journal-view table.outcome-symbols-table thead { display: none; }
  .journal-view table.outcome-symbols-table tr { display: grid; grid-template-columns: 1fr auto; }
  .journal-view table.outcome-symbols-table td:nth-child(3),
  .journal-view table.outcome-symbols-table td:nth-child(4) { grid-column: 1 / -1; padding-top: 0; }
  .journal-view table.outcome-symbols-table td[colspan] { grid-column: 1 / -1; }
}

/* #329: the open share monitor. Status words carry the meaning; colour only repeats it. */
.journal-view .scan-monitor .monitor-meta { margin: 0 0 10px; font-size: .85rem; color: var(--m-ink-soft); }
.journal-view .scan-monitor .monitor-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.journal-view .scan-monitor .monitor-entry { border: 1px solid var(--m-rule); border-left-width: 4px; padding: 10px 12px; background: var(--m-ground); }
.journal-view .scan-monitor .monitor-entry[data-status="review"] { border-left-color: var(--m-depart); }
.journal-view .scan-monitor .monitor-entry[data-status="not-assessed"] { border-left-color: var(--m-warn); }
.journal-view .scan-monitor .monitor-entry[data-status="no-review"] { border-left-color: var(--m-accent); }
.journal-view .scan-monitor .monitor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.journal-view .scan-monitor .monitor-head .monitor-meta { margin: 0; }
.journal-view .scan-monitor .monitor-head .linkish { margin-left: auto; min-height: 44px; }
.journal-view .scan-monitor .monitor-state { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; border: 1px solid currentColor; }
/* #389: every open position's review status, first on Positions — one row
   each, its words always visible, a 44px link to its card below. */
.journal-view .monitor-status [data-monitor-summary] { margin: 0 0 4px; }
.journal-view .monitor-status .monitor-index { list-style: none; margin: 0; padding: 0; }
.journal-view .monitor-status .monitor-index li { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: center; gap: 2px 10px; min-height: 44px; border-top: 1px solid var(--m-rule); }
.journal-view .monitor-status .monitor-index li:first-child { border-top: 0; }
.journal-view .monitor-status .monitor-index a { font-weight: 650; min-height: 44px; display: inline-flex; align-items: center; }
.journal-view .monitor-status .monitor-meta { font-size: .85rem; color: var(--m-ink-soft); }
.journal-view .monitor-status .monitor-state { justify-self: end; font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; border: 1px solid currentColor; }
.journal-view .scan-monitor .monitor-entry { scroll-margin-top: 1rem; }
.journal-view .scan-monitor .monitor-about > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 0.35em; }
.journal-view .scan-monitor .monitor-about > summary::-webkit-details-marker { display: none; }
.journal-view .scan-monitor .monitor-about > summary::before { content: "▸" / ""; color: var(--m-ink-soft); flex: 0 0 1em; }
.journal-view .scan-monitor .monitor-about[open] > summary::before { content: "▾" / ""; }
.journal-view :is(.scan-monitor, .monitor-status) .state-review { color: var(--m-depart); }
.journal-view :is(.scan-monitor, .monitor-status) .state-unassessed { color: var(--m-warn); }
.journal-view :is(.scan-monitor, .monitor-status) .state-quiet { color: var(--m-accent); }
.journal-view :is(.scan-monitor, .monitor-status) .state-pending { color: var(--m-ink-soft); }
.journal-view .scan-monitor [data-review-check] { margin: 8px 0 0; }
.journal-view .scan-monitor .monitor-entry .hint { margin-left: 0; display: inline; }
.journal-view .scan-monitor .monitor-evidence { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: .88rem; }
.journal-view .scan-monitor .monitor-evidence dt { color: var(--m-ink-soft); }
.journal-view .scan-monitor .monitor-evidence dd { margin: 0; overflow-wrap: anywhere; }
/* #338: a check's reason is the honest part of a not-assessed state, so it
   stays visible on a phone, where the page hides ordinary hints; and a saved
   review's scan and evidence ids wrap rather than widen the page. */
.journal-view .position-review [data-review-check] .hint,
.journal-view .position-review [data-saved-review] .hint { display: inline; margin-left: 0; }
.journal-view .position-review [data-saved-review] { overflow-wrap: anywhere; }
.journal-view .position-monitor { margin-top: 1.25rem; }
.journal-view .position-monitor h3 { margin-top: 0; }
.journal-view .position-monitor > .hint,
.journal-view .position-review-current .hint { display: block; margin-left: 0; }
.journal-view .position-actions { margin: 1rem 0 1.5rem; }
.journal-view .position-actions > summary,
.journal-view .position-monitor summary,
.journal-view .position-review summary { min-height: 44px; align-content: center; }
/* #333: the basis labels are long; on a phone each value sits under its label. */
@media (max-width: 560px) {
  .journal-view .scan-monitor .monitor-evidence { grid-template-columns: 1fr; gap: 0; }
  .journal-view .scan-monitor .monitor-evidence dd { margin-bottom: 6px; }
}

/* issue432: distinct review choices, shared by Today and the opened record. */
.position-guidance { margin: 1rem 0; min-width: 0; overflow-wrap: anywhere; }
.position-guidance h4 { margin: 0 0 .65rem; font-size: 1rem; }
.position-guidance .guidance-context { font-size: .85rem; color: var(--m-ink-soft); margin: 0 0 .5rem; }
.position-guidance .guidance-list { list-style: none; display: grid; gap: .6rem; padding: 0; margin: 0; }
.position-guidance .guidance-list > li { padding: .75rem; border: 1px solid var(--m-rule); border-left-width: 3px; background: var(--m-ground); min-width: 0; }
.position-guidance .guidance-review { border-left-color: var(--m-depart) !important; }
.position-guidance .guidance-not-assessed { border-left-color: var(--m-warn) !important; }
.position-guidance .guidance-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .75rem; }
.position-guidance .guidance-title span { font-size: .8rem; border: 1px solid currentColor; border-radius: 3px; padding: .1rem .4rem; }
.position-guidance .guidance-date { display: block; color: var(--m-ink-soft); font-size: .85rem; margin-top: .3rem; }
.position-guidance p { margin: .4rem 0 0; }
.position-guidance button { min-height: 44px; margin-top: .6rem; white-space: normal; }
.position-guidance summary { min-height: 44px; align-content: center; cursor: pointer; }
.position-guidance details { margin-top: .5rem; }
.position-guidance blockquote { margin: .5rem 0; padding-left: .75rem; border-left: 2px solid var(--m-rule); }
.position-guidance .hint { display: block !important; margin-left: 0; }
.guidance-action-note { padding: .75rem; border-left: 3px solid var(--m-accent); background: var(--m-ground); }
.position-guidance.guidance-compact .guidance-list { gap: .4rem; }
.position-guidance.guidance-compact .guidance-list > li { padding: .5rem .65rem; }
.today-view [data-today-position] > .position-guidance,
.today-view [data-today-position] > .guidance-source { flex-basis: 100%; }
.today-view .position-guidance .guidance-list > li { display: block; }
.today-view [data-today-position] > .guidance-source > summary { min-height: 44px; align-content: center; cursor: pointer; }
@media (min-width: 1100px) {
  .position-guidance:not(.guidance-compact) .guidance-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* IS432: position cue card. Each row names its state in words; colour, the diamond and the dashed
   outline only repeat it, so no row relies on colour alone. A phone stacks every row. */
.journal-view .scan-monitor .cue-rows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.journal-view .scan-monitor .cue-row { display: grid; grid-template-columns: 9.5rem 1fr; gap: 2px 12px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--m-rule); }
.journal-view .scan-monitor .cue-row:first-child { border-top: 0; }
.journal-view .scan-monitor .cue-title { font-weight: 700; }
.journal-view .scan-monitor .cue-chip { justify-self: start; grid-column: 1; font-size: .8rem; font-weight: 700; padding: 1px 8px; border: 1px solid currentColor; border-radius: 2px; }
.journal-view .scan-monitor .cue-result { grid-column: 2; grid-row: 1 / span 2; }
.journal-view .scan-monitor .cue-basis, .journal-view .scan-monitor .cue-meter-text { grid-column: 2; font-size: .85rem; color: var(--m-ink-soft); overflow-wrap: anywhere; }
.journal-view .scan-monitor .cue-review .cue-chip { color: var(--m-depart); background: var(--m-warn-ground, transparent); }
.journal-view .scan-monitor .cue-quiet .cue-chip { color: var(--m-ink-soft); border-radius: 10px; }
.journal-view .scan-monitor .cue-unassessed .cue-chip { color: var(--m-warn); border-style: dashed; border-radius: 10px; }
.journal-view .scan-monitor .cue-manual .cue-chip { color: var(--m-ink-soft); border-style: dotted; }
.journal-view .scan-monitor .cue-meter { grid-column: 2; width: 100%; max-width: 22rem; height: 12px; }
.journal-view .scan-monitor .cue-track { fill: var(--m-rule); }
.journal-view .scan-monitor .cue-fill { fill: var(--m-ink-soft); }
.journal-view .scan-monitor .cue-level { stroke: var(--m-depart); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
@media (max-width: 600px) {
  .journal-view .scan-monitor .cue-row { grid-template-columns: 1fr; }
  .journal-view .scan-monitor .cue-result, .journal-view .scan-monitor .cue-basis, .journal-view .scan-monitor .cue-meter, .journal-view .scan-monitor .cue-meter-text { grid-column: 1; grid-row: auto; }
}

/* #428: the account a trade belongs to — first in the entry form, on its own
   row, with its currency and the reading a size comes from beside it. */
.journal-view .entry-account {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 14px;
  margin: 0 0 12px;
}
.journal-view .entry-account label { display: flex; flex-direction: column; gap: 3px; flex: 0 1 22rem; min-width: 0; }
.journal-view .entry-account select { max-width: 100%; }
.journal-view .entry-account-meta { margin: 0 0 8px; font-size: .82rem; color: var(--m-ink-soft); flex: 1 1 14rem; min-width: 0; }
.journal-view .tag-account { background: var(--m-ground); color: var(--m-ink-soft); border: 1px solid var(--m-rule); }
.journal-view .tag-account.is-retired { font-style: italic; }
.journal-view .tag-unlinked { background: transparent; color: var(--m-ink-soft); border: 1px dashed var(--m-rule); }
.journal-view .journal-account { margin: 0 0 12px; font-size: .9rem; }
.journal-view .journal-account-unlinked {
  padding: 10px 12px; border: 1px dashed var(--m-rule); border-radius: 8px;
}
.journal-view .journal-account-unlinked p { margin: 0 0 8px; }
.journal-view .journal-link-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 6px; }
.journal-view .journal-link-form label { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 100%; }
.journal-view .journal-link-form select { max-width: 100%; }
.journal-view .journal-basis {
  margin: 14px 0; padding: 10px 12px; border-left: 3px solid var(--m-rule);
  background: var(--m-ground); border-radius: 0 8px 8px 0;
}
.journal-view .journal-basis h3 { margin: 0 0 4px; font-size: .9rem; }
.journal-view .journal-basis p { margin: 0 0 4px; font-size: .88rem; overflow-wrap: anywhere; }
.journal-view .journal-filter { display: flex; align-items: center; gap: 6px; font-size: .88rem; }
.journal-view .journal-filter select { max-width: 16rem; }
/* #774: "Show" sits left over its select, like the app's other field labels. */
.journal-view .journal-filter:has(#j-filterAccount) { align-items: flex-start; }

/* #475: Trades › Plan · Positions · History. The sub-view links are real
   anchors with the destination strip's 44px target; on a phone the three
   share the width rather than scrolling. Hidden panes stay in the DOM (the
   controller reads the form from any of them), so their [hidden] must win
   over any display rule — this page's fixture has no global [hidden] rule. */
.journal-view .trades-nav {
  display: flex; gap: 4px; margin: 0 0 16px;
  border-bottom: 1px solid var(--m-line, #d9d9d9);
}
.journal-view .trades-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-weight: 600; text-decoration: none; color: var(--m-ink-soft);
}
.journal-view .trades-tab:hover { color: var(--j-action); }
.journal-view .trades-tab[aria-current] { color: var(--j-action); border-bottom-color: var(--j-action); }
.journal-view .trades-tab:focus-visible { outline: 2px solid var(--j-action); outline-offset: 2px; border-radius: 4px; }
.journal-view .trades-tab .count { font-weight: 500; }
@media (max-width: 520px) {
  .journal-view .trades-tab { flex: 1 1 0; padding: 8px 6px; }
}
.journal-view .trades-pane[hidden],
.journal-view .journal-tools[hidden],
.journal-view [data-plan-share][hidden],
.journal-view .notice[hidden] { display: none; }
/* #481: Plan's two paths, a share trade or an option trade. A pair of pills
   under the sub-view links, so they read as a choice inside Plan rather than
   a fourth sub-view; 44px targets, sharing the width on a phone. */
.journal-view .plan-paths { display: flex; gap: 8px; margin: 0 0 16px; }
.journal-view .plan-paths .trades-tab {
  margin: 0; border: 1px solid var(--m-line, #d9d9d9); border-radius: 999px;
  padding: 8px 18px; font-weight: 600;
}
.journal-view .plan-paths .trades-tab[aria-current] {
  border-color: var(--j-action); background: color-mix(in srgb, var(--j-action) 10%, transparent);
}
@media (max-width: 520px) {
  .journal-view .plan-paths .trades-tab { flex: 1 1 0; padding: 8px 6px; }
}

/* #495: the Method → Accounts link never breaks inside its own name. */
.method-link { white-space: nowrap; }
/* #524: the equity estimate and its opt-in baseline. A dashed rule sets the
   estimate apart from the readings' figures: it is drawn, never recorded. */
.account-view .account-estimate .estimate-figures dd { border-bottom: 1px dashed var(--m-ink-soft); }
.account-view .estimate-excluded { margin: 4px 0 0; padding-left: 1.2rem; font-size: .85rem; }
.account-view .estimate-excluded li { margin: 2px 0; }
.account-view .baseline-confirm { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--j-line); border-radius: 6px; }
.account-view .baseline-confirm legend { font-weight: 650; padding: 0 4px; }
.account-view .baseline-confirm .hint { margin: 0 0 8px; font-size: .85rem; color: var(--m-ink-soft); }
.account-view .baseline-confirm label.check { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; margin: 6px 0; min-height: 44px; font-size: .9rem; }
.account-view .baseline-confirm label.check input { margin-top: 3px; width: 20px; height: 20px; min-height: 0; flex: none; }

/* #531: an open position's key figures and its price context. Tiles share
   the .figures rhythm; the chart takes the shared palette through classes,
   so both themes follow the tokens. */
.journal-view .position-summary { margin: 14px 0 18px; }
.journal-view .position-summary h3 { margin: 0 0 4px; }
/* #634: a guaranteed stop's price loss plus premium, on the review. */
.journal-view .guaranteed-stop { margin: 14px 0; padding: 10px 12px; border: 1px solid var(--m-rule); border-radius: 6px; }
.journal-view .guaranteed-stop h3 { margin: 0 0 4px; }
.journal-view .guaranteed-stop p { margin: 4px 0; overflow-wrap: anywhere; }
.journal-view .position-figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 10px 14px; margin: 8px 0 12px;
}
.journal-view .position-figures div { border-top: 1px solid var(--m-rule); padding-top: 6px; min-width: 0; }
.journal-view .position-figures dt { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--m-ink-faint); }
.journal-view .position-figures dd { margin: 2px 0 0; }
.journal-view .position-figures .pf-value { display: block; font-weight: 650; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.journal-view .position-figures .pf-dir { font-weight: 400; font-size: .85rem; color: var(--m-ink-soft); }
.journal-view .pf-sub { display: block; font-size: .8rem; color: var(--m-ink-soft); overflow-wrap: anywhere; }
.journal-view .position-figures [data-unassessed] .pf-value { color: var(--unknown); font-weight: 600; font-size: .95rem; }
.journal-view .position-figures [data-unassessed] { border-top-style: dashed; }
.journal-view .position-figures.compact { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 6px 12px; margin: 8px 0; }
.journal-view .position-figures.compact .pf-value { font-size: .98rem; }
.journal-view .position-figures-note,
.journal-view .position-chart-note { color: var(--unknown); font-size: .88rem; border-left: 3px dashed var(--line-strong); padding-left: 10px; }

.journal-view .position-chart { margin: 4px 0 10px; max-width: 900px; }
.journal-view .position-chart svg { display: block; width: 100%; height: auto; background: var(--m-card, var(--surface)); border: 1px solid var(--m-rule); }
.journal-view .position-chart .pc-price { fill: none; stroke: var(--action); stroke-width: 1.8; stroke-linejoin: round; }
.journal-view .position-chart .pc-entry { stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 6 4; }
.journal-view .position-chart .pc-first { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 3; }
.journal-view .position-chart .pc-stop { fill: none; stroke: var(--down); stroke-width: 2; }
.journal-view .position-chart .pc-risk { fill: var(--down); opacity: .13; }
.journal-view .position-chart .pc-grid { stroke: var(--line); stroke-width: .6; }
.journal-view .position-chart .pc-axis { fill: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.journal-view .position-chart .pc-label { font-size: 11.5px; font-weight: 600; font-family: var(--font-sans); }
.journal-view .position-chart svg.pc-narrow { display: none; }
.journal-view .position-chart .pc-narrow .pc-axis { font-size: 14px; }
.journal-view .position-chart .pc-narrow .pc-label { font-size: 15px; }
@media (max-width: 640px) {
  .journal-view .position-chart svg.pc-wide { display: none; }
  .journal-view .position-chart svg.pc-narrow { display: block; }
  .journal-view .position-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
}
.journal-view .position-chart .pc-l-stop { fill: var(--down); }
.journal-view .position-chart .pc-l-entry { fill: var(--ink); }
.journal-view .position-chart .pc-l-first { fill: var(--muted); }
.journal-view .position-chart .pc-l-close { fill: var(--action); }
.journal-view .position-chart .pc-last { fill: var(--action); stroke: var(--surface); stroke-width: 1.5; }
.journal-view .position-chart .pc-entry-mark path { fill: var(--ink); }
.journal-view .position-chart .pc-add circle { fill: var(--gold); stroke: var(--surface); stroke-width: 1.2; }
.journal-view .position-chart .pc-exit path { stroke: var(--up); stroke-width: 2.2; fill: none; }
.journal-view .pc-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 2px; padding: 0; font-size: .82rem; }
.journal-view .pc-legend li { display: inline-flex; align-items: center; gap: 6px; }
.journal-view .pc-key { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.journal-view .pc-k-price { border-color: var(--action); }
.journal-view .pc-k-entry { border-top: 2px dashed var(--ink); }
.journal-view .pc-k-first { border-top: 2px dotted var(--muted); }
.journal-view .pc-k-stop { border-color: var(--down); }
.journal-view .pc-k-risk { height: 10px; border: 0; background: color-mix(in srgb, var(--down) 18%, transparent); }
.journal-view .pc-k-add { width: 9px; height: 9px; border: 0; border-radius: 50%; background: var(--gold); }
.journal-view .pc-k-exit { width: 10px; height: 10px; border: 0; background: linear-gradient(45deg, transparent 42%, var(--up) 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--up) 42% 58%, transparent 58%); }
.journal-view .position-basis { margin-top: 6px; font-size: .88rem; }
.journal-view .position-basis summary { min-height: 44px; padding: 12px 0; box-sizing: border-box; cursor: pointer; }
.journal-view .position-basis ul { margin: 4px 0 0; padding-left: 1.2rem; display: grid; gap: 4px; }

/* #529: dated exchange rates, and the estimate's own record of them. */
.account-view .estimate-add-rates { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.account-view .estimate-add-rates .btn { min-height: 36px; }
.account-view [data-estimate-rates] .nowrap { white-space: nowrap; }
.account-view [data-fx-panel] .fx-note { margin: 8px 0 0; }
.account-view .fx-rates .row-actions { white-space: nowrap; }
.account-view .fx-rates th[scope="row"] { white-space: nowrap; }
.account-view .fx-rates .fx-entered { display: block; font-weight: 400; font-size: .75rem; white-space: normal; }
@media (max-width: 600px) {
  .account-view .fx-rates { min-width: 0; width: 100%; }
  .account-view .fx-rates thead { display: none; }
  .account-view .fx-rates tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--j-line); }
  .account-view .fx-rates tbody th, .account-view .fx-rates tbody td { display: block; padding: 0; border: 0; }
  .account-view .fx-rates td.n::before { content: "USD per 1 AUD"; display: block; font-size: .7rem; color: var(--m-ink-soft); }
  .account-view .fx-rates .row-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
}

/* #530: equity over time. Readings are filled squares in the ink colour;
   estimates are the action colour, solid when complete and hollow/dashed when
   partial, so shape carries the difference as well as colour. */
.account-view .equity-history { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--j-line); }
.account-view .equity-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.account-view .equity-head h3 { margin: 0; }
.account-view .equity-periods { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.account-view .equity-periods .btn { min-height: 36px; }
.account-view .equity-periods .btn[aria-pressed="true"] { background: var(--action-soft); border-color: var(--action); color: var(--ink); }
.account-view .eh-frame { margin: 8px 0 4px; }
.account-view .eh-chart { display: block; max-width: 100%; height: auto; touch-action: pan-y; }
.account-view .eh-chart:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.account-view .eh-grid { stroke: var(--line); stroke-width: 1; }
.account-view .eh-axis { fill: var(--muted); font-size: 11px; }
.account-view .eh-est { stroke: var(--action); stroke-width: 2; fill: none; }
.account-view .eh-est.eh-partial { stroke-dasharray: 5 4; }
.account-view .eh-point { fill: var(--action); stroke: var(--action); stroke-width: 1.5; }
.account-view .eh-point.eh-partial { fill: var(--surface); }
.account-view .eh-reading { fill: var(--ink); stroke: var(--surface); stroke-width: 1; }
.account-view .eh-flows { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 2 3; }
.account-view .eh-cursor { stroke: var(--line-strong); stroke-width: 1; }
.account-view .eh-hit { fill: transparent; cursor: crosshair; }
.account-view .eh-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0; padding: 0; list-style: none; font-size: .8rem; color: var(--m-ink-soft); }
.account-view .eh-legend li { display: inline-flex; align-items: center; gap: 6px; }
.account-view .eh-readout { min-height: 2.6em; margin: 6px 0; font-size: .85rem; }
.account-view .eh-readout span { display: block; }
.account-view .eh-figures summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; }
.account-view .eh-figures td:last-child { white-space: normal; }

/* Dated CFD costs; result refreshes leave editors in place. */
.cost-net { margin-top: .5rem; max-width: 34rem; white-space: normal; overflow-wrap: anywhere; font-size: .9rem; }
.trade-costs { margin: 1.25rem 0; border-top: 1px solid var(--line, #ddd); padding-top: 1rem; }
.trade-costs .exit-tools { flex-wrap: wrap; }
.trade-costs .btn { min-height: 44px; }
.trade-costs p, .trade-costs li { overflow-wrap: anywhere; }
.trade-costs summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.journal-view .grid .cost-net { min-width: 14rem; max-width: 24rem; }

/* issue701: incomplete imports keep their unanswered details visible. */
.journal-view .import-completion { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.journal-view .import-completion .fields { margin: 12px 0; }
.journal-view .import-completion input { min-width: 0; min-height: 44px; }
.journal-view .import-completion .btn { min-height: 44px; }
.journal-view .journal-filter:has(#j-incompleteOnly) { min-height: 44px; cursor: pointer; }
/* #774: the generic label column and input width made this a 44px empty
   square with its words below; a normal checkbox with its words beside it,
   the whole label still the 44px target, level with the account select. On
   its own row (an account's tab draws no account filter beside it) the field
   rule above would stretch it into a 44px-tall box. */
.journal-view .journal-filter:has(#j-incompleteOnly) { flex-direction: row; align-self: flex-end; color: var(--m-ink); }
.journal-view .journal-filter #j-incompleteOnly { width: 20px; height: 20px; min-height: 0; padding: 0; flex: none; margin: 0; }
.journal-view [data-import-status] { white-space: normal; overflow-wrap: anywhere; max-width: 100%; line-height: 1.6; }

/* #774: Accounts — a tab per account, then the shown account's sections.
   Real anchors with the destination strip's 44px target. The account tabs
   scroll sideways in one row on a phone (there may be several accounts);
   the sections wrap, so all six stay in reach without scrolling. The slots
   and navs are toggled by [hidden], which must win over their display. */
.accounts-view [data-account-slot][hidden],
.accounts-view .account-subtabs[hidden] { display: none; }
.accounts-view .account-tabs {
  display: flex; gap: 6px; align-items: stretch; margin: 0 0 12px;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding-bottom: 2px;
}
.accounts-view .account-tab {
  flex: 0 0 auto; display: inline-flex; flex-direction: column; justify-content: center;
  min-height: 44px; padding: 6px 14px; border: 1px solid var(--m-rule); border-radius: 8px;
  background: var(--m-card); color: var(--m-ink); text-decoration: none; line-height: 1.25;
}
.accounts-view .account-tab:hover { border-color: var(--action); }
.accounts-view .account-tab[aria-current] { border-color: var(--action); box-shadow: inset 0 -3px 0 var(--action); }
.accounts-view .account-tab:focus-visible,
.accounts-view .account-subtab:focus-visible,
.accounts-view .account-overflow a:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.accounts-view .account-tab-name { font-weight: 650; white-space: nowrap; }
.accounts-view .account-tab-sub { font-size: .8rem; color: var(--m-ink-soft); white-space: nowrap; }
.accounts-view .account-tab-add { color: var(--action); font-weight: 600; white-space: nowrap; }
.accounts-view .account-overflow { flex: 0 0 auto; position: relative; }
.accounts-view .account-overflow > summary {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--m-rule); border-radius: 8px; font-weight: 600;
}
.accounts-view .account-overflow ul { list-style: none; margin: 4px 0 0; padding: 4px 0; }
.accounts-view .account-overflow a { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; white-space: nowrap; }
.accounts-view .account-overflow a[aria-current] { font-weight: 650; }
.accounts-view .account-subtabs {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px;
  border-bottom: 1px solid var(--m-rule);
}
.accounts-view .account-subtab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px;
  margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-weight: 600; text-decoration: none; color: var(--m-ink-soft);
}
.accounts-view .account-subtab:hover { color: var(--action); }
.accounts-view .account-subtab[aria-current] { color: var(--action); border-bottom-color: var(--action); }
.accounts-view .account-subtab .count { font-weight: 500; }
@media (max-width: 520px) {
  .accounts-view .account-subtab { padding: 8px 10px; }
}
/* #774: the Accounts heading, with Export all at its end (wraps under it on a phone). */
.accounts-view .accounts-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.accounts-view .accounts-head .btn { min-height: 44px; }

/* #774: inside an account the trade is that account's — named, not chosen. */
.journal-view .entry-account-name { margin: 0 0 4px; flex: 0 1 22rem; min-width: 0; overflow-wrap: anywhere; }
/* #774: a draft started on another account says where it is. */
.journal-view .draft-elsewhere p { margin: 0 0 6px; overflow-wrap: anywhere; }
.journal-view .draft-elsewhere-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }

/* #774 (Q5): a trade started from a setup asks for its account first. The
   dialog sits outside every view, so it reads the app's shared tokens. */
.entry-account-dialog {
  max-width: min(28rem, calc(100vw - 32px)); padding: 16px 18px;
  color: var(--ink, #1f2933); background: var(--surface, #f7f8fa);
  border: 1px solid var(--line, #cbd2da); border-radius: 8px;
}
.entry-account-dialog::backdrop { background: rgb(0 0 0 / .35); }
.entry-account-dialog h2 { margin: 0 0 6px; font-size: 1.1rem; overflow-wrap: anywhere; }
.entry-account-dialog p { margin: 0 0 10px; font-size: .9rem; color: var(--muted, #56626e); }
.entry-account-choice-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.entry-account-choice-list button { width: 100%; min-height: 44px; text-align: left; padding: 8px 12px; overflow-wrap: anywhere; }
.entry-account-choice-meta { color: var(--muted, #56626e); font-size: .85rem; }
.entry-account-choice-cancel { text-align: right; margin: 0; }
.entry-account-choice-cancel button { min-height: 44px; padding: 8px 14px; }
