:root {
	color-scheme: dark;
	--bg: #101820;
	--panel: #18232e;
	--line: #263646;
	--text: #e8eef4;
	--muted: #8fa1b3;
	--up: #2fd48a;
	--down: #ff6b6b;
	--accent: #00c878;
	--warn: #f5b942;
}

* {
	box-sizing: border-box;
}

body {
	font-family: system-ui, sans-serif;
	background: var(--bg);
	color: var(--text);
	margin: 0;
	line-height: 1.4;
}

main {
	max-width: 64rem;
	margin: 0 auto;
	padding: 1rem;
}

main.narrow {
	max-width: 26rem;
	padding-top: 2rem;
}

.top {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--bg);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.6rem 1rem;
	border-bottom: 1px solid var(--line);
}

.top form {
	margin: 0;
}

.brand {
	font-weight: 700;
	letter-spacing: 0.02em;
}

h1,
h2,
h3 {
	margin: 0 0 0.6rem;
}

h2 {
	font-size: 1.05rem;
}

h3 {
	font-size: 0.95rem;
	margin-top: 1rem;
	color: var(--muted);
}

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.card,
.panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 0.6rem;
	padding: 0.8rem 1rem 0.4rem;
}

.panel {
	margin-bottom: 1rem;
}

.card.stale {
	border-color: var(--warn);
}

.card.reference {
	opacity: 0.85;
}

.card {
	position: relative;
}

.bell {
	position: absolute;
	top: 0.4rem;
	right: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.8rem;
	height: 1.8rem;
	color: var(--muted);
	opacity: 0.6;
}

.bell.on {
	color: var(--warn);
	opacity: 1;
}

.bell:hover {
	opacity: 1;
}

.card-head {
	display: flex;
	gap: 0.5rem;
	align-items: baseline;
}

.price {
	font-size: 1.6rem;
	font-weight: 600;
	margin: 0.2rem 0;
	font-variant-numeric: tabular-nums;
}

.change.up {
	color: var(--up);
}

.change.down {
	color: var(--down);
}

.muted {
	color: var(--muted);
}

.small {
	font-size: 0.82rem;
}

.row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.2rem 0;
	border-bottom: 1px solid var(--line);
}

.row:last-child {
	border-bottom: 0;
}

.device {
	padding: 0.4rem 0 0.8rem;
	border-bottom: 1px solid var(--line);
}

.device-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.device-actions form {
	margin: 0;
}

.device-actions form.rename {
	display: contents;
}

.device-actions input[type='text'] {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	box-sizing: border-box;
}

.device-actions form.end {
	margin-left: auto;
}

form.center {
	display: flex;
	justify-content: center;
}

.form-actions {
	display: flex;
	justify-content: center;
}

.status.ok {
	color: var(--up);
}

.status.stale,
.status.absent {
	color: var(--down);
}

.banner {
	background: var(--warn);
	color: #101820;
	padding: 0.5rem 0.8rem;
	border-radius: 0.4rem;
}

.banner[hidden] {
	display: none;
}

.error {
	background: #3a1f24;
	border: 1px solid var(--down);
	padding: 0.6rem 0.8rem;
	border-radius: 0.4rem;
}

.form {
	display: grid;
	gap: 0.9rem;
}

.form label {
	display: grid;
	gap: 0.3rem;
}

input {
	font: inherit;
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--line);
	border-radius: 0.4rem;
	background: var(--bg);
	color: var(--text);
}

button {
	font: inherit;
	padding: 0.5rem;
	border: 0;
	border-radius: 0.5rem;
	background: var(--accent);
	color: #101820;
	width: 14rem;
	cursor: pointer;
	margin: 5px auto;
	display: block;
}

button[hidden] {
	display: none;
}

button.icon {
	background: none;
	width: auto;
	padding: 0.3rem 0.5rem;
	line-height: 0;
}

button.icon img {
	display: block;
}

.foot {
	color: var(--muted);
	font-size: 0.82rem;
	text-align: center;
}

time[title] {
	text-decoration: underline dotted;
	text-underline-offset: 0.15rem;
}

.nav {
	display: flex;
	gap: 0.3rem;
}

.nav a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.6rem;
	height: 2.4rem;
	color: var(--muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
}

.nav a:hover {
	color: var(--text);
}

.nav a[aria-current='page'] {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

.nav svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

a.button,
.actions button {
	display: inline-block;
	font: inherit;
	padding: 0.6rem 1rem;
	border-radius: 0.5rem;
	background: var(--accent);
	color: #101820;
	text-decoration: none;
	width: auto;
}

.actions {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
	align-items: center;
}

.actions form {
	margin: 0;
}

button.danger {
	background: var(--down);
}

.flash,
.banner.ok,
.banner.error {
	max-width: 64rem;
	margin: 0.8rem auto 0;
	padding: 0.5rem 0.8rem;
	border-radius: 0.4rem;
}

.flash.ok,
.banner.ok {
	background: #17382b;
	border: 1px solid var(--up);
	color: var(--text);
}

.flash.error,
.banner.error {
	background: #3a1f24;
	border: 1px solid var(--down);
	color: var(--text);
}

.rule.off {
	opacity: 0.6;
}

.narrow-form {
	max-width: 34rem;
	margin: 0 auto;
	padding: 1rem;
}

.form fieldset {
	border: 1px solid var(--line);
	border-radius: 0.4rem;
	display: grid;
	gap: 0.9rem;
}

.form fieldset[hidden] {
	display: none;
}

.form select,
form.tx-form select,
form.filters select {
	font: inherit;
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--line);
	border-radius: 0.4rem;
	background: var(--bg);
	color: var(--text);
}

.form label.check {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.form label.check input {
	width: auto;
}

.deliveries {
	list-style: none;
	margin: 0;
	padding: 0;
}

.delivery.sent {
	color: var(--up);
}

.delivery.failed {
	color: var(--down);
}

.delivery.pending,
.delivery.sending {
	color: var(--warn);
}

form.inline {
	display: inline;
}

form.inline button {
	width: auto;
	padding: 0.2rem 0.6rem;
}

.pager {
	text-align: center;
}

.chart-box {
	margin-top: 0.6rem;
}

.chart {
	display: block;
	width: 100%;
	height: 5.5rem;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 0.3rem;
}

.chart .wick {
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
}

.chart .up .wick {
	stroke: var(--up);
}

.chart .up .body {
	fill: var(--up);
}

.chart .down .wick {
	stroke: var(--down);
}

.chart .down .body {
	fill: var(--down);
}

.chart-legend,
.chart-range {
	width: 100%;
	margin-top: 0.2rem;
	display: block;
	text-align: center;
}

select.period {
	margin: 0 1rem;
	font: inherit;
	padding: 0.3rem 0.5rem;
	border: 1px solid var(--line);
	border-radius: 0.4rem;
	background: var(--panel);
	color: var(--text);
}

.nav svg .front {
	fill: var(--bg);
}

form.rename {
	display: flex;
	gap: 0.4rem;
	margin-top: 0.4rem;
}

form.rename input {
	flex: 1;
	min-width: 0;
}

#push-name-row label {
	display: block;
}

#push-name-row input {
	display: block;
	margin-top: 0.3rem;
	width: 100%;
}

.rule .actions {
	flex-wrap: nowrap;
	gap: 0.4rem;
}

.rule .actions .end {
	margin-left: auto;
}

.icon-btn {
	box-sizing: border-box;
	width: 2.4rem;
	height: 2.4rem;
	flex: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 1px solid var(--line);
	border-radius: 0.5rem;
	color: var(--muted);
}

button.icon-btn,
a.icon-btn {
	display: flex;
	width: 2.4rem;
	padding: 0;
	background: none;
	color: var(--muted);
}

.icon-btn:hover,
.icon-btn:focus-visible {
	color: var(--text);
	border-color: var(--muted);
}

.icon-btn svg {
	width: 1.3rem;
	height: 1.3rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

button.icon-btn.ok {
	color: var(--up);
}

button.icon-btn.off,
button.icon-btn.danger {
	color: var(--down);
}

.icon-btn svg .slash {
	stroke: var(--down);
	stroke-width: 2.2;
}

.icon-btn svg .fill {
	fill: currentColor;
	stroke: none;
}

@media (max-width: 640px) {
	.brand {
		display: none;
	}
}

form.search {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
}

form.search input {
	flex: 1 1 12rem;
	min-width: 0;
	box-sizing: border-box;
}

form.search button {
	width: 9rem;
}

.candidate,
.import {
	padding: 0.4rem 0 0.8rem;
	border-bottom: 1px solid var(--line);
}

.card:has(form.trash) {
	padding-bottom: 2.4rem;
}

form.trash {
	position: absolute;
	right: 0.5rem;
	bottom: 0.4rem;
	margin: 0;
}

form.trash button.icon {
	width: 1.8rem;
	height: 1.8rem;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	color: var(--muted);
	opacity: 0.6;
}

form.trash button.icon:hover {
	color: var(--down);
	opacity: 1;
}

abbr.term {
	text-decoration: underline dotted;
	text-underline-offset: 0.2em;
	cursor: help;
}

.pos {
	color: var(--up);
}

.neg {
	color: var(--down);
}

.kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
	gap: 0.8rem;
}

.kpis div {
	display: flex;
	flex-direction: column;
}

.kpi {
	font-size: 1.3rem;
	font-variant-numeric: tabular-nums;
}

.table-wrap {
	overflow-x: auto;
}

table.portfolio {
	width: 100%;
	border-collapse: collapse;
}

table.portfolio th,
table.portfolio td {
	padding: 0.4rem 0.5rem;
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
	text-align: left;
}

table.portfolio .num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.tabs {
	display: flex;
	gap: 1rem;
	justify-content: center;
}

.tabs a[aria-current='page'] {
	font-weight: 600;
	border-bottom: 2px solid var(--accent);
}

form.tx-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 0.6rem 1rem;
	margin-top: 0.8rem;
}

form.tx-form label {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

form.tx-form .legend {
	white-space: nowrap;
}

.tx .muted.small {
	white-space: nowrap;
}

form.tx-form p,
form.tx-form button {
	grid-column: 1 / -1;
}

form.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

form.filters button {
	width: auto;
}

.tx {
	padding: 0.5rem 0 0.8rem;
	border-bottom: 1px solid var(--line);
}

.tx.voided {
	opacity: 0.55;
}

.tx p {
	margin: 0.2rem 0;
}

.tx-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.tx-actions form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin: 0;
}

.tx-actions button {
	width: auto;
	margin: 0;
}

.badge {
	border: 1px solid var(--line);
	border-radius: 0.4rem;
	padding: 0 0.4rem;
	font-size: 0.8rem;
}

.term-entry {
	padding: 0.3rem 0 0.6rem;
	border-bottom: 1px solid var(--line);
}
