/* Back-test results (inc/results.php, assets/results.js): the results pages, and the result cards on the product
   pages. Light and dark from the theme's tokens; the two chart colours were checked for colour-blind separation
   and contrast against the card in each appearance. Text never takes a chart colour: figures use the ink, and
   a profit or a loss the theme's status ink with its sign. */

.k3r, .k3r-card {
	--k3r-gain: #008e95;
	--k3r-loss: #c22b22;
	--k3r-grid: var(--line);
	--k3r-axis: var(--mute);
}
:root[data-theme="dark"] .k3r, :root[data-theme="dark"] .k3r-card {
	--k3r-gain: #139e95;
	--k3r-loss: #e45d52;
}

/* ---- the hero */
.k3r-hero { padding-bottom: 40px; }
.k3r-hero h1 span { font-size: .52em; margin-top: .25em; }
.k3r-crumbs, .k3r-crumbs a { color: #a9c6c3; }
.k3r-hero-figure { margin: 26px 0 0; display: flex; flex-direction: column; gap: 2px; }
.k3r-hero-figure span { color: #b9d3d0; font-size: .9rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.k3r-hero-figure b { font-size: clamp(2.4rem, 6.4vw, 3.6rem); line-height: 1.05; color: #fff; font-weight: 800; letter-spacing: -.02em; }
.k3r-hero-figure small { color: #cfe3e0; font-size: .98rem; }
.k3r .vg-stats b { font-size: clamp(1.3rem, 2.6vw, 1.6rem); }
.k3r-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.k3r-others { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; color: #cfe3e0; font-size: .95rem; }
.k3r-others a { padding: 4px 12px; border-radius: 999px; border: 1px solid #ffffff40; color: #fff; font-weight: 700; text-decoration: none; }
.k3r-others a:hover { border-color: var(--accent); color: var(--accent); }

/* ---- the charts */
.k3r-chart { position: relative; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px 6px; min-height: 120px; outline-offset: 3px; }
.k3r-chart > svg { display: block; width: 100%; height: auto; }
.k3r-chart > svg.k3r-spark { height: 260px; }
.k3r-svg { overflow: visible; }
.k3r-grid { stroke: var(--k3r-grid); stroke-width: 1; shape-rendering: crispEdges; }
.k3r-base { stroke: var(--k3r-axis); stroke-width: 1; opacity: .55; shape-rendering: crispEdges; }
.k3r-axis { fill: var(--k3r-axis); font: 12px var(--font); font-variant-numeric: tabular-nums; }
.k3r-line { fill: none; stroke: var(--k3r-gain); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.k3r-area { fill: var(--k3r-gain); opacity: .1; }
.k3r-dot { fill: var(--k3r-gain); stroke: var(--card); stroke-width: 2; }
.k3r-cross { stroke: var(--k3r-axis); stroke-width: 1; }
.k3r-hit { fill: transparent; cursor: crosshair; }
.k3r-chart-months .k3r-hit { cursor: pointer; }
.k3r-hit:focus { outline: none; }
.k3r-hit:focus-visible { stroke: var(--link); stroke-width: 2; }
.k3r-bar { fill: var(--k3r-gain); transition: opacity .12s; }
.k3r-bar.loss { fill: var(--k3r-loss); }
.k3r-bar.hot { opacity: .78; }
.k3r-tip { position: absolute; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .1s; background: var(--card); color: var(--ink);
	border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-size: .85rem; white-space: nowrap; }
.k3r-tip.on { opacity: 1; }
.k3r-tip-v { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.k3r-tip-r { color: var(--ink-2); }
.k3r-key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--k3r-gain); }
.k3r-key.loss { background: var(--k3r-loss); }
.k3r-table-view { margin-top: 14px; }
.k3r-table-view summary { cursor: pointer; color: var(--link); font-weight: 700; }
.k3r-table-view .table-scroll { margin-top: 12px; }

/* ---- figures */
.k3r-num td, .k3r-num th { font-variant-numeric: tabular-nums; white-space: nowrap; }
.k3r-gain { color: var(--ok); font-weight: 700; }
.k3r-loss { color: var(--bad); font-weight: 700; }
.k3r-dd th[scope="row"] { width: 34%; }
.k3r-dd th small { display: block; font-weight: 400; color: var(--mute); font-size: .85rem; line-height: 1.4; margin-top: 2px; }
.k3r-dd td b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.k3r-dd-label { display: block; font-size: .78rem; color: var(--mute); }
.k3r-report { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.k3r-report > div { background: var(--card); padding: 12px 16px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.k3r-report span { color: var(--ink-2); font-size: .92rem; }
.k3r-report b { font-variant-numeric: tabular-nums; text-align: right; }

/* ---- every trade */
.k3r-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0 0 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.k3r-filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.k3r-filters select, .k3r-filters input { font: inherit; font-size: .95rem; font-weight: 400; padding: 8px 10px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--field); color: var(--ink); max-width: 100%; }
.k3r-goto input { width: 9.5em; }
.k3r-count { color: var(--ink-2); margin: 0 0 8px; font-size: .92rem; }
.k3r-trades tbody tr { cursor: pointer; }
.k3r-trades tbody tr:hover td { background: var(--soft); }
.k3r-trades td:first-child, .k3r-trades th:first-child { position: sticky; left: 0; background: var(--card); }
.k3r-open { font: inherit; font-weight: 800; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.k3r-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 0; }
.k3r-pager span { color: var(--ink-2); font-size: .92rem; }

/* ---- one trade */
.k3r-trade { border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 32px)); width: 100%; }
.k3r-trade::backdrop { background: #021014b3; }
.k3r-trade-inner { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.k3r-trade header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.k3r-trade h3 { margin: 0; }
.k3r-x { font-size: 1.6rem; line-height: 1; background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 4px 8px; }
.k3r-trade-net { margin: 10px 0 14px; display: flex; flex-direction: column; }
.k3r-trade-net b { font-size: 2rem; line-height: 1.1; }
.k3r-trade-net span { color: var(--ink-2); }
.k3r-trade-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; padding: 14px 0; border-block: 1px solid var(--line); }
.k3r-trade-facts dt { color: var(--ink-2); }
.k3r-trade-facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.k3r-trade footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

/* ---- the result card (product pages and /results/) */
.k3r-card { display: flex; flex-direction: column; gap: 10px; }
.k3r-card h3 { margin: 6px 0 0; }
.k3r-card .mute { margin: 0; }
.k3r-card-chart { display: block; background: var(--soft); border-radius: 10px; padding: 8px 6px 2px; }
.k3r-spark { display: block; width: 100%; height: 70px; }
.k3r-spark-line { fill: none; stroke: var(--k3r-gain); stroke-width: 2; stroke-linejoin: round; }
.k3r-spark-area { fill: var(--k3r-gain); opacity: .1; }
.k3r-card-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.k3r-card-stats div { background: var(--soft); border-radius: 10px; padding: 8px 12px; }
.k3r-card-stats span { display: block; font-size: .78rem; color: var(--ink-2); }
.k3r-card-stats b { font-size: 1.12rem; }
.k3r-card-dd { width: 100%; border-collapse: collapse; font-size: .9rem; }
.k3r-card-dd caption { text-align: left; font-weight: 700; font-size: .82rem; color: var(--ink-2); padding-bottom: 4px; }
.k3r-card-dd th, .k3r-card-dd td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
.k3r-card-dd thead th { font-size: .78rem; color: var(--mute); font-weight: 700; }
.k3r-card-go { align-self: flex-start; margin-top: 4px; }
.k3r-list { margin-top: 0; }

@media (max-width: 900px) {
	.k3r-report { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
	.k3r-report { grid-template-columns: 1fr; }
	.k3r .vg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.k3r-filters label { flex: 1 1 calc(50% - 12px); }
	.k3r-dd th[scope="row"] { width: auto; }
	.k3r-chart { padding: 10px 4px 4px; }
}
@media print {
	.k3r-filters, .k3r-pager, .k3r-actions, .k3r-others { display: none; }
}
