/* Process > Trades — the grading layer over the `/` chart page (chart.css).
   Same visual language: theme vars, 1px hairlines, 4px radius, 10-12px type. */

/* One more column than `/`: the panel opens a little wider (chart.js clamps
   the drag to the same 560px via the page config). */
#trades-panel {
  flex-basis: 560px;
  width: 560px;
}

/* The grading progress at the right end of the shared filter row (chart.css). */
#grade-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gp-track {
  display: inline-block;
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: var(--subtle);
  overflow: hidden;
}
#grade-progress-fill { display: block; height: 100%; width: 0; background: var(--up); }

/* The Grade column: ✓ agree · ✗ disagree · · not graded. */
#trades-table .c-grade { text-align: center; width: 34px; }
#trades-table td.c-grade { color: var(--abstain); font-weight: 700; }
#trades-table td.c-grade.is-agree { color: var(--up); }
#trades-table td.c-grade.is-disagree { color: var(--down); }

/* Where the trade traded, in one sentence, then what happened. */
#trade-explain {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}
#trade-explain p { margin: 0; }
#trade-explain-where { padding-left: 8px; box-shadow: inset 2px 0 0 var(--abstain); }
#trade-explain-where.src-live { box-shadow: inset 2px 0 0 var(--warn); }
#trade-explain-where.src-both_diff { box-shadow: inset 2px 0 0 var(--accent); }
#trade-explain-where.src-both { box-shadow: inset 2px 0 0 var(--up); }
#trade-explain-what { margin-top: 2px !important; color: var(--text-dim); }
#trade-explain-what .pnl-up { color: var(--up); font-weight: 600; }
#trade-explain-what .pnl-down { color: var(--down); font-weight: 600; }

/* Blind review: the cue on top of an ungraded trade's detail, and the
   masked outcome cells (list Status / Result, detail Exit reason / PnL). */
#blind-note {
  margin: 0;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--selected);
  background: color-mix(in srgb, var(--selected) 7%, transparent);
}
#blind-note.is-revealed {
  color: var(--text-dim);
  background: var(--subtle);
}
#trades-table td.is-blind,
#trade-detail-table td.is-blind {
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 1px;
  cursor: help;
}

/* The detail as a column: header, blind note and "where it traded" keep their
   height, the Live | Backtest rows (wrapped by trades_grade.js) take what is
   left and scroll, and "Your grade" sits at the bottom with the height its own
   divider sets (trades_grade.js writes it). Overflows only if the detail is
   squeezed below the grade block's minimum. */
#trade-detail {
  display: flex;
  flex-direction: column;
}
#trade-detail[hidden] { display: none; }
#trade-detail > * { flex: 0 0 auto; }
#trade-detail-head { z-index: 1; }
#trade-detail > #trade-detail-rows {
  flex: 1 1 0;
  min-height: 24px;
  overflow-y: auto;
}

/* The grade block's divider: same look as the detail's (chart.css). */
#grade-splitter {
  flex: 0 0 7px;
  height: 7px;
  cursor: row-resize;
  touch-action: none;
  background: var(--border);
  position: relative;
}
#grade-splitter::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 3px;
  border-radius: 3px;
  background: repeating-linear-gradient(
    to right, var(--text-dim) 0 2px, transparent 2px 5px
  );
}
#grade-splitter:hover,
#grade-splitter:focus-visible,
#grade-splitter.dragging {
  background: var(--selected);
  outline: none;
}

/* "Your grade": a column whose comment box grows with the block. */
#trade-detail > #grade-box {
  display: flex;
  flex-direction: column;
  height: 270px;
  min-height: 0;
  box-sizing: border-box;
  padding: 8px 10px;
  background: var(--panel);
  font-size: 12px;
}
.gb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gb-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.gb-current { color: var(--text-dim); font-size: 11px; text-align: right; }
.gb-current.is-agree b { color: var(--up); }
.gb-current.is-disagree b { color: var(--down); }
.gb-question { margin: 4px 0; color: var(--text); font-weight: 600; }
.gb-verdict { display: flex; gap: 6px; margin-bottom: 6px; }
.gb-v {
  flex: 1 1 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}
.gb-v:hover { background: var(--subtle); }
.gb-v[data-v="agree"][aria-checked="true"] {
  border-color: var(--up);
  color: var(--up);
  background: color-mix(in srgb, var(--up) 10%, transparent);
}
.gb-v[data-v="disagree"][aria-checked="true"] {
  border-color: var(--down);
  color: var(--down);
  background: color-mix(in srgb, var(--down) 10%, transparent);
}
#gb-comment {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  flex: 1 1 auto;
  min-height: 4.6em;  /* three lines, whatever the block height */
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 4px 6px;
}
/* The row and the key hint stop short of the page's floating chat button. */
.gb-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-right: 56px; }
#gb-reviewer {
  width: 130px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 4px 6px;
}
#gb-save {
  border: 1px solid var(--selected);
  border-radius: 4px;
  background: var(--selected);
  color: #ffffff;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
}
#gb-save:disabled { opacity: 0.6; cursor: default; }
.gb-status { font-size: 11px; color: var(--text-dim); }
.gb-status.ok { color: var(--up); }
.gb-status.err { color: var(--down); }
.gb-keys { margin: 6px 0 0; padding-right: 56px; font-size: 10px; color: var(--text-dim); }
.gb-keys kbd {
  display: inline-block;
  min-width: 12px;
  padding: 0 3px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: 10px var(--mono-font);
  text-align: center;
  color: var(--text);
}
