/* Prop Guard journal: calmer, roomier Trades tab. Scoped to #journal. Loaded after dashboard-modern.css. */

/* The Trades card should be a flat full-width panel, not a boxed card inside a boxed panel */
#journal .j-body > .j-card:has(.tbl-scroll) {
  grid-column: 1 / -1;
  order: 0;
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}

/* Risk setting: one quiet row above the table */
#journal .jx-risk {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 4px 0 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--dm-line-soft);
}
#journal .jx-risk label {
  font-size: 14px;
  color: var(--muted);
  gap: 8px;
}
#journal .jx-risk input {
  width: 150px;
  font-size: 16px;
  border-radius: 10px;
  padding: 10px 12px;
}
#journal .jx-risk .g-note {
  flex: 1 1 320px;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: var(--dim);
}

/* Table: more air, hairline rows, no boxes */
#journal .tbl-scroll {
  overflow-x: auto;
  margin: 0;
  padding: 0;
}
#journal .j-table:not(.jx-ck) {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}
#journal .j-table:not(.jx-ck) th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--dm-line);
  white-space: nowrap;
}
#journal .j-table:not(.jx-ck) td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--dm-line-soft);
  vertical-align: middle;
  font-size: 15px;
  color: var(--text);
}
#journal .j-table:not(.jx-ck) tbody tr {
  transition: background .15s;
}
#journal .j-table:not(.jx-ck) tbody tr:hover td {
  background: rgba(240,190,85,.035);
}
#journal .j-table:not(.jx-ck) th.r,
#journal .j-table:not(.jx-ck) td.r {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
#journal .j-table:not(.jx-ck) td:first-child {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
#journal .j-table:not(.jx-ck) td:nth-child(2) {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
#journal .j-table:not(.jx-ck) td:nth-child(3) {
  color: var(--muted);
  font-size: 14px;
}

/* Mistakes: calm dropdown and pill */
#journal .jx-mis {
  gap: 8px;
  min-width: 170px;
}
#journal .jx-mchip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
}
#journal .jx-msel {
  font-size: 13px;
  padding: 6px 10px;
  max-width: 160px;
  border: 1px solid var(--dm-line-soft);
  border-radius: 8px;
  background: var(--dm-tile);
  color: var(--muted);
}

/* Setup tags: wrap nicely, quiet input */
#journal .j-table:not(.jx-ck) td:nth-child(8) {
  min-width: 190px;
}
#journal .j-table:not(.jx-ck) .chip.tagchip {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--dm-tile);
  border: 1px solid var(--dm-line-soft);
}
#journal .tag-in {
  font-size: 13px;
  width: 100%;
  max-width: 170px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  opacity: .45;
  transition: opacity .15s, border-color .15s, background .15s;
}
#journal .j-table:not(.jx-ck) tbody tr:hover .tag-in,
#journal .tag-in:focus {
  opacity: 1;
  border-color: var(--dm-line-soft);
  background: var(--dm-tile);
}
#journal .j-table:not(.jx-ck) td:nth-child(8) > * + * {
  margin-top: 6px;
}

/* Note */
#journal .note-btn,
#journal .j-table:not(.jx-ck) td:nth-child(9) button {
  font-size: 13px;
  color: var(--dim);
  padding: 4px 6px;
  border-radius: 6px;
}
#journal .note-btn:hover,
#journal .j-table:not(.jx-ck) td:nth-child(9) button:hover {
  color: var(--gold2);
  background: var(--dm-tile);
}
#journal .note-in {
  font-size: 13px;
  width: 100%;
  min-width: 140px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--dm-line-soft);
  background: var(--dm-tile);
  color: var(--text);
}

/* Delete: present but quiet */
#journal .j-table:not(.jx-ck) td:last-child {
  width: 44px;
  text-align: right;
}
#journal .j-table:not(.jx-ck) td:last-child button {
  opacity: .35;
  transition: opacity .15s;
}
#journal .j-table:not(.jx-ck) tbody tr:hover td:last-child button,
#journal .j-table:not(.jx-ck) td:last-child button:focus {
  opacity: 1;
}

/* Explanatory notes below the table */
#journal .j-body > .j-card:has(.tbl-scroll) > .g-note:last-child {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--dim);
}

@media (max-width: 760px) {
  #journal .jx-risk input {
    width: 100%;
  }
  #journal .j-table:not(.jx-ck) td,
  #journal .j-table:not(.jx-ck) th {
    padding: 12px 10px;
  }
}

/* ---------- Checklist tab: aligned, even grid ---------- */
#journal .jx-ck {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}
#journal .jx-ck thead th {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 14px 10px 12px;
  border-bottom: 1px solid var(--dm-line);
  white-space: nowrap;
}
#journal .jx-ck thead th:first-child {
  text-align: left;
  padding-left: 16px;
}
#journal .jx-ck thead th.c,
#journal .jx-ck td.c {
  text-align: center;
  vertical-align: middle;
  min-width: 72px;
  padding: 14px 10px;
}
#journal .jx-ck tbody th[scope=row] {
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  padding: 14px 16px;
  min-width: 240px;
  line-height: 1.35;
}
#journal .jx-ck tbody th[scope=row] small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold2);
  opacity: .8;
}
#journal .jx-ck tbody th,
#journal .jx-ck tbody td {
  border-bottom: 1px solid var(--dm-line-soft);
}
#journal .jx-ck tbody tr:hover th,
#journal .jx-ck tbody tr:hover td {
  background-color: rgba(240,190,85,.03);
}

/* Sticky rule column blends with the panel instead of showing as a separate block */
#journal .jx-ck th[scope=row],
#journal .jx-ck thead th:first-child {
  background: linear-gradient(rgba(255,255,255,.05), rgba(255,255,255,.05)), var(--bg);
  box-shadow: 1px 0 0 var(--dm-line-soft);
}
:root[data-theme=light] #journal .jx-ck th[scope=row],
:root[data-theme=light] #journal .jx-ck thead th:first-child {
  background: #fff;
}

/* Auto marks and the boxes you tick are exactly the same size */
#journal .jx-mark,
#journal .jx-tick {
  box-sizing: border-box;
  width: 30px;
  height: 30px;
  padding: 0;
  margin: 0 auto;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
  opacity: 1;
}
#journal .jx-tick {
  border: 1.5px dashed var(--line2);
  background: transparent;
}
#journal .jx-tick.on {
  border: 1.5px solid rgba(79,214,158,.45);
  background: rgba(79,214,158,.12);
}

/* Summary row */
#journal .jx-sum th,
#journal .jx-sum td {
  border-top: 1px solid var(--dm-line);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Trades table: compact columns, no dead space ---------- */
/* Every column hugs its content; only the Note column takes the leftover width */
#journal .j-table:not(.jx-ck) {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}
#journal .j-table:not(.jx-ck) th,
#journal .j-table:not(.jx-ck) td {
  width: 1%;
  white-space: nowrap;
  padding: 12px 14px;
}
#journal .j-table:not(.jx-ck) th:nth-child(9),
#journal .j-table:not(.jx-ck) td:nth-child(9) {
  width: auto;
  white-space: normal;
}

/* Keep P&L and R coloured */
#journal .j-table:not(.jx-ck) td.okc,
#journal .j-table:not(.jx-ck) td .okc { color: var(--ok); }
#journal .j-table:not(.jx-ck) td.badc,
#journal .j-table:not(.jx-ck) td .badc { color: var(--bad); }

/* Mistakes: one line */
#journal .j-table:not(.jx-ck) .jx-mis {
  min-width: 0;
  flex-wrap: nowrap;
}

/* Setup tags: chip and "+ tag" sit side by side, so rows stay one line tall */
#journal .j-table:not(.jx-ck) td:nth-child(8) {
  min-width: 0;
}
#journal .j-table:not(.jx-ck) td:nth-child(8) > * + * {
  margin-top: 0;
}
#journal .j-table:not(.jx-ck) .chip.tagchip {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 6px 0 0;
}
#journal .j-table:not(.jx-ck) .tag-in {
  display: inline-block;
  vertical-align: middle;
  width: 90px;
  max-width: 90px;
  margin: 0;
}

/* ---- review 28 Oct 2026 ---------------------------------------------- */
/* Calendar, Trades-less tabs and Insights: only the Overview uses the
   8 + 4 split beside the health card. Every other tab goes full width. */
#journal .j-body:not(:has(.jx-health)) > .j-card { grid-column: 1 / -1; }

/* Setup tags: keep the chip and "+ tag" on one line so rows stay short */
#journal .j-table:not(.jx-ck) td:nth-child(8) { min-width: 230px; }
#journal .j-table:not(.jx-ck) td:nth-child(8) .chips { flex-wrap: nowrap; align-items: center; gap: 6px; }
#journal .j-table:not(.jx-ck) td:nth-child(8) .chip.tagchip { white-space: nowrap; margin: 0; }
#journal .j-table:not(.jx-ck) td:nth-child(7) .jx-mis { min-width: 0; }

/* Stat tiles: let long values (avg win / loss) wrap instead of cutting off */
#journal .j-tile b { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }

/* Calendar on phones: keep the short amount on one line */
@media (max-width: 640px) {
  #journal .j-day { padding: 4px 3px; }
  #journal .j-day b { white-space: nowrap; overflow-wrap: normal; font-size: 10.5px; letter-spacing: -.03em; }
}

/* Prop Guard keeps profit green and loss red in light mode: here colour
   carries meaning (win or loss), unlike the rest of the site. */
:root[data-theme=light] #gMain,
:root[data-theme=light] #journal { --ok: #118657; --bad: #C0362C; }

/* "Clear example trades" demoted to a quiet text action, in both themes */
#journal .danger-link, .danger-link {
  all: unset; cursor: pointer; font-size: 14px; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line2); padding: 8px 4px; align-self: center;
}
.danger-link:hover { color: var(--bad); text-decoration-color: var(--bad); }
.danger-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
/* Note keeps a readable width so long notes don't stack into tall rows */
#journal .j-table:not(.jx-ck) td:nth-child(9) { min-width: 220px; }
#journal .j-table:not(.jx-ck) td:nth-child(8) { min-width: 200px; }
/* Mistakes: wrap a second chip rather than push the table past the card */
#journal .j-table:not(.jx-ck) td:nth-child(7) { width: 270px; max-width: 270px; }
#journal .j-table:not(.jx-ck) td:nth-child(7) .jx-mis { flex-wrap: wrap; }
#journal .j-table:not(.jx-ck) td:nth-child(8) { min-width: 190px; }
#journal .j-table:not(.jx-ck) td:nth-child(9) { min-width: 200px; }
#journal .j-table:not(.jx-ck) td:nth-child(7) { min-width: 260px; }
#journal .j-table:not(.jx-ck) td:nth-child(7) { min-width: 300px; }
