/* Fx2Fund web terminal — "precision instrument" direction.
   Ink panels, hairline rules, gold for focus/selection only, green/red
   reserved strictly for buy/sell and P&L. Numbers are tabular mono so a
   ticking price never shifts the layout. */

/* Self-hosted (the site CSP allows fonts from 'self' only). Archivo files are
   shared with css/style.css; JetBrains Mono is OFL-licensed. */
@font-face { font-family: "Archivo"; font-weight: 400; font-display: swap; src: url(../fonts/archivo-v18-latin-regular.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 700; font-display: swap; src: url(../fonts/archivo-v18-latin-700.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-latin-400.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url(../fonts/jetbrains-mono-latin-600.woff2) format("woff2"); }

:root {
	--ink-0: #070A12;
	--ink-1: #0B0F1A;
	--ink-2: #111726;
	--ink-3: #172036;
	--ink-4: #1F2A44;
	--rule: rgba(255, 255, 255, 0.06);
	--rule-strong: rgba(255, 255, 255, 0.12);
	--text: #E8ECF5;
	--text-2: rgba(232, 236, 245, 0.62);
	--text-3: rgba(232, 236, 245, 0.38);
	--gold: #FCB42D;
	--gold-dim: rgba(252, 180, 45, 0.14);
	--buy: #22C993;
	--buy-dim: rgba(34, 201, 147, 0.14);
	--sell: #FF5470;
	--sell-dim: rgba(255, 84, 112, 0.14);
	--warn: #F5A524;

	--font-ui: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-num: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	--r-sm: 6px;
	--r-md: 10px;
	--r-lg: 14px;
	--gap: 1px;                 /* panels are separated by a 1px rule of --ink-0 */
	--tabbar-h: 64px;
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* component display rules must never beat the hidden attribute */
html, body { height: 100%; margin: 0; }
body {
	background: var(--ink-0);
	color: var(--text);
	font-family: var(--font-ui);
	font-size: 13px;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.up { color: var(--buy); }
.down { color: var(--sell); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── App grid ─────────────────────────────────────────────────────────── */
.tx-app {
	height: 100dvh;
	display: grid;
	gap: var(--gap);
	grid-template-columns: 280px minmax(0, 1fr) 312px;
	grid-template-rows: auto auto minmax(0, 1fr) 272px;
	grid-template-areas:
		"top    top    top"
		"banner banner banner"
		"watch  chart  ticket"
		"watch  book   book";
}
.tx-top { grid-area: top; }
.tx-banner { grid-area: banner; }
.tx-watch { grid-area: watch; }
.tx-chart-wrap { grid-area: chart; }
.tx-ticket { grid-area: ticket; }
.tx-book { grid-area: book; }
.tx-top, .tx-watch, .tx-chart-wrap, .tx-ticket, .tx-book { background: var(--ink-1); min-width: 0; min-height: 0; }

/* ── Top bar ──────────────────────────────────────────────────────────── */
.tx-top {
	display: flex; align-items: center; gap: 20px;
	padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
	background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
}
.tx-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.tx-brand-mark {
	width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
	background: var(--gold); color: var(--ink-0); font-weight: 800; font-size: 12px; letter-spacing: -0.02em;
}
.tx-brand-word { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.tx-acct { display: flex; gap: 22px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tx-acct::-webkit-scrollbar { display: none; }
.tx-stat { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.tx-stat-l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-3); font-weight: 600; }
.tx-stat-v { font-size: 14px; font-weight: 500; }
.tx-stat-hero .tx-stat-v { font-size: 17px; font-weight: 600; }
.tx-stat-rr .tx-stat-v { color: var(--gold); }
.tx-top-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.tx-conn { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.tx-conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tx-conn[data-state="live"] i { background: var(--buy); box-shadow: 0 0 0 3px var(--buy-dim); }
.tx-conn[data-state="down"] i { background: var(--sell); }
.tx-clock { font-size: 12px; color: var(--text-2); padding: 5px 9px; border: 1px solid var(--rule); border-radius: var(--r-sm); }
.tx-clock:empty { display: none; }

.tx-banner {
	padding: 10px 16px; font-size: 13px; background: var(--gold-dim); color: var(--gold);
	border-bottom: 1px solid rgba(252, 180, 45, 0.2);
}
.tx-banner a { color: var(--text); font-weight: 600; }

/* ── Watchlist ────────────────────────────────────────────────────────── */
.tx-watch { display: flex; flex-direction: column; }
.tx-watch-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 10px; }
.tx-search {
	width: 100%; padding: 9px 12px; border-radius: var(--r-sm); border: 1px solid var(--rule);
	background: var(--ink-2); outline: none; transition: border-color 0.2s;
}
.tx-search:focus { border-color: rgba(252, 180, 45, 0.45); }
.tx-cats { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tx-cat {
	padding: 5px 10px; border-radius: 999px; font-size: 12px; color: var(--text-2); white-space: nowrap;
	border: 1px solid transparent; transition: color 0.15s, background 0.15s;
}
.tx-cat:hover { color: var(--text); }
.tx-cat.is-on { color: var(--gold); background: var(--gold-dim); border-color: rgba(252, 180, 45, 0.25); }
.tx-watch-cols, .tx-watch-row {
	display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px; gap: 6px; align-items: center;
}
.tx-watch-cols {
	padding: 6px 12px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3);
	border-bottom: 1px solid var(--rule);
}
.tx-watch-cols span:not(:first-child) { text-align: right; }
.tx-watch-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1; }
.tx-watch-row {
	padding: 8px 12px; cursor: pointer; position: relative; border-left: 2px solid transparent;
	transition: background 0.12s;
}
.tx-watch-row:hover { background: var(--ink-2); }
.tx-watch-row.is-on { background: var(--ink-3); border-left-color: var(--gold); }
.tx-watch-row.is-closed .tx-q { color: var(--text-3); }
.tx-w-sym { font-weight: 600; font-size: 13px; display: block; }
.tx-w-sub { font-size: 11px; color: var(--text-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-q { text-align: right; font-size: 12.5px; padding: 3px 4px; border-radius: 4px; transition: background 0.6s var(--ease); }
.tx-q.flash-up { background: var(--buy-dim); color: var(--buy); transition: none; }
.tx-q.flash-down { background: var(--sell-dim); color: var(--sell); transition: none; }
.tx-w-closed { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Chart ────────────────────────────────────────────────────────────── */
.tx-chart-wrap { display: flex; flex-direction: column; }
.tx-chart-head {
	display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
	padding: 12px 16px; border-bottom: 1px solid var(--rule);
}
.tx-sym { display: flex; flex-direction: column; text-align: left; cursor: default; }
.tx-chev { display: none; width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tx-quick, .tx-ticket-head, .tx-acct-toggle, .tx-book-sum { display: none; }
.tx-lot-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tx-lot-chip {
	flex: 1; padding: 6px 0; border-radius: 999px; font-family: var(--font-num); font-size: 12px; color: var(--text-2);
	background: var(--ink-2); border: 1px solid var(--rule); transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tx-lot-chip:hover { color: var(--text); border-color: var(--rule-strong); }
.tx-lot-chip.is-on { color: var(--gold); border-color: rgba(252, 180, 45, 0.4); background: var(--gold-dim); }
.tx-sym-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.tx-sym-desc { font-size: 12px; color: var(--text-3); }
.tx-sym-px { display: flex; align-items: baseline; gap: 10px; }
.tx-sym-price { font-size: 22px; font-weight: 600; }
.tx-sym-spread { font-size: 11px; color: var(--text-3); }
.tx-sym-state {
	font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 3px 7px; border-radius: 4px;
	color: var(--buy); background: var(--buy-dim);
}
.tx-sym-state.is-closed { color: var(--text-2); background: var(--ink-3); }
.tx-tfs { margin-left: auto; display: flex; background: var(--ink-2); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.tx-tfs button { padding: 5px 10px; border-radius: 4px; font-size: 12px; color: var(--text-2); font-family: var(--font-num); }
.tx-tfs button:hover { color: var(--text); }
.tx-tfs button.is-on { background: var(--ink-4); color: var(--gold); }
.tx-chart { flex: 1; position: relative; min-height: 200px; }
.tx-chart-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 13px; text-align: center; padding: 20px; pointer-events: none; z-index: 2; }
.tx-chart-msg:empty { display: none; }

/* ── Ticket ───────────────────────────────────────────────────────────── */
.tx-ticket { padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.tx-sides { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 6px; }
.tx-side {
	display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px;
	border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--ink-2);
	transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.tx-side:active { transform: scale(0.98); }
.tx-side span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-2); }
.tx-side b { font-size: 17px; font-weight: 600; }
.tx-sell.is-on { background: var(--sell-dim); border-color: rgba(255, 84, 112, 0.5); }
.tx-sell.is-on span, .tx-sell.is-on b { color: var(--sell); }
.tx-buy.is-on { background: var(--buy-dim); border-color: rgba(34, 201, 147, 0.5); }
.tx-buy.is-on span, .tx-buy.is-on b { color: var(--buy); }
.tx-spread { align-self: center; font-size: 10px; color: var(--text-3); writing-mode: horizontal-tb; }
.tx-seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--ink-2); border-radius: var(--r-sm); padding: 3px; }
.tx-seg button { padding: 7px 0; border-radius: 4px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.tx-seg button.is-on { background: var(--ink-4); color: var(--text); }
.tx-field { display: flex; flex-direction: column; gap: 6px; }
.tx-field > span { font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tx-field > span em { font-style: normal; color: var(--text-3); margin-left: auto; font-size: 10.5px; }
.tx-field input[type="number"] {
	width: 100%; padding: 9px 11px; border-radius: var(--r-sm); border: 1px solid var(--rule);
	background: var(--ink-2); outline: none; font-size: 14px; transition: border-color 0.2s, opacity 0.2s;
	-moz-appearance: textfield;
}
.tx-field input::-webkit-outer-spin-button, .tx-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tx-field input:focus { border-color: rgba(252, 180, 45, 0.45); }
.tx-field input:disabled { opacity: 0.35; }
.tx-field input[type="checkbox"] { accent-color: var(--gold); margin: 0; }
.tx-stepper { display: grid; grid-template-columns: 38px 1fr 38px; gap: 4px; }
.tx-stepper button { border-radius: var(--r-sm); background: var(--ink-2); border: 1px solid var(--rule); font-size: 17px; color: var(--text-2); }
.tx-stepper button:hover { color: var(--text); border-color: var(--rule-strong); }
.tx-stepper input { text-align: center; }
.tx-stops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tx-preview { margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }
.tx-preview div { display: flex; justify-content: space-between; }
.tx-preview dt { color: var(--text-3); font-size: 11.5px; }
.tx-preview dd { margin: 0; font-size: 12.5px; }
.tx-submit-wrap { display: flex; flex-direction: column; gap: 8px; }
.tx-submit {
	width: 100%; padding: 14px; border-radius: var(--r-md); font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
	color: #04130D; background: var(--buy); transition: filter 0.15s, transform 0.08s, opacity 0.2s;
}
.tx-submit[data-side="sell"] { background: var(--sell); color: #1A0409; }
.tx-submit:hover { filter: brightness(1.08); }
.tx-submit:active { transform: scale(0.99); }
.tx-submit:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.tx-ticket-msg { margin: 0; font-size: 12px; min-height: 16px; color: var(--text-2); }
.tx-ticket-msg.is-error { color: var(--sell); }
.tx-ticket-msg.is-ok { color: var(--buy); }

/* ── Book (positions / orders / history) ─────────────────────────────── */
.tx-book { display: flex; flex-direction: column; }
.tx-book-tabs { display: flex; gap: 4px; padding: 6px 10px 0; border-bottom: 1px solid var(--rule); align-items: flex-end; }
.tx-book-tabs > button[data-book] {
	padding: 9px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tx-book-tabs > button.is-on { color: var(--text); border-bottom-color: var(--gold); }
.tx-count { font-family: var(--font-num); font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: var(--ink-3); color: var(--text-2); margin-left: 4px; }
.tx-close-all { margin-left: auto; margin-bottom: 6px; padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); color: var(--sell); border: 1px solid rgba(255, 84, 112, 0.35); }
.tx-close-all:hover { background: var(--sell-dim); }
.tx-book-body { flex: 1; overflow: auto; }
.tx-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tx-table th {
	position: sticky; top: 0; background: var(--ink-1); text-align: right; font-weight: 500; font-size: 10.5px;
	text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.tx-table td { text-align: right; padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tx-table th:first-child, .tx-table td:first-child { text-align: left; }
.tx-table tr:hover td { background: var(--ink-2); }
.tx-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 4px; }
.tx-tag-buy { color: var(--buy); background: var(--buy-dim); }
.tx-tag-sell { color: var(--sell); background: var(--sell-dim); }
.tx-row-actions { display: inline-flex; gap: 4px; }
.tx-row-actions button { padding: 4px 9px; border-radius: 5px; font-size: 11.5px; border: 1px solid var(--rule-strong); color: var(--text-2); }
.tx-row-actions button:hover { color: var(--text); background: var(--ink-3); }
.tx-row-actions .tx-x { color: var(--sell); border-color: rgba(255, 84, 112, 0.35); }
.tx-empty { padding: 28px 16px; text-align: center; color: var(--text-3); }
.tx-empty a { color: var(--gold); }
.tx-cards { display: none; }

/* ── Dialog + toasts ─────────────────────────────────────────────────── */
.tx-dialog {
	border: 1px solid var(--rule-strong); border-radius: var(--r-lg); background: var(--ink-2); color: var(--text);
	padding: 20px; width: min(360px, calc(100vw - 32px));
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.tx-dialog::backdrop { background: rgba(3, 5, 10, 0.7); backdrop-filter: blur(3px); }
.tx-dialog h3 { margin: 0 0 14px; font-size: 16px; }
.tx-dialog form { display: flex; flex-direction: column; gap: 12px; }
.tx-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.tx-btn-ghost { padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid var(--rule-strong); color: var(--text-2); }
.tx-btn-ghost:hover { color: var(--text); }
.tx-btn-gold { padding: 9px 16px; border-radius: var(--r-sm); background: var(--gold); color: var(--ink-0); font-weight: 700; }
.tx-toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.tx-toast {
	padding: 11px 14px; border-radius: var(--r-md); background: var(--ink-3); border: 1px solid var(--rule-strong);
	font-size: 13px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); animation: tx-in 0.25s var(--ease);
	border-left: 3px solid var(--gold); max-width: 340px;
}
.tx-toast.is-ok { border-left-color: var(--buy); }
.tx-toast.is-error { border-left-color: var(--sell); }
@keyframes tx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tx-tabbar { display: none; }

/* ── Tablet ───────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
	.tx-app {
		grid-template-columns: 250px 300px minmax(0, 1fr);
		grid-template-rows: auto auto minmax(0, 1fr) 300px;
		grid-template-areas:
			"top    top    top"
			"banner banner banner"
			"watch  chart  chart"
			"watch  ticket book";
	}
	.tx-hide-sm { display: none; }
}

/* ── Phone: one panel at a time + bottom tab bar ─────────────────────── */
@media (max-width: 760px) {
	body { font-size: 14px; }
	.tx-app {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto auto minmax(0, 1fr);
		grid-template-areas: "top" "banner" "main";
		padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
	}
	.tx-watch, .tx-chart-wrap, .tx-ticket, .tx-book { grid-area: main; display: none; }
	.tx-app[data-view="watch"] .tx-watch,
	.tx-app[data-view="chart"] .tx-chart-wrap,
	.tx-app[data-view="ticket"] .tx-ticket,
	.tx-app[data-view="book"] .tx-book { display: flex; animation: tx-view-in 0.22s var(--ease); }
	@keyframes tx-view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

	/* iOS zooms any focused input under 16px — keep every field at 16px. */
	input, .tx-field input[type="number"], .tx-search { font-size: 16px; }

	/* ── Compact header: equity · P&L · R:R; tap the chevron for the rest ── */
	/* Row 1: logo · countdown · live dot + toggle. Row 2: the stats. */
	.tx-top {
		display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 10px;
		padding: 8px 12px 10px; padding-top: max(8px, env(safe-area-inset-top));
	}
	.tx-brand { grid-column: 1; grid-row: 1; }
	.tx-top-right { display: contents; }
	.tx-conn { grid-column: 3; grid-row: 1; justify-self: end; margin-right: 42px; }
	.tx-acct-toggle { grid-column: 3; grid-row: 1; justify-self: end; }
	.tx-acct { grid-column: 1 / -1; grid-row: 2; }
	.tx-brand-mark { width: 26px; height: 26px; border-radius: 7px; font-size: 11px; }
	.tx-brand-word { display: none; }
	.tx-acct { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; overflow: visible; }
	.tx-stat-v { white-space: nowrap; }
	.tx-acct .tx-stat { display: none; }
	.tx-acct .tx-stat-hero, .tx-acct #st-pnl-stat, .tx-acct .tx-stat-rr { display: flex; }
	.tx-stat-l { font-size: 9px; letter-spacing: 0.08em; }
	.tx-stat-v { font-size: 13px; }
	.tx-stat-hero .tx-stat-v { font-size: 16px; }
	.tx-top-right { gap: 8px; }
	.tx-conn span { display: none; }
	/* the countdown sits centred in row 1 */
	.tx-clock { grid-column: 2; grid-row: 1; justify-self: center; font-size: 11px; padding: 4px 9px; }
	.tx-acct-toggle {
		display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
		border: 1px solid var(--rule); color: var(--text-2);
	}
	.tx-acct-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; transition: transform 0.2s var(--ease); }
	.tx-top.is-expanded .tx-acct-toggle svg { transform: rotate(180deg); }
	.tx-top.is-expanded .tx-acct { gap: 10px 12px; }
	.tx-top.is-expanded .tx-acct .tx-stat { display: flex; }

	/* ── Chart: tappable symbol + one-tap quick trade ─────────────────── */
	.tx-chart-head { padding: 10px 12px 8px; gap: 8px 12px; }
	.tx-sym { text-align: left; padding: 2px 0; }
	.tx-sym-name { font-size: 18px; display: inline-flex; align-items: center; gap: 4px; }
	.tx-chev { display: inline-block; }
	.tx-sym-price { font-size: 20px; }
	.tx-sym-px { margin-left: auto; flex-direction: column; align-items: flex-end; gap: 2px; }
	.tx-sym-spread { display: none; }
	.tx-tfs { margin-left: 0; width: 100%; justify-content: space-between; }
	.tx-tfs button { flex: 1; padding: 7px 0; }
	.tx-quick {
		display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
		padding: 10px 12px; border-top: 1px solid var(--rule); background: var(--ink-1);
	}
	.tx-quick-btn {
		display: flex; align-items: center; justify-content: space-between; gap: 8px;
		padding: 12px 14px; border-radius: var(--r-md); font-weight: 700; transition: transform 0.08s, filter 0.15s;
	}
	.tx-quick-btn:active { transform: scale(0.97); }
	.tx-quick-btn span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
	.tx-quick-btn b { font-size: 15px; font-weight: 600; }
	.tx-quick-sell { background: var(--sell-dim); color: var(--sell); border: 1px solid rgba(255, 84, 112, 0.4); }
	.tx-quick-buy { background: var(--buy-dim); color: var(--buy); border: 1px solid rgba(34, 201, 147, 0.4); flex-direction: row-reverse; }
	.tx-quick-spread { font-size: 10px; color: var(--text-3); }
	.tx-quick.is-closed .tx-quick-btn { opacity: 0.4; }

	/* ── Ticket: market header, chips, stops on demand, pinned submit ── */
	.tx-ticket { padding: 0 14px; gap: 14px; }
	.tx-ticket-head {
		display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 10px; text-align: left;
		padding: 12px 2px 10px; border-bottom: 1px solid var(--rule); margin: 0 -2px;
	}
	.tx-tk-sym { display: inline-flex; align-items: center; gap: 4px; font-size: 18px; }
	.tx-tk-name { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.tx-ticket-head .tx-sym-state { justify-self: end; }
	.tx-sides { grid-template-columns: 1fr 1fr; gap: 10px; }
	.tx-spread { display: none; }
	.tx-side { padding: 12px 6px; }
	.tx-side b { font-size: 20px; }
	.tx-seg button { padding: 9px 0; font-size: 13.5px; }
	.tx-stepper { grid-template-columns: 48px 1fr 48px; }
	.tx-stepper button, .tx-stepper input { min-height: 46px; }
	.tx-lot-chips { display: flex; gap: 6px; }
	.tx-stops { grid-template-columns: 1fr; gap: 10px; }
	.tx-stops .tx-field { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: var(--r-md); background: var(--ink-2); }
	.tx-stops .tx-field > span { font-size: 14px; color: var(--text); white-space: nowrap; }
	.tx-stops .tx-field input[type="number"] { width: 46%; text-align: right; background: var(--ink-1); }
	.tx-stops .tx-field input:disabled { display: none; }
	.tx-preview { padding: 12px 14px; }
	.tx-submit-wrap {
		position: sticky; bottom: 0; margin: auto -14px 0; padding: 10px 14px 14px;
		background: linear-gradient(180deg, rgba(11, 15, 26, 0), var(--ink-1) 26%);
	}
	.tx-submit { width: 100%; padding: 16px; font-size: 16px; border-radius: 12px; box-shadow: 0 10px 28px -12px rgba(34, 201, 147, 0.6); }
	.tx-submit[data-side="sell"] { box-shadow: 0 10px 28px -12px rgba(255, 84, 112, 0.6); }
	.tx-submit:disabled { box-shadow: none; }
	.tx-submit-wrap .tx-ticket-msg { text-align: center; margin-bottom: 8px; min-height: 0; }

	/* ── Watchlist ─────────────────────────────────────────────────────── */
	.tx-watch-head { padding: 10px 12px 6px; }
	.tx-watch-cols, .tx-watch-row { grid-template-columns: minmax(0, 1fr) 82px 82px; }
	.tx-watch-row { padding: 12px 14px; }
	.tx-w-sub { font-size: 11.5px; }

	/* ── Book: summary, inline tabs, cards ─────────────────────────────── */
	.tx-book-tabs { padding: 4px 8px 0; gap: 0; }
	.tx-book-tabs > button[data-book] { padding: 11px 10px; white-space: nowrap; }
	.tx-close-all { margin: 0 2px 6px auto; padding: 5px 9px; font-size: 11.5px; white-space: nowrap; }
	.tx-book-sum {
		display: flex; justify-content: space-between; align-items: baseline; padding: 12px 16px;
		border-bottom: 1px solid var(--rule); font-size: 12px; color: var(--text-2);
	}
	.tx-book-sum b { font-size: 17px; font-weight: 600; }
	.tx-table-wrap { display: none; }
	.tx-cards { display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 16px; }
	.tx-card { background: var(--ink-2); border-radius: var(--r-md); padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; }
	.tx-card-pnl { font-size: 17px; font-weight: 600; text-align: right; }
	.tx-card > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.tx-card-meta { grid-column: 1 / -1; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
	.tx-card .tx-row-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
	.tx-card .tx-row-actions button { padding: 9px 0; font-size: 13px; border-radius: 8px; }
	.tx-card .tx-row-actions button:only-child { grid-column: 1 / -1; }

	/* ── Tab bar ───────────────────────────────────────────────────────── */
	.tx-tabbar {
		display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0;
		height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
		background: rgba(11, 15, 26, 0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
		border-top: 1px solid var(--rule); z-index: 20;
	}
	.tx-tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--text-3); }
	.tx-tabbar button::before {
		content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px;
		background: var(--gold); opacity: 0; transition: opacity 0.2s;
	}
	.tx-tabbar button.is-on::before { opacity: 1; }
	.tx-tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
	.tx-tabbar button.is-on { color: var(--gold); }
	.tx-tab-ico { position: relative; display: inline-flex; }
	.tx-tab-badge {
		position: absolute; top: -5px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
		background: var(--gold); color: var(--ink-0); font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
	}
	.tx-tab-trade svg { background: var(--gold); color: var(--ink-0); border-radius: 50%; padding: 5px; width: 34px; height: 34px; stroke-width: 2.4; margin-top: -10px; box-shadow: 0 6px 18px -4px rgba(252, 180, 45, 0.55); }
	.tx-tabbar button.tx-tab-trade::before { display: none; }
	.tx-tabbar button.tx-tab-trade.is-on { color: var(--text); }
	.tx-toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
	.tx-toast { max-width: none; }
}

/* Very narrow phones (≤ 360px): tighten the money columns. */
@media (max-width: 360px) {
	.tx-acct { gap: 2px 12px; }
	.tx-stat-hero .tx-stat-v { font-size: 15px; }
	.tx-watch-cols, .tx-watch-row { grid-template-columns: minmax(0, 1fr) 74px 74px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
