/* R-TECK Capital: a daybook. Ink on paper, numbers in a monospace that lines up, one colour for gains and one for
   losses, and the paper-money banner impossible to miss. */
:root {
	--paper: #f6f5f1;
	--sheet: #fffefb;
	--ink: #17191c;
	--ink-2: #4a4f57;
	--ink-3: #7c828b;
	--rule: #dcd9d0;
	--rule-strong: #b9b5aa;
	--gain: #116b47;
	--loss: #a3262a;
	--act: #1d4e89;
	--act-ink: #ffffff;
	--warn-bg: #fff4d6;
	--warn-ink: #6b4b00;
	--halt-bg: #a3262a;
	--halt-ink: #ffffff;
	--paper-badge: #e8e2cf;
	--sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--paper: #111315; --sheet: #181b1e; --ink: #e9e7e1; --ink-2: #b4b1a8; --ink-3: #868a90; --rule: #2b2f33;
		--rule-strong: #43484e; --gain: #4fc08d; --loss: #f07a73; --act: #7fb0f0; --act-ink: #0d1520;
		--warn-bg: #3a2f10; --warn-ink: #f2d58a; --paper-badge: #3b3626;
	}
}
:root[data-theme="dark"] {
	--paper: #111315; --sheet: #181b1e; --ink: #e9e7e1; --ink-2: #b4b1a8; --ink-3: #868a90; --rule: #2b2f33;
	--rule-strong: #43484e; --gain: #4fc08d; --loss: #f07a73; --act: #7fb0f0; --act-ink: #0d1520;
	--warn-bg: #3a2f10; --warn-ink: #f2d58a; --paper-badge: #3b3626;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--sans); }
a { color: var(--act); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2);
	margin: 28px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-3); }
.num, td.n, th.n { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.flat { color: var(--ink-3); }

/* Bars at the top */
.mode { background: var(--paper-badge); color: var(--ink); font: 600 11px/1 var(--mono); letter-spacing: 0.12em;
	text-align: center; padding: 6px 16px; text-transform: uppercase; }
.halt { background: var(--halt-bg); color: var(--halt-ink); padding: 10px 16px; font-weight: 600; text-align: center; }
.halt a { color: inherit; text-decoration: underline; }
.top { display: flex; align-items: center; gap: 20px; padding: 0 24px; height: 52px; background: var(--sheet);
	border-bottom: 1px solid var(--rule); }
.brand { font-weight: 700; letter-spacing: 0.02em; color: var(--ink); white-space: nowrap; }
.brand span { font-weight: 400; color: var(--ink-3); }
nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav a { color: var(--ink-2); padding: 6px 10px; border-radius: 4px; white-space: nowrap; }
nav a.on { color: var(--ink); background: var(--paper); font-weight: 600; }
nav a:hover { text-decoration: none; color: var(--ink); }
.who { display: flex; align-items: center; gap: 10px; color: var(--ink-3); white-space: nowrap; }
.who form { margin: 0; }

main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.flash { padding: 10px 14px; border-left: 3px solid var(--gain); background: var(--sheet); margin-bottom: 16px; }
.flash.bad { border-color: var(--loss); }

/* The headline numbers */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 2px solid var(--ink);
	border-bottom: 1px solid var(--rule); background: var(--sheet); }
.figures div { padding: 14px 16px; border-right: 1px solid var(--rule); }
.figures div:last-child { border-right: 0; }
.figures dt { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.figures dd { margin: 0; font: 600 22px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.figures dd small { font-size: 13px; font-weight: 400; }

.sheet { background: var(--sheet); border: 1px solid var(--rule); padding: 16px; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.cols > * { min-width: 0; }

/* Tables: hairlines, numbers right, no zebra */
.table { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3); padding: 8px 10px;
	border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 1px solid var(--rule-strong); font-weight: 600; }
td .sub { display: block; color: var(--ink-3); font-size: 12px; }
.tag { display: inline-block; font: 500 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--rule-strong);
	border-radius: 3px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.tag.open { border-color: var(--act); color: var(--act); }
.tag.filled, .tag.paper { border-color: var(--gain); color: var(--gain); }
.tag.rejected, .tag.halted { border-color: var(--loss); color: var(--loss); }
.tag.experiment { border-color: var(--warn-ink); color: var(--warn-ink); background: var(--warn-bg); }
.stale { color: var(--warn-ink); background: var(--warn-bg); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* Forms */
form.inline { display: inline; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
input, select, textarea { font: 14px var(--sans); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule-strong);
	border-radius: 4px; padding: 7px 9px; width: 100%; min-width: 0; }
input.num { text-align: right; }
input[type=checkbox], input[type=radio] { width: auto; }
label.check { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
form.resume { display: grid; gap: 8px; margin-top: 8px; max-width: 32em; }
details > form { margin-top: 12px; }
.limit input { width: 7em; }
section.strategy { margin-bottom: 16px; }
section.strategy .head { margin-bottom: 8px; }
section.strategy h1 { font-size: 17px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--act); outline-offset: 1px; }
button { font: 600 13px var(--sans); border: 1px solid var(--act); background: var(--act); color: var(--act-ink);
	border-radius: 4px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
button.quiet { background: transparent; color: var(--act); }
button.danger { background: var(--loss); border-color: var(--loss); color: #fff; }
button.link { background: none; border: 0; color: var(--act); padding: 0; font-weight: 500; }
.side { display: flex; gap: 0; }
.side label { display: block; }
.side input { position: absolute; opacity: 0; width: 1px; }
.side span { display: block; padding: 7px 18px; border: 1px solid var(--rule-strong); cursor: pointer; font-weight: 600; }
.side label:first-child span { border-radius: 4px 0 0 4px; }
.side label:last-child span { border-radius: 0 4px 4px 0; border-left: 0; }
.side input:checked + span.buy { background: var(--gain); border-color: var(--gain); color: #fff; }
.side input:checked + span.sell { background: var(--loss); border-color: var(--loss); color: #fff; }
.side input:focus-visible + span { outline: 2px solid var(--act); }

/* Charts: the drawing stretches; the labels are text around it */
.plot { margin: 0; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 220px auto; gap: 4px 10px; }
.plot-y { grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; text-align: right; }
.plot-area { grid-row: 1; grid-column: 2; min-width: 0; }
.plot-x { grid-row: 2; grid-column: 2; display: flex; justify-content: space-between; }
.plot-y, .plot-x { font: 11px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.chart .compare { stroke: var(--ink-3); stroke-dasharray: 4 3; stroke-width: 1.2; }
.chart .axis { stroke: var(--rule-strong); }
.chart .dot { fill: var(--ink); }
.legend { font-size: 12px; color: var(--ink-3); }
.legend i { display: inline-block; width: 18px; border-top: 2px solid var(--ink); vertical-align: middle; margin-right: 4px; }
.legend i.cmp { border-top: 2px dashed var(--ink-3); }

.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login form { display: grid; gap: 12px; }
.login .brand { font-size: 18px; display: block; margin-bottom: 18px; }
.err { color: var(--loss); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.stats div { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.stats dt { font-size: 12px; color: var(--ink-3); }
.stats dd { margin: 0; font: 15px var(--mono); }
details summary { cursor: pointer; color: var(--act); }
.foot { color: var(--ink-3); font-size: 12px; padding: 24px; text-align: center; }

@media (max-width: 860px) {
	.cols { grid-template-columns: 1fr; }
	main { padding: 16px; }
	.top { padding: 0 16px; gap: 12px; }
	.who .name { display: none; }
	.figures dd { font-size: 18px; }
}
