/* ===== Funds view — dashboard header, trend + flow charts, side cards, and the
   deposit/withdraw modal. Colours are theme tokens; the charts read the same
   tokens from SVG classes (funds-charts.js). Icons: /img/phosphor-rail.svg. ===== */
/* Numbers on this page use the UI face (Satoshi) with tabular figures rather
   than the terminal's mono --num, so the balance reads like a dashboard. */
#view-funds,
#funds-modal {
	--num: "Satoshi", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.fh-amt,
.fh-deltas b,
.fh-pill,
.fs-list li > b,
.fm-balances b,
.fm-amount,
.ff-sum,
.vx-ylab,
.vx-xlab,
.vx-tip b {
	font-variant-numeric: tabular-nums;
}
/* Flex/grid display rules below must not beat the hidden attribute. */
#view-funds [hidden],
.fm [hidden],
.vx-tip[hidden] {
	display: none !important;
}
.fd-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 16px;
	align-items: start;
}
.fd-main,
.fd-side {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}
.fd-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 24px;
	padding: 22px 24px;
}
.fd-lab {
	margin: 0 0 10px;
	font-size: 13px;
	color: var(--muted);
}
.fd-note {
	margin: 10px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--muted);
}
.fd-card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}
.fd-card-head h3 {
	margin: 0;
	font-size: 15px;
	font-weight: 650;
	letter-spacing: -0.01em;
	text-transform: none;
}
.fd-card-head .fd-lab {
	margin: 0;
}

/* ----- Header: total balance, change, lookbacks, action circles ----- */
.fh-hero {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 14px;
	margin: 4px 0 20px;
}
.fh-amt {
	font-family: var(--num);
	font-size: 44px;
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1;
	color: var(--txt);
}
.fh-pill {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: 999px;
	border: 1px solid var(--border);
	font-family: var(--num);
	font-size: 12px;
	font-weight: 600;
}
.fh-pill.up {
	color: var(--up);
	background: var(--up-bg);
	border-color: color-mix(in srgb, var(--up) 40%, transparent);
}
.fh-pill.down {
	color: var(--down);
	background: var(--down-bg);
	border-color: color-mix(in srgb, var(--down) 40%, transparent);
}
.fh-row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 18px;
	padding-top: 18px;
	border-top: 1px solid var(--border);
}
.fh-deltas {
	display: flex;
}
.fh-deltas > div {
	display: flex;
	flex-direction: column;
	gap: 5px;
	padding: 0 22px;
	border-left: 1px solid var(--border);
}
.fh-deltas > div:first-child {
	padding-left: 0;
	border-left: 0;
}
.fh-deltas span {
	font-size: 12px;
	color: var(--muted);
}
.fh-deltas b {
	font-family: var(--num);
	font-size: 14px;
	font-weight: 700;
	color: var(--txt);
}
.fh-deltas b.up {
	color: var(--up);
}
.fh-deltas b.down {
	color: var(--down);
}
.fh-actions {
	display: flex;
	gap: 18px;
}
.fh-act-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: var(--txt-2);
}
.fh-act {
	width: 46px;
	height: 46px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--border);
	background: var(--card-2);
	color: var(--txt);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.fh-act .tb-ic {
	width: 20px;
	height: 20px;
}

/* ----- Range pills ----- */
.seg-pills {
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border-radius: 999px;
	background: var(--card-2);
	border: 1px solid var(--border);
}
.seg-pills button {
	border: 0;
	background: none;
	color: var(--muted);
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	padding: 6px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition:
		background 0.12s,
		color 0.12s;
}
.seg-pills button:hover {
	color: var(--txt);
}
.seg-pills button.on {
	background: var(--accent);
	color: var(--on-accent);
}

/* ----- Charts ----- */
.vx-chart {
	position: relative;
	height: 260px;
}
.vx-bars {
	height: 170px;
}
.vx-svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}
.vx-grid {
	stroke: var(--border-2);
	stroke-dasharray: 2 5;
}
.vx-ylab,
.vx-xlab {
	fill: var(--muted);
	font-family: var(--num);
	font-size: 10.5px;
}
.vx-line {
	fill: none;
	stroke: var(--blue);
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
}
.vx-stop-a {
	stop-color: var(--blue);
	stop-opacity: 0.26;
}
.vx-stop-b {
	stop-color: var(--blue);
	stop-opacity: 0;
}
.vx-area.vx-anim {
	opacity: 0;
	animation: vx-fade 0.8s 0.55s forwards;
}
.vx-cross {
	stroke: var(--txt);
	stroke-width: 1;
}
.vx-dot {
	fill: var(--card);
	stroke: var(--txt);
	stroke-width: 2;
}
.vx-bar {
	fill: var(--blue);
	transform-box: fill-box;
	transform-origin: bottom;
	transition: fill 0.12s;
}
.vx-bar.vx-anim {
	animation: vx-grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.vx-bar.is-hot {
	fill: var(--link);
}
.vx-tip {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 11px;
	border-radius: 999px;
	background: var(--accent);
	color: var(--on-accent);
	font-size: 12px;
	white-space: nowrap;
	pointer-events: none;
	box-shadow: var(--shadow-sm);
}
.vx-tip b {
	font-family: var(--num);
	font-weight: 700;
}
.vx-tip span {
	padding-left: 8px;
	border-left: 1px solid color-mix(in srgb, var(--on-accent) 30%, transparent);
	opacity: 0.75;
}
.vx-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 0 16px;
	text-align: center;
	font-size: 13px;
	color: var(--muted);
}
@keyframes vx-fade {
	to {
		opacity: 1;
	}
}
@keyframes vx-grow {
	from {
		transform: scaleY(0);
	}
	to {
		transform: scaleY(1);
	}
}

/* ----- Deposits / withdrawals flow cards ----- */
.ff-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}
.ff-title {
	display: flex;
	align-items: center;
	gap: 10px;
}
.ff-ic {
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--card-2);
	color: var(--txt);
}
.ff-ic.in {
	background: var(--blue-dim);
	color: var(--link);
}
.ff-ic .tb-ic {
	width: 18px;
	height: 18px;
}
.ff-sum {
	font-family: var(--num);
	font-size: 12.5px;
	color: var(--txt-2);
	white-space: nowrap;
}
.ff-open {
	width: 100%;
	height: 40px;
	margin-top: 14px;
	border-radius: 999px;
	font-size: 13px;
}

/* ----- Side cards ----- */
.fs-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.fs-list li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--border);
}
.fs-list li:last-child {
	border-bottom: 0;
	padding-bottom: 2px;
}
.fs-list li > span {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 13.5px;
	color: var(--txt);
}
.fs-list small {
	font-size: 11.5px;
	color: var(--muted);
}
.fs-list li > b {
	font-family: var(--num);
	font-size: 15px;
	font-weight: 700;
	color: var(--txt);
	white-space: nowrap;
}
.fs-list b.up {
	color: var(--up);
}
.fs-list b.down {
	color: var(--down);
}
.fs-spot {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
}
.fs-spot .fd-note {
	margin: 0 0 8px;
}
.fb-alloc {
	min-height: 140px;
}
.fb-alloc .rs-chart-empty {
	padding: 40px 0;
	text-align: center;
	color: var(--muted);
	font-size: 13px;
}
.fee-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.fee-list li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--border);
	font-size: 13px;
}
.fee-list li:last-child {
	border-bottom: 0;
}
.fee-list li span {
	color: var(--txt-2);
}
.fee-list li b {
	color: var(--txt);
	font-weight: 600;
}

/* ----- Modal ----- */
.fm {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
}
.fm[hidden] {
	display: none;
}
body.fm-open {
	overflow: hidden;
}
.fm-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(6px);
}
.fm-card {
	position: relative;
	width: min(520px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	overflow: auto;
	margin: 0;
	padding: 22px 22px 20px;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 28px;
	box-shadow: var(--shadow);
	animation: fm-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.fm-card.fm-wide {
	width: min(980px, calc(100vw - 32px));
}
@keyframes fm-in {
	from {
		opacity: 0;
		transform: translateY(10px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: none;
	}
}
.fm-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
}
.fm-tabs {
	display: flex;
	gap: 18px;
}
.fm-tabs button {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: 24px;
	font-weight: 750;
	letter-spacing: -0.02em;
	color: var(--faint);
	cursor: pointer;
	transition: color 0.12s;
}
.fm-tabs button:hover {
	color: var(--txt-2);
}
.fm-tabs button.on {
	color: var(--txt);
}
.fm-title {
	margin: 0;
	font-size: 22px;
	font-weight: 750;
	letter-spacing: -0.02em;
	text-transform: none;
	color: var(--txt);
}
.fm-back,
.fm-close {
	flex: none;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--txt);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.fm-back:hover,
.fm-close:hover {
	background: var(--hover);
}
.fm-back {
	margin-left: -6px;
}
.fm-close {
	margin-left: auto;
}
.fm-balances {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin-bottom: 16px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 18px;
	overflow: hidden;
}
.fm-balances > div {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px;
}
.fm-balances > div + div {
	border-left: 1px solid var(--border);
}
.fm-balances span {
	font-size: 12.5px;
	color: var(--muted);
}
.fm-balances b {
	font-family: var(--num);
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--txt);
}
.fm-methods {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.fm-method {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: 18px;
	background: var(--card);
	color: var(--txt);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition:
		background 0.12s,
		border-color 0.12s;
}
.fm-method:hover {
	background: var(--hover);
	border-color: var(--border-2);
}
.fm-method:disabled {
	opacity: 0.6;
	cursor: default;
}
.fm-method-ic {
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--card-2);
	color: var(--txt);
}
.fm-method-ic.accent {
	background: var(--blue);
	color: #fff;
}
.fm-method-ic .tb-ic {
	width: 22px;
	height: 22px;
}
.fm-method-txt {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.fm-method-txt b {
	font-size: 15px;
	font-weight: 700;
}
.fm-method-txt small {
	font-size: 13px;
	color: var(--muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.fm-method-arrow {
	flex: none;
	color: var(--muted);
}
.fm-link {
	display: inline-block;
	margin-top: 16px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--link);
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}
.fm-link:hover {
	text-decoration: underline;
}

/* Form screens (receive / withdraw) — the inputs keep their app.js ids. */
.fm-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 12px;
	font-size: 12.5px;
	color: var(--muted);
}
.fm-screen select,
.fm-screen input:not([type="hidden"]) {
	width: 100%;
	height: 46px;
	padding: 0 14px;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--card);
	color: var(--txt);
	font: inherit;
	font-size: 14px;
	outline: none;
}
.fm-screen select:focus,
.fm-screen input:focus {
	border-color: var(--blue);
}
.chain-field {
	margin-bottom: 12px;
}
.chain-field-lab {
	display: block;
	margin-bottom: 8px;
}
.chain-chips {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}
/* Network card: the name sits left; a tilted glass badge hugs the right edge
   and is cropped by it, greyscale until the card is selected. */
.chain-chip {
	position: relative;
	display: flex;
	align-items: center;
	height: 72px;
	padding: 0 12px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--card);
	color: var(--txt);
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	text-align: left;
	overflow: hidden;
	isolation: isolate;
	cursor: pointer;
	transition:
		border-color 0.15s,
		background 0.15s,
		box-shadow 0.15s;
}
.chain-chip:hover {
	background: var(--hover);
}
.chain-chip.active {
	border-color: var(--txt);
	box-shadow: 0 0 0 1px var(--txt);
	background: var(--card-2);
}
.chain-chip .chain-name {
	position: relative;
	z-index: 1;
	max-width: 64%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.chain-badge {
	position: absolute;
	right: -28px;
	top: 50%;
	width: 98px;
	height: 98px;
	transform: translateY(-50%) rotate(-12deg);
	filter: grayscale(1) opacity(0.55) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
	transition:
		filter 0.22s,
		transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
	pointer-events: none;
}
.chain-badge svg {
	width: 100%;
	height: 100%;
	display: block;
	overflow: visible;
}
.chain-badge .hb-side {
	fill: color-mix(in srgb, var(--c) 40%, #000);
	opacity: 0.85;
}
.chain-badge .hb-base {
	fill: color-mix(in srgb, var(--c) 45%, #fff);
	opacity: 0.6;
}
.chain-badge .hb-glow {
	fill: var(--c);
}
.chain-badge .hb-bloom {
	fill: #fff;
	opacity: 0.55;
}
.chain-badge .hb-glyph-shadow {
	opacity: 0.4;
	filter: brightness(0.15);
}
.chain-chip:hover .chain-badge {
	filter: grayscale(0.4) opacity(0.85) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
}
.chain-chip.active .chain-badge {
	filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.4));
	transform: translateY(-50%) rotate(-8deg) scale(1.06);
}
.chain-chip--off .chain-badge {
	filter: grayscale(1) opacity(0.25);
}
.chain-ico {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 7px;
	display: inline-flex;
	overflow: hidden;
}
.chain-ico svg {
	width: 100%;
	height: 100%;
	display: block;
}
.dep-qr-wrap {
	display: flex;
	justify-content: center;
	margin: 4px 0 14px;
}
.dep-qr {
	width: 184px;
	height: 184px;
	padding: 12px;
	border-radius: 18px;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}
.dep-qr:empty {
	display: none;
}
.dep-qr svg {
	width: 100%;
	height: 100%;
	display: block;
	shape-rendering: crispEdges;
}
.fm-screen .addr-box {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 12px 10px 12px 14px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--card);
}
.fm-screen .addr-box .addr {
	flex: 1;
	min-width: 0;
	font-family: var(--num);
	font-size: 13px;
	line-height: 1.4;
	word-break: break-all;
	color: var(--txt);
	background: none;
	padding: 0;
}
.fm-screen .addr-copy {
	flex: none;
	height: 32px;
	padding: 0 12px;
	border-radius: 999px;
	font-size: 12.5px;
}
.dep-warn {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 12px;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--card);
	font-size: 13px;
	line-height: 1.5;
	color: var(--txt-2);
}
.dep-warn svg {
	flex: none;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	color: var(--warn);
}
.dep-warn b {
	color: var(--txt);
}
.fm-note-box {
	margin-top: 12px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--muted);
}
.fm-note-box b {
	color: var(--txt);
}
.fm-dev {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--border);
}
.fm-dev label,
#dep-live label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12.5px;
	color: var(--muted);
}
.fm-amount {
	display: flex;
	align-items: center;
	gap: 4px;
	height: 76px;
	margin-bottom: 10px;
	padding: 0 20px;
	border: 1.5px solid var(--border);
	border-radius: 20px;
	background: var(--card);
	font-family: var(--num);
	font-size: 34px;
	font-weight: 700;
	letter-spacing: -0.02em;
	transition: border-color 0.12s;
}
.fm-amount:focus-within {
	border-color: var(--blue);
}
.fm-amount > span {
	color: var(--muted);
}
/* !important: style.css styles every input through a long :not() chain with
   id-level specificity, which would paint a pill inside the amount field. */
.fm-screen .fm-amount input,
.fm-screen .fm-amount input:focus {
	flex: 1;
	min-width: 0;
	height: auto !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	box-shadow: none !important;
	outline: none;
	font: inherit;
	color: var(--txt);
	-moz-appearance: textfield;
}
.fm-amount input::-webkit-outer-spin-button,
.fm-amount input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.fm-chips {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
}
.fm-chips button {
	height: 36px;
	padding: 0 14px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--card);
	color: var(--txt);
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.12s;
}
.fm-chips button:hover {
	background: var(--hover);
}
.fm-free {
	margin: 0 0 14px;
	font-size: 13px;
	color: var(--muted);
}
.fm-free b {
	font-family: var(--num);
	color: var(--txt);
}
.fm-submit {
	width: 100%;
	height: 52px;
	margin-top: 6px;
	border-radius: 999px;
	font-size: 15px;
}
.fm-screen .err.tiny:empty,
.fm-screen .fd-note:empty {
	display: none;
}
.fm-screen .err.tiny {
	margin-top: 8px;
	font-size: 12px;
	color: var(--down);
}
.fm-err {
	margin-top: 12px;
	font-size: 13px;
	color: var(--down);
}
.fm-err:empty {
	display: none;
}
.fm-err .ok-msg {
	color: var(--up);
}
.fm-copy {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.55;
	color: var(--txt-2);
}
.fm-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.fm-table {
	max-height: 62vh;
	overflow: auto;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--card);
}
.fm-table .tbl {
	width: 100%;
}
.fm-screen-wide .pf-empty {
	padding: 24px;
}

@media (max-width: 1100px) {
	.fd-grid {
		grid-template-columns: 1fr;
	}
}
@media (max-width: 700px) {
	.ff-grid {
		grid-template-columns: 1fr;
	}
	.chain-chips {
		grid-template-columns: 1fr 1fr;
	}
	.fh-amt {
		font-size: 34px;
	}
	.fh-row {
		align-items: flex-start;
	}
	.fh-deltas > div {
		padding: 0 14px;
	}
	.fd-card {
		padding: 18px;
		border-radius: 20px;
	}
	.fm-card {
		margin: 12px auto;
		padding: 18px 16px 16px;
		border-radius: 22px;
	}
	.fm-tabs button {
		font-size: 20px;
	}
	.fm-method-txt small {
		white-space: normal;
	}
	.fm-balances b {
		font-size: 18px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.fm-card,
	.vx-area.vx-anim,
	.vx-bar.vx-anim {
		animation: none;
		opacity: 1;
	}
}
