/* ──────────────────────────────────────────────────────────────────────────
   journal.css — the Trade Journal screens.
   Sits on top of main.css and reuses its tokens. The only new colours are the
   two data marks: the site green is fine for UI chrome but only just clears
   the colour-blind separation floor against the site red, so charts use a
   darker green that passes outright. Sign is never carried by colour alone;
   every bar also reads left or right of a zero line and carries its number.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --tj-pos:    #0B8F63;   /* validated against --tj-neg: ΔE 9.0 protan */
  --tj-neg:    #E8453C;
  --tj-pos-lo: rgba(11,143,99,0.10);
  --tj-neg-lo: rgba(232,69,60,0.10);
  --tj-grid:   #EFEDE9;
  --tj-r:      16px;
}

.tj-page { min-height:100vh; background:var(--bg2); padding-top:var(--nav-h); }
.tj-wrap { max-width:1280px; margin:0 auto; padding:28px var(--px,clamp(24px,4vw,80px)) 72px; }

/* ── Sub navigation ─────────────────────────────────────────────────────── */
.tj-subnav { background:var(--bg); border-bottom:1px solid var(--line); position:sticky; top:var(--nav-h); z-index:30; }
.tj-subnav-in {
  max-width:1280px; margin:0 auto; padding:0 var(--px,clamp(24px,4vw,80px));
  display:flex; gap:4px; overflow-x:auto; scrollbar-width:none;
}
.tj-subnav-in::-webkit-scrollbar { display:none; }
.tj-subnav a {
  padding:14px 14px 12px; font-size:14px; font-weight:600; color:var(--muted);
  text-decoration:none; border-bottom:2px solid transparent; white-space:nowrap;
  transition:color .15s var(--ease), border-color .15s var(--ease);
}
.tj-subnav a:hover { color:var(--ink); }
.tj-subnav a.on { color:var(--orange); border-bottom-color:var(--orange); }

/* ── Page heading ───────────────────────────────────────────────────────── */
.tj-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; flex-wrap:wrap; margin:4px 0 20px; }
.tj-head h1 { font-family:'Fraunces',serif; font-size:clamp(26px,3.4vw,38px); font-weight:900; line-height:1.1; margin:0 0 6px; }
.tj-head p  { margin:0; color:var(--muted); font-size:15px; max-width:62ch; }
.tj-head-actions { display:flex; gap:10px; flex-wrap:wrap; }

.tj-disclaimer {
  margin:18px 0 0; font-size:12.5px; line-height:1.6; color:var(--muted);
  border-top:1px solid var(--line); padding-top:14px;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.tj-card {
  background:var(--bg); border:1px solid var(--line); border-radius:var(--tj-r);
  padding:22px 24px; margin-bottom:18px;
}
.tj-card-head { display:flex; align-items:baseline; justify-content:space-between; gap:14px; margin-bottom:16px; flex-wrap:wrap; }
.tj-card-head h2 { font-family:'Fraunces',serif; font-size:19px; font-weight:700; margin:0; }
.tj-card-head .tj-sub { font-size:13px; color:var(--muted); }
.tj-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
@media (max-width:900px){ .tj-grid2 { grid-template-columns:1fr; } }

/* ── KPI tiles ───────────────────────────────────────────────────────────
   The headline card used to carry a bare class of "hero", which the site
   already defines as a full-height two-column grid for the homepage. It
   inherited all of it: 100vh tall, label and value side by side, the rupee
   figure wrapping mid-number. Everything here is namespaced now.

   Layout: the net figure gets a card twice the width of the rest, because it
   is the one number the whole feature exists to produce. The other four are
   equal, and each carries a small mark that makes its number legible at a
   glance rather than needing to be read. */
.tj-kpis {
  display:grid; grid-template-columns:repeat(4,1fr);
  gap:14px; margin-bottom:18px; align-items:stretch;
}
.tj-kpis > * { min-width:0; }                 /* grid children may shrink */
@media (max-width:1100px) { .tj-kpis { grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px)  { .tj-kpis { grid-template-columns:1fr; } }

.tj-kpi {
  display:flex; flex-direction:column; gap:6px;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--tj-r);
  padding:18px 20px 20px; position:relative;
}
/* A thin accent down the left edge: colour as a label, not as data. */
.tj-kpi::before {
  content:''; position:absolute; left:0; top:0; bottom:0; width:3px;
  background:var(--k-accent, transparent);
  border-radius:var(--tj-r) 0 0 var(--tj-r);
}
.tj-kpi .k-label {
  font-size:11.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); margin:0; padding-right:26px;
}
.tj-kpi .k-value {
  font-family:'Fraunces',serif; font-weight:900; line-height:1.02;
  letter-spacing:-.015em; font-variant-numeric:tabular-nums;
  font-size:clamp(26px,2.5vw,34px); white-space:nowrap;
}
/* A long figure steps down rather than wrapping: "-₹3,17 / 6.10" is not a number. */
.tj-kpi .k-value.long { font-size:clamp(21px,2vw,27px); }
.tj-kpi .k-note { font-size:12.5px; color:var(--muted); line-height:1.5; margin-top:auto; padding-top:4px; }

.tj-up   { color:var(--tj-pos); }
.tj-down { color:var(--tj-neg); }
.tj-flat { color:var(--ink2); }

/* ── The headline card ──────────────────────────────────────────────────
   Two columns wide, and it shows the subtraction rather than just the
   answer: gross, what came off it, what was left. */
.tj-kpi-net {
  grid-column:span 2; background:var(--ink); border-color:var(--ink); color:#fff;
  padding:20px 24px 22px;
}
/* Full width where there are four secondary tiles, so the row below lands
   exactly four across instead of wrapping two onto a ragged second row. */
.tj-kpi-net.wide { grid-column:1 / -1; }
.tj-kpi-net.wide .tj-flow { gap:22px; }
@media (max-width:560px) { .tj-kpi-net { grid-column:span 1; } }
.tj-kpi-net::before { display:none; }
.tj-kpi-net .k-label { color:rgba(255,255,255,.60); }
.tj-kpi-net .k-value { font-size:clamp(34px,4.4vw,52px); margin:2px 0 2px; }
.tj-kpi-net .k-value.long { font-size:clamp(27px,3.4vw,42px); }
.tj-kpi-net .tj-up   { color:#4FD6A4; }
.tj-kpi-net .tj-down { color:#FF8A82; }

/* gross → charges → net, as three figures on one line with the arithmetic shown */
.tj-flow { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-top:12px; }
.tj-flow-item { display:flex; flex-direction:column; gap:2px; }
.tj-flow-item .f-k {
  font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:rgba(255,255,255,.52);
}
.tj-flow-item .f-v { font-size:15px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
.tj-flow-op { font-size:17px; font-weight:700; color:rgba(255,255,255,.38); align-self:flex-end; padding-bottom:1px; }

/* How much of the gross profit the charges took, as one bar. */
.tj-eaten { margin-top:16px; }
.tj-eaten .e-track {
  height:7px; border-radius:4px; background:rgba(255,255,255,.14); overflow:hidden; display:flex;
}
.tj-eaten .e-fill { height:100%; background:var(--orange); }
.tj-eaten .e-rest { height:100%; background:#4FD6A4; }
.tj-eaten .e-cap  { margin-top:8px; font-size:12px; color:rgba(255,255,255,.62); line-height:1.5; }

/* ── Marks inside the smaller tiles ─────────────────────────────────────
   Each is a part-to-whole on the tile's own number, labelled in the note
   beneath, so colour never carries the meaning on its own. */
.tj-meter { display:flex; height:7px; border-radius:4px; overflow:hidden; background:var(--bg2); margin-top:4px; }
.tj-meter span { height:100%; }
.tj-meter .m-win  { background:var(--tj-pos); }
.tj-meter .m-loss { background:var(--tj-neg); }
.tj-meter .m-fill { background:var(--orange); }
.tj-meter .m-dd   { background:var(--tj-neg); }

/* A tile that leads somewhere says so, and only on that tile. */
a.tj-kpi { text-decoration:none; color:inherit; transition:border-color .15s var(--ease), transform .15s var(--ease); }
a.tj-kpi:hover { border-color:#CFC9C0; transform:translateY(-1px); }
a.tj-kpi .k-more { font-size:12.5px; font-weight:700; color:var(--orange); margin-top:6px; }

/* ── Charts ─────────────────────────────────────────────────────────────── */
.tj-chart { position:relative; width:100%; overflow-x:auto; }
/* The SVG scales with the container, which would shrink axis text to nothing
   on a phone. A min-width makes the chart scroll instead of collapsing, so
   the labels stay legible at every size. */
.tj-chart svg { display:block; width:100%; min-width:720px; height:auto; overflow:visible; }
.tj-axis    { font-size:11px; fill:var(--muted); font-family:'Figtree',sans-serif; }
.tj-gridline{ stroke:var(--tj-grid); stroke-width:1; }
.tj-zero    { stroke:#D8D4CE; stroke-width:1; stroke-dasharray:3 3; }

/* Crosshair tooltip for the equity curve */
.tj-tip {
  position:absolute; pointer-events:none; opacity:0; transform:translate(-50%,-120%);
  background:var(--ink); color:#fff; border-radius:9px; padding:8px 11px;
  font-size:12.5px; line-height:1.45; white-space:nowrap; z-index:5;
  transition:opacity .1s linear;
}
.tj-tip b { font-weight:700; }
.tj-tip .t-date { color:rgba(255,255,255,.62); display:block; font-size:11.5px; }

/* Ranked single-hue bars (charge composition) */
.tj-ranked { display:grid; grid-template-columns:auto 1fr auto; gap:9px 14px; align-items:center; }
.tj-ranked .r-label { font-size:13.5px; color:var(--ink2); white-space:nowrap; }
.tj-ranked .r-track { background:var(--bg2); border-radius:4px; height:14px; overflow:hidden; }
.tj-ranked .r-fill  { height:100%; background:var(--orange); border-radius:0 4px 4px 0; }
.tj-ranked .r-value { font-size:13.5px; font-weight:600; text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.tj-ranked .r-pct   { font-size:12px; color:var(--muted); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.tj-tablewrap { overflow-x:auto; margin:0 -24px; padding:0 24px; }
table.tj-table { width:100%; border-collapse:collapse; font-size:14px; }
table.tj-table th {
  text-align:left; font-size:11.5px; font-weight:700; letter-spacing:.05em;
  text-transform:uppercase; color:var(--muted); padding:0 14px 10px 0;
  border-bottom:1px solid var(--line); white-space:nowrap;
}
table.tj-table td { padding:11px 14px 11px 0; border-bottom:1px solid var(--line); vertical-align:middle; }
table.tj-table tr:last-child td { border-bottom:0; }
/* A trade and its fills are one record, so the rule goes under the pair. */
table.tj-table tr.tj-trow td { border-bottom:0; }
table.tj-table tr.tj-drow td { padding-top:0; }
table.tj-table tr.tj-trow:hover td,
table.tj-table tr.tj-trow:hover + tr.tj-drow td { background:var(--bg2); }
table.tj-table .num { text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
table.tj-table tbody tr:hover { background:var(--bg2); }
.tj-contract { font-weight:600; }
.tj-symbol-sub { display:block; font-size:12px; color:var(--muted); font-weight:400; }

.tj-tag {
  display:inline-block; padding:2px 8px; border-radius:999px; font-size:11.5px;
  font-weight:700; letter-spacing:.02em; border:1px solid var(--line); color:var(--muted);
}
.tj-tag.long  { color:var(--tj-pos); border-color:rgba(11,143,99,.3);  background:var(--tj-pos-lo); }
.tj-tag.short { color:var(--orange); border-color:var(--orange-mid);   background:var(--orange-light); }
.tj-tag.open  { color:var(--blue);   border-color:rgba(26,115,232,.3); background:rgba(26,115,232,.08); }
.tj-tag.exp   { color:var(--muted);  background:var(--bg2); }

/* ── Filters ────────────────────────────────────────────────────────────── */
.tj-filters { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; margin-bottom:16px; }
.tj-field { display:flex; flex-direction:column; gap:5px; }
.tj-field label { font-size:11.5px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.tj-field select, .tj-field input {
  font-family:inherit; font-size:14px; padding:8px 11px; border:1px solid var(--line);
  border-radius:9px; background:var(--bg); color:var(--ink); min-width:128px;
}
.tj-field select:focus, .tj-field input:focus { outline:2px solid var(--orange); outline-offset:1px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.tj-btn {
  display:inline-flex; align-items:center; gap:7px; font-family:inherit; font-size:14px;
  font-weight:600; padding:10px 17px; border-radius:10px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink); cursor:pointer; text-decoration:none;
  transition:background .15s var(--ease), border-color .15s var(--ease);
}
.tj-btn:hover { background:var(--bg2); }
.tj-btn.primary { background:var(--orange); border-color:var(--orange); color:#fff; }
.tj-btn.primary:hover { background:#E64E12; }
.tj-btn.danger  { color:var(--tj-neg); border-color:rgba(232,69,60,.35); }
.tj-btn.danger:hover { background:var(--tj-neg-lo); }
.tj-btn[disabled] { opacity:.5; cursor:not-allowed; }

/* ── Notices ────────────────────────────────────────────────────────────── */
.tj-note { border-radius:12px; padding:13px 16px; font-size:14px; line-height:1.55; margin-bottom:16px; border:1px solid; }
.tj-note.ok   { background:var(--tj-pos-lo); border-color:rgba(11,143,99,.28); color:#07603F; }
.tj-note.warn { background:var(--orange-light); border-color:var(--orange-mid); color:#8A2E00; }
.tj-note.bad  { background:var(--tj-neg-lo); border-color:rgba(232,69,60,.28); color:#9B1F18; }
.tj-note.info { background:var(--bg2); border-color:var(--line); color:var(--ink2); }
.tj-note ul { margin:8px 0 0; padding-left:20px; }

/* ── Insights ───────────────────────────────────────────────────────────── */
.tj-insights { list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.tj-insights li {
  display:flex; gap:11px; align-items:flex-start; font-size:14.5px; line-height:1.6;
  padding:12px 14px; border-radius:11px; background:var(--bg2); color:var(--ink2);
}
.tj-insights li::before { content:'•'; font-size:18px; line-height:1.25; color:var(--muted); }
.tj-insights li.warn { background:var(--orange-light); color:#7A2900; }
.tj-insights li.warn::before { color:var(--orange); }
.tj-insights li.good::before { color:var(--tj-pos); }

/* ── Empty state ────────────────────────────────────────────────────────── */
.tj-empty { text-align:center; padding:56px 24px; }
.tj-empty h2 { font-family:'Fraunces',serif; font-size:24px; font-weight:900; margin:0 0 10px; }
.tj-empty p  { color:var(--muted); font-size:15px; line-height:1.65; max-width:52ch; margin:0 auto 22px; }
.tj-steps { text-align:left; max-width:560px; margin:0 auto 24px; display:grid; gap:12px; }
.tj-step { display:flex; gap:13px; align-items:flex-start; font-size:14.5px; line-height:1.6; color:var(--ink2); }
.tj-step .n {
  flex:0 0 25px; height:25px; border-radius:50%; background:var(--orange-light);
  color:var(--orange); font-weight:800; font-size:13px; display:grid; place-items:center;
}

/* ── Import ─────────────────────────────────────────────────────────────── */
.tj-drop {
  border:2px dashed #D9D5CE; border-radius:var(--tj-r); padding:40px 24px; text-align:center;
  background:var(--bg2); transition:border-color .15s var(--ease), background .15s var(--ease);
}
.tj-drop.over { border-color:var(--orange); background:var(--orange-light); }
.tj-drop p { margin:10px 0 0; color:var(--muted); font-size:13.5px; }
.tj-drop input[type=file] { display:block; margin:16px auto 0; font-size:14px; max-width:340px; }
.tj-filename { font-weight:600; color:var(--ink); }

.tj-maprow { display:grid; grid-template-columns:170px 1fr; gap:10px 16px; align-items:center; margin-bottom:10px; }
.tj-maprow label { font-size:13.5px; font-weight:600; }
.tj-maprow .req { color:var(--tj-neg); }
.tj-maprow select { width:100%; font-family:inherit; font-size:14px; padding:8px 11px; border:1px solid var(--line); border-radius:9px; background:var(--bg); }

.tj-preview { font-size:12.5px; }
.tj-preview td, .tj-preview th { padding:6px 10px 6px 0; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── Quota bar ──────────────────────────────────────────────────────────── */
.tj-quota { display:flex; align-items:center; gap:12px; font-size:13px; color:var(--muted); }
.tj-quota .q-track { flex:1; max-width:220px; height:7px; background:var(--bg2); border-radius:4px; overflow:hidden; }
.tj-quota .q-fill  { height:100%; background:var(--orange); }

/* ── Pager ──────────────────────────────────────────────────────────────── */
.tj-pager { display:flex; gap:7px; align-items:center; justify-content:center; margin-top:20px; flex-wrap:wrap; }
.tj-pager a, .tj-pager span {
  min-width:36px; padding:7px 10px; text-align:center; border-radius:9px; font-size:13.5px;
  font-weight:600; text-decoration:none; color:var(--ink2); border:1px solid var(--line); background:var(--bg);
}
.tj-pager .on { background:var(--orange); border-color:var(--orange); color:#fff; }
.tj-pager .gap { border:0; background:none; color:var(--muted); }

/* ── Legs detail ────────────────────────────────────────────────────────── */
details.tj-legs summary { cursor:pointer; font-size:13px; color:var(--orange); font-weight:600; list-style:none; }
details.tj-legs summary::-webkit-details-marker { display:none; }
details.tj-legs summary::before { content:'▸ '; }
details.tj-legs[open] summary::before { content:'▾ '; }
details.tj-legs table { margin-top:9px; font-size:12.5px; width:100%; }
details.tj-legs td { padding:4px 12px 4px 0; color:var(--muted); border:0; }

@media (max-width:700px) {
  .tj-card { padding:18px 16px; }
  .tj-tablewrap { margin:0 -16px; padding:0 16px; }
  .tj-maprow { grid-template-columns:1fr; }
}

/* ── Date range control ─────────────────────────────────────────────────
   Chips are links, so every view is a URL you can bookmark or send to
   someone, and the control works with JavaScript off. */
.tj-period { display:flex; gap:7px; flex-wrap:wrap; align-items:center; margin:0 0 16px; }
.tj-chip {
  display:inline-block; padding:7px 14px; border-radius:999px; font-size:13.5px;
  font-weight:600; text-decoration:none; color:var(--ink2);
  border:1px solid var(--line); background:var(--bg); white-space:nowrap;
  transition:border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.tj-chip:hover { border-color:#D5D0C8; background:var(--bg2); }
.tj-chip.on { background:var(--ink); border-color:var(--ink); color:#fff; }
.tj-period-custom { display:flex; gap:7px; align-items:center; flex-wrap:wrap; margin:0; }
.tj-period-custom input[type=date] {
  font-family:inherit; font-size:13.5px; padding:7px 10px;
  border:1px solid var(--line); border-radius:9px; background:var(--bg); color:var(--ink);
}

/* The window every figure on the page is measured over. Stated, never implied. */
.tj-range {
  display:flex; align-items:center; gap:9px; flex-wrap:wrap;
  font-size:14px; color:var(--ink2); margin:0 0 18px;
  padding:11px 15px; background:var(--bg); border:1px solid var(--line); border-radius:12px;
}
.tj-range .r-what { font-weight:700; color:var(--ink); }
.tj-range .r-dates { font-variant-numeric:tabular-nums; }
.tj-range .r-sep { color:#C9C4BC; }
.tj-range .r-note { color:var(--muted); font-size:13px; }

/* Charts scroll on narrow screens; say so rather than letting it be found. */
.tj-scrollhint { display:none; font-size:12px; color:var(--muted); margin:8px 0 0; }
/* Shown by journal.js only when the chart actually overflows, at any width.
   The no-JS fallback is the narrow-screen case, where it always does. */
@media (max-width:760px) { .tj-scrollhint { display:block; } }

/* No sticky table header. .tj-tablewrap sets overflow-x:auto, which makes it
   the scroll container for sticky purposes, so a thead stuck to
   calc(nav + subnav) was offset downward inside that box and painted straight
   over the first rows. It broke every table on every tab. A sticky header here
   needs the page to be the scroller, which it is not. */

/* Import: the file is read in the request, which on a big tradebook is a
   few seconds of nothing happening unless we say otherwise. */
.tj-btn.busy { opacity:.65; pointer-events:none; }

/* ── "What does this mean?" ──────────────────────────────────────────────
   A <details> rather than a scripted popover: works with JavaScript off,
   reachable by keyboard, announced properly, and closes on Escape for free.
   The panel is positioned over the card because these live in a grid where
   growing one tile would stretch the whole row. */
.tj-why { position:absolute; top:14px; right:14px; z-index:1; }
.tj-why[open] { z-index:20; }
.tj-why > summary {
  list-style:none; cursor:pointer; width:20px; height:20px; border-radius:50%;
  display:grid; place-items:center; font-size:12px; font-weight:800;
  color:var(--muted); background:var(--bg2); border:1px solid var(--line);
  transition:color .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.tj-why > summary::-webkit-details-marker { display:none; }
.tj-why > summary:hover,
.tj-why[open] > summary { color:#fff; background:var(--orange); border-color:var(--orange); }
.tj-why > summary:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }

.tj-why-body {
  position:absolute; top:28px; right:0; width:286px; max-width:78vw;
  background:var(--bg); color:var(--ink2); border:1px solid var(--line);
  border-radius:13px; padding:14px 16px; box-shadow:0 10px 30px rgba(0,0,0,.13);
  font-size:13.5px; line-height:1.62; font-weight:400; text-transform:none;
  letter-spacing:normal; font-family:'Figtree',sans-serif;
}
.tj-why-body strong { display:block; color:var(--ink); font-size:13.5px; margin-bottom:5px; }
.tj-why-body p { margin:0; }

/* On the dark headline card the bubble stays light, so it has to opt out of
   the inherited white text. */
.tj-kpi-net .tj-why > summary { background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.22); color:rgba(255,255,255,.75); }
.tj-kpi-net .tj-why > summary:hover,
.tj-kpi-net .tj-why[open] > summary { background:var(--orange); border-color:var(--orange); color:#fff; }

/* Near the right edge of narrow screens the bubble would run off. */
@media (max-width:560px) { .tj-why-body { width:min(286px, calc(100vw - 72px)); } }

@media (prefers-reduced-motion:reduce) {
  a.tj-kpi:hover { transform:none; }
  .tj-kpi, .tj-chip, .tj-btn, .tj-why > summary, a.tj-kpi { transition:none; }
}

/* ── Per-import plan, with room to type your own rates ───────────────────
   This was a table, which left the select fighting a column boundary and gave
   the custom fields nowhere to live. One card per import instead, since each
   row is really a small form rather than a record to scan. */
.tj-planrow {
  border:1px solid var(--line); border-radius:13px; padding:15px 17px;
  margin-bottom:12px; background:var(--bg2);
}
.tj-planrow-top { display:flex; gap:14px; align-items:flex-end; flex-wrap:wrap; }
.tj-planrow .p-file { flex:1 1 220px; min-width:0; }
.tj-planrow .p-file strong {
  display:block; font-size:14.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.tj-planrow .p-file span { font-size:12.5px; color:var(--muted); }
.tj-planrow .p-plan { flex:2 1 290px; }
.tj-planrow .p-plan select { width:100%; }

.tj-custom { margin-top:15px; padding-top:15px; border-top:1px solid var(--line); }
.tj-custom .c-intro { margin:0 0 12px; font-size:13px; color:var(--muted); line-height:1.6; }
.tj-custom .c-hint  { margin:11px 0 0; font-size:12.5px; color:var(--muted); line-height:1.6; }
.tj-custom-grid {
  display:grid; grid-template-columns:repeat(auto-fit,minmax(168px,1fr)); gap:11px 14px;
}
.tj-custom-grid .tj-field input,
.tj-custom-grid .tj-field select { width:100%; }

/* ── Tabs, with no JavaScript ────────────────────────────────────────────
   Two radios and sibling selectors. The inputs stay in the accessible tree
   rather than being display:none, so the pair is reachable by keyboard and
   the arrow keys move between them, which is the behaviour a tab strip is
   supposed to have anyway. */
.tj-tabs { position:relative; }
.tj-tabbar { display:flex; gap:4px; }
.tj-tabbar label {
  font-family:'Fraunces',serif; font-size:17px; font-weight:700;
  color:var(--muted); padding:2px 0 7px; cursor:pointer;
  border-bottom:2px solid transparent; margin-right:16px;
  transition:color .15s var(--ease), border-color .15s var(--ease);
}
.tj-tabbar label:hover { color:var(--ink); }
.tj-tabbar .t-n {
  display:inline-block; margin-left:5px; padding:1px 7px; border-radius:999px;
  background:var(--bg2); color:var(--muted);
  font-family:'Figtree',sans-serif; font-size:11.5px; font-weight:700;
  vertical-align:2px;
}
.tj-tabpane { display:none; }
#tjrt-closed:checked ~ .tj-card-head label[for="tjrt-closed"],
#tjrt-open:checked   ~ .tj-card-head label[for="tjrt-open"] {
  color:var(--ink); border-bottom-color:var(--orange);
}
#tjrt-closed:checked ~ .tj-tabpane[data-pane="closed"],
#tjrt-open:checked   ~ .tj-tabpane[data-pane="open"] { display:block; }
/* Keyboard focus has to be visible on a control that is otherwise invisible. */
.tj-tabs input:focus-visible ~ .tj-card-head label[for="tjrt-closed"],
.tj-tabs input:focus-visible ~ .tj-card-head label[for="tjrt-open"] {
  outline:2px solid var(--orange); outline-offset:3px; border-radius:3px;
}

/* Tile icon: decoration that repeats the label, so it is aria-hidden and the
   tile reads the same without it. Takes the tile's own accent colour. */
.tj-kpi .k-icon {
  width:30px; height:30px; border-radius:9px; display:grid; place-items:center;
  background:var(--bg2); color:var(--k-accent, var(--muted)); margin-bottom:2px;
}
.tj-kpi .k-icon svg { width:17px; height:17px; display:block; }
.tj-kpi-net .k-icon { background:rgba(255,255,255,.12); color:rgba(255,255,255,.8); }

/* ── P&L calendar ────────────────────────────────────────────────────────
   Four colour steps, not a continuous ramp: a reader can tell four shades
   apart and cannot tell 60% from 68%. Every cell carries its number as well,
   so the shade sorts the eye and never carries the value on its own. */
.tj-cal { display:grid; grid-template-columns:repeat(auto-fit,minmax(310px,1fr)); gap:20px; }
.tj-cal-month { min-width:0; }
.cal-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:9px; }
.cal-head h3 { font-family:'Fraunces',serif; font-size:15.5px; font-weight:700; margin:0; }
.cal-sum { font-size:14px; font-weight:700; text-align:right; font-variant-numeric:tabular-nums; }
.cal-sum small { display:block; font-size:11px; font-weight:400; color:var(--muted); }

.cal-dow, .cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-dow { margin-bottom:4px; }
.cal-dow span {
  font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
  color:var(--muted); text-align:center;
}

.c-pad { aspect-ratio:1; }
.c-day {
  aspect-ratio:1; border-radius:7px; border:1px solid var(--line); background:var(--bg);
  display:flex; flex-direction:column; justify-content:space-between;
  padding:4px 5px; min-width:0; overflow:hidden;
}
.c-day .c-n { font-size:10px; font-weight:700; color:var(--muted); line-height:1; }
.c-day .c-v {
  font-size:10.5px; font-weight:800; line-height:1.1;
  font-variant-numeric:tabular-nums; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.c-none  { background:var(--bg2); border-color:transparent; }
.c-wknd  { background:transparent; }
.c-wknd .c-n { color:#CFC9C0; }

.c-up.c-s1   { background:rgba(11,143,99,.12); border-color:rgba(11,143,99,.20); }
.c-up.c-s2   { background:rgba(11,143,99,.30); border-color:rgba(11,143,99,.38); }
.c-up.c-s3   { background:rgba(11,143,99,.55); border-color:rgba(11,143,99,.62); }
.c-up .c-v   { color:#07603F; }
.c-up.c-s3 .c-v, .c-up.c-s3 .c-n { color:#06452E; }

.c-down.c-s1 { background:rgba(232,69,60,.12); border-color:rgba(232,69,60,.20); }
.c-down.c-s2 { background:rgba(232,69,60,.30); border-color:rgba(232,69,60,.38); }
.c-down.c-s3 { background:rgba(232,69,60,.55); border-color:rgba(232,69,60,.62); }
.c-down .c-v { color:#9B1F18; }
.c-down.c-s3 .c-v, .c-down.c-s3 .c-n { color:#7A1711; }

.c-flat { background:var(--bg2); }
.c-flat .c-v { color:var(--muted); }

@media (max-width:420px) {
  .c-day .c-v { font-size:9px; }
  .tj-cal { grid-template-columns:1fr; }
}

/* A trade that was one leg of something larger says which shape it belonged to. */
.tj-tag.shape { color:var(--blue); border-color:rgba(26,115,232,.3); background:rgba(26,115,232,.07); }

/* ── Broker card ─────────────────────────────────────────────────────────
   Sits under the charge breakdown, which is where the reader has just seen
   what brokerage cost them. Prefixed tjb- so nothing borrows a rule by name. */
.tjb {
  position:relative; overflow:hidden; text-align:left;
  background:#232D45; border-color:rgba(255,255,255,.10);
  box-shadow:0 12px 32px rgba(20,27,45,.22);
}
/* The rule across the top is the four bars of the logo, in their order. */
.tjb::before {
  content:''; position:absolute; top:0; left:0; right:0; height:3px; z-index:2;
  background:linear-gradient(90deg,#F0B769 0%,#E42D5B 33%,#06B991 66%,#339AFF 100%);
}
/* The diagonal motif, at the lean of those bars. Generic geometry at 4% white. */
.tjb::after {
  content:''; position:absolute; inset:-25%; pointer-events:none;
  background:repeating-linear-gradient(155deg,
    rgba(255,255,255,.042) 0 30px, rgba(255,255,255,0) 30px 84px);
}
.tjb > * { position:relative; z-index:1; }

.tjb-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.tjb-logo {
  background:none; border:0; border-radius:0; padding:0; margin:0;
  display:block; box-shadow:none;
}
.tjb-logo img { display:block; width:auto; height:32px; }

/* The price, as the sticker TradeSmart put it on. Real text, so it stays
   selectable, translatable and readable aloud. Their amber is 1.8:1 on white
   and unusable here, so the figure takes a deeper step of the same hue at
   3.7:1, which clears the bar for text this size. */
.tjb-badge {
  flex:0 0 auto; width:86px; height:86px; border-radius:50%;
  background:#fff; color:#1D1E30; text-align:center;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  transform:rotate(-8deg); box-shadow:0 8px 20px rgba(13,18,32,.38);
  outline:4px solid rgba(255,255,255,.12);
}
.tjb-badge .t { font-size:8.5px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; opacity:.72; }
.tjb-badge .n { font-size:29px; font-weight:900; line-height:1.02; color:#C2700A; letter-spacing:-.6px; margin:1px 0 2px; }
.tjb-badge .s { font-size:7px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; opacity:.6; line-height:1.25; max-width:62px; }

.tjb-line { font-size:14px; line-height:1.6; color:rgba(255,255,255,.92); margin:0 0 15px; max-width:46ch; }

.tjb-chips { list-style:none; margin:0 0 18px; padding:0; display:grid; gap:9px; }
.tjb-chips li {
  font-size:13px; font-weight:600; color:rgba(255,255,255,.92);
  background:none; border:0; border-radius:0; padding:0;
  display:flex; align-items:center; gap:9px;
}
.tjb-chips li::before { content:"✓"; color:#06B991; font-weight:900; font-size:11px; flex:0 0 auto; }

.tjb-btn {
  display:block; text-align:center; background:var(--orange); color:#fff; text-decoration:none;
  font-size:15px; font-weight:700; padding:13px 20px; border-radius:11px;
  transition:background .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.tjb-btn:hover { background:#ff6f36; transform:translateY(-2px); box-shadow:0 10px 24px rgba(255,92,26,.3); }
.tjb-btn:focus-visible { outline:3px solid #F0B769; outline-offset:3px; }

.tjb-review { display:block; text-align:center; margin-top:11px; font-size:13.5px; font-weight:700; color:#F0B769; text-decoration:none; }
.tjb-review:hover { text-decoration:underline; }
.tjb-disc { font-size:11.5px; line-height:1.6; color:rgba(255,255,255,.62); margin:14px 0 0; }

@media (prefers-reduced-motion:reduce) { .tjb-btn:hover { transform:none; } }

.tjb-narrow { max-width:460px; margin-left:auto; margin-right:auto; }

   The same three figures the homepage shows, in the journal's light palette.
   Markup and data come from one place; only the colours differ. */
.tjp { margin-top:18px; }

/* ── The fifteen second film ─────────────────────────────────────────────
   Shown on the empty state only. The frame is the dark of the film's own
   first scene rather than white, so the letterboxing on a narrow viewport
   reads as part of the picture instead of as a gap the layout failed to
   fill. Height is reserved by aspect-ratio so nothing below it jumps when
   the poster finally arrives. */
.tjv-head { display:flex; align-items:baseline; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.tjv-head h2 { font-family:'Fraunces',serif; font-size:19px; font-weight:700; margin:0; }
.tjv-head span { font-size:13px; color:var(--muted); }

.tjv-frame {
  border-radius:12px; overflow:hidden; background:#0E1422;
  border:1px solid var(--line); line-height:0;
}
.tjv-frame video {
  display:block; width:100%; height:auto; aspect-ratio:16/9;
  background:#0E1422; object-fit:contain;
}
.tjv-note { margin:12px 0 0; font-size:12.5px; color:var(--muted); }

/* The line under the import button on the signed-out overview. Says what the
   account costs before the form does, which is the whole point of letting the
   page be seen first. */
.tj-gate { margin:14px 0 0; font-size:13px; line-height:1.7; color:var(--muted); }
.tj-gate a { color:var(--orange); font-weight:600; text-decoration:none; border-bottom:1px solid rgba(255,92,26,.35); }
.tj-gate a:hover { border-bottom-color:var(--orange); }

/* ── The signed-out overview ─────────────────────────────────────────────────
   Someone arriving from the homepage lands here cold, so the page opens the
   way the public one does. Members never see any of this: they have an app to
   get to, not an argument to read. */
.tj-hero { background:var(--ink); color:#fff; padding:clamp(38px,5vw,64px) 0; }
.tj-hero-in { max-width:1280px; margin:0 auto; padding:0 var(--px,clamp(24px,4vw,80px)); }
/* main.css colours the bare h1 near-black, and a direct rule beats the #fff
   this section passes down, so without this the headline is black on black. */
.tj-hero h1 {
  font-family:'Fraunces',serif; color:#fff; font-size:clamp(30px,5vw,52px);
  font-weight:900; line-height:1.05; letter-spacing:-1.3px; margin:0 0 15px;
}
.tj-hero h1 em { font-style:italic; color:var(--orange); }
.tj-hero p { font-size:clamp(15.5px,1.8vw,18px); line-height:1.65; color:rgba(255,255,255,.76); max-width:62ch; margin:0; }

.tj-how { padding:34px clamp(20px,3vw,34px); }
.tj-how h2 { font-family:'Fraunces',serif; font-size:24px; font-weight:900; margin:0 0 6px; }
.tj-how-sub { color:var(--muted); font-size:15px; margin:0 0 20px; }
.tj-how-steps { list-style:none; margin:0; padding:0; counter-reset:tjh; display:grid; gap:2px; }
.tj-how-steps li { counter-increment:tjh; position:relative; padding:17px 0 17px 56px; border-bottom:1px solid var(--line); }
.tj-how-steps li:last-child { border-bottom:0; }
.tj-how-steps li::before {
  content:counter(tjh); position:absolute; left:0; top:16px; width:33px; height:33px;
  border-radius:50%; background:var(--ink); color:#fff; font-weight:800; font-size:14px;
  display:grid; place-items:center;
}
.tj-how-steps b { display:block; font-size:15.5px; margin-bottom:4px; }
.tj-how-steps span { display:block; font-size:14.5px; color:var(--muted); line-height:1.65; max-width:70ch; }

/* Questions, with the broker card alongside rather than stacked under. */
.tj-faqwrap { display:grid; grid-template-columns:1fr; gap:22px; align-items:start; margin-top:18px; }
@media (min-width:1000px) { .tj-faqwrap { grid-template-columns:minmax(0,1fr) 340px; gap:28px; } }
.tj-faq-h { font-family:'Fraunces',serif; font-size:26px; font-weight:900; margin:0 0 14px; }
.tj-faq details { border:1px solid var(--line); border-radius:12px; margin-bottom:10px; background:var(--bg); }
.tj-faq details[open] { border-color:rgba(255,92,26,.35); }
.tj-faq summary {
  cursor:pointer; padding:16px 18px; font-weight:700; font-size:15.5px; list-style:none;
  display:flex; align-items:center; justify-content:space-between; gap:16px; border-radius:12px;
}
.tj-faq summary::-webkit-details-marker { display:none; }
.tj-faq summary::after { content:'+'; flex:none; color:var(--orange); font-weight:800; font-size:19px; line-height:1; }
.tj-faq details[open] summary::after { content:'2'; }
.tj-faq summary:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }
.tj-faq details > p { margin:0 18px 17px; font-size:15px; line-height:1.72; color:var(--muted); max-width:72ch; }

/* The sample preview's own heading. The three figures inside it are the shared
   component now (assets/css/tj-figures.css); this is just the line above them. */
.tj-sample { margin-top:18px; }
.tj-sample-head { display:flex; align-items:baseline; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:16px; }
.tj-sample-head h2 { font-family:'Fraunces',serif; font-size:19px; font-weight:700; margin:0; }
.tj-sample-head span { font-size:12.5px; color:var(--muted); }
