/*
 * TransitSpecs — front end.
 * Everything is scoped under .tsx-app. Colours are tokens; dark mode redefines them.
 * The accent comes from Settings (inline --tsx-accent on .tsx-app).
 */

.tsx-app {
	--tsx-accent: #c8102e;
	--tsx-bg: #f2f4f7;
	--tsx-surface: #ffffff;
	--tsx-surface-2: #e8ecf1;
	--tsx-ink: #152033;
	--tsx-ink-2: #4b586b;
	--tsx-ink-3: #7a8699;
	--tsx-line: #d3dae3;
	--tsx-line-2: #bcc6d2;
	--tsx-done: #17804f;
	--tsx-done-soft: #ddf2e7;
	--tsx-select: #2350c8;
	--tsx-select-soft: #e3eafc;
	--tsx-accent-ink: var(--tsx-accent);
	--tsx-on-accent: #ffffff;
	--tsx-shadow: 0 1px 2px rgba(21, 32, 51, .06), 0 4px 14px rgba(21, 32, 51, .06);
	--tsx-g0: #e07b12; --tsx-g1: #1b8fb5; --tsx-g2: #8a4fd1; --tsx-g3: #2e9a4b;
	--tsx-g4: #d13f8a; --tsx-g5: #b59a10; --tsx-g6: #0f9e8f; --tsx-g7: #5d6fe0;
	--tsx-radius: 10px;
	--tsx-radius-s: 6px;
	--tsx-font-num: inherit;

	color: var(--tsx-ink);
	background: var(--tsx-bg);
	font-size: 16px;
	line-height: 1.5;
	padding: clamp(16px, 3vw, 40px) clamp(16px, 3.5vw, 48px) 64px;
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
	position: relative;
	color-scheme: light;
}

.tsx-app[data-theme="dark"] {
	--tsx-bg: #0f1520;
	--tsx-surface: #161e2b;
	--tsx-surface-2: #1e2938;
	--tsx-ink: #e7ecf3;
	--tsx-ink-2: #a6b2c3;
	--tsx-ink-3: #74829a;
	--tsx-line: #283446;
	--tsx-line-2: #36445a;
	--tsx-done: #45d08f;
	--tsx-done-soft: rgba(69, 208, 143, .13);
	--tsx-select: #7ea2ff;
	--tsx-select-soft: rgba(126, 162, 255, .14);
	--tsx-accent-ink: color-mix(in srgb, var(--tsx-accent) 62%, #ffffff);
	--tsx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
	--tsx-g0: #f59a3c; --tsx-g1: #4cc0e6; --tsx-g2: #b388f2; --tsx-g3: #5ccf78;
	--tsx-g4: #f272b5; --tsx-g5: #e3c63d; --tsx-g6: #3fd1c0; --tsx-g7: #8e9cff;
	color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
	.tsx-app[data-theme="auto"] {
		--tsx-bg: #0f1520;
		--tsx-surface: #161e2b;
		--tsx-surface-2: #1e2938;
		--tsx-ink: #e7ecf3;
		--tsx-ink-2: #a6b2c3;
		--tsx-ink-3: #74829a;
		--tsx-line: #283446;
		--tsx-line-2: #36445a;
		--tsx-done: #45d08f;
		--tsx-done-soft: rgba(69, 208, 143, .13);
		--tsx-select: #7ea2ff;
		--tsx-select-soft: rgba(126, 162, 255, .14);
		--tsx-accent-ink: color-mix(in srgb, var(--tsx-accent) 62%, #ffffff);
		--tsx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
		--tsx-g0: #f59a3c; --tsx-g1: #4cc0e6; --tsx-g2: #b388f2; --tsx-g3: #5ccf78;
		--tsx-g4: #f272b5; --tsx-g5: #e3c63d; --tsx-g6: #3fd1c0; --tsx-g7: #8e9cff;
		color-scheme: dark;
	}
}

body.transitspecs-standalone { margin: 0; background: #f2f4f7; }
.tsx-page { display: block; }
.tsx-app *, .tsx-app *::before, .tsx-app *::after { box-sizing: border-box; }
.tsx-app .tsx-root { max-width: 1240px; margin: 0 auto; }
.tsx-app.is-ready .tsx-ssr { display: none; }
.tsx-app .tsx-ssr { max-width: 1240px; margin: 0 auto; }

/* ---- Base resets that hold up against theme styles ---- */
.tsx-app :where(h1, h2, h3, p, ul, ol, figure) { margin: 0; padding: 0; }
.tsx-app :where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.tsx-app :where(a) { color: inherit; }
.tsx-app svg { display: block; }
.tsx-app .tsx-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tsx-app :focus-visible { outline: 2px solid var(--tsx-select); outline-offset: 2px; }
.tsx-app button, .tsx-app [role="button"] { cursor: pointer; }

/* ---- Buttons ---- */
.tsx-app .tsx-btn {
	display: inline-flex; align-items: center; gap: 7px;
	min-height: 38px; padding: 7px 14px; margin: 0;
	border: 1px solid var(--tsx-line-2); border-radius: var(--tsx-radius-s);
	background: var(--tsx-surface); color: var(--tsx-ink);
	font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none;
	box-shadow: none; white-space: nowrap;
	transition: background-color .15s, border-color .15s, color .15s;
}
.tsx-app .tsx-btn svg { width: 17px; height: 17px; flex: none; }
.tsx-app .tsx-btn:hover { border-color: var(--tsx-ink-3); background: var(--tsx-surface-2); }
.tsx-app .tsx-btn-primary { background: var(--tsx-accent); border-color: var(--tsx-accent); color: var(--tsx-on-accent); }
.tsx-app .tsx-btn-primary:hover { background: color-mix(in srgb, var(--tsx-accent) 86%, #000); border-color: transparent; color: var(--tsx-on-accent); }
.tsx-app .tsx-btn-ghost { background: transparent; }
.tsx-app .tsx-link {
	padding: 4px 2px; margin: 0; border: 0; background: none; box-shadow: none;
	color: var(--tsx-select); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.tsx-app .tsx-icon-btn {
	display: inline-grid; place-items: center; flex: none;
	width: 40px; height: 40px; padding: 0; margin: 0;
	border: 1px solid var(--tsx-line); border-radius: 50%;
	background: var(--tsx-surface); color: var(--tsx-ink-2); box-shadow: none;
}
.tsx-app .tsx-icon-btn svg { width: 19px; height: 19px; }
.tsx-app .tsx-icon-btn:hover { color: var(--tsx-ink); border-color: var(--tsx-line-2); }

/* ---- Catalog header ---- */
.tsx-app .tsx-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.tsx-app .tsx-title {
	font-size: clamp(1.75rem, 1.2rem + 2.1vw, 2.75rem); line-height: 1.08; font-weight: 750;
	letter-spacing: -.022em; color: var(--tsx-ink); max-width: 20ch;
}
.tsx-app .tsx-intro { margin-top: 12px; max-width: 62ch; color: var(--tsx-ink-2); font-size: 1.05rem; }
.tsx-app .tsx-facts { margin-top: 8px; color: var(--tsx-ink-3); font-size: .9rem; font-variant-numeric: tabular-nums; }

/* ---- Filters ---- */
.tsx-app .tsx-filters { display: grid; gap: 14px; margin-bottom: 18px; }
.tsx-app .tsx-search {
	position: relative; display: flex; align-items: center;
	max-width: 560px;
}
.tsx-app .tsx-search > svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--tsx-ink-3); pointer-events: none; }
.tsx-app .tsx-search input {
	width: 100%; height: 46px; margin: 0; padding: 0 44px 0 42px;
	border: 1px solid var(--tsx-line-2); border-radius: 999px;
	background: var(--tsx-surface); color: var(--tsx-ink); font-size: 15px; box-shadow: none;
	-webkit-appearance: none; appearance: none;
}
.tsx-app .tsx-search input::placeholder { color: var(--tsx-ink-3); }
.tsx-app .tsx-search input:focus { outline: 2px solid var(--tsx-select); outline-offset: 1px; border-color: transparent; }
.tsx-app .tsx-search kbd {
	position: absolute; right: 14px; padding: 1px 7px; border: 1px solid var(--tsx-line-2); border-radius: 4px;
	font: 600 12px/1.4 inherit; color: var(--tsx-ink-3); background: transparent;
}
.tsx-app .tsx-search input:focus + kbd, .tsx-app .tsx-search input:not(:placeholder-shown) + kbd { display: none; }

.tsx-app .tsx-pillsets { display: grid; gap: 8px; }
.tsx-app .tsx-pillset { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tsx-app .tsx-pillset-label { width: 78px; flex: none; font-size: 13px; font-weight: 600; color: var(--tsx-ink-3); }
.tsx-app .tsx-pill, .tsx-app .tsx-chip, .tsx-app .tsx-tab {
	display: inline-flex; align-items: center; gap: 7px;
	min-height: 34px; padding: 5px 12px; margin: 0;
	border: 1px solid var(--tsx-line); border-radius: 999px;
	background: var(--tsx-surface); color: var(--tsx-ink-2); box-shadow: none;
	font-size: 14px; font-weight: 550; line-height: 1.2; white-space: nowrap;
	transition: background-color .15s, border-color .15s, color .15s;
}
.tsx-app .tsx-pill:hover, .tsx-app .tsx-chip:hover, .tsx-app .tsx-tab:hover { border-color: var(--tsx-line-2); color: var(--tsx-ink); }
.tsx-app .tsx-pill.is-active, .tsx-app .tsx-tab.is-active {
	background: var(--tsx-ink); border-color: var(--tsx-ink); color: var(--tsx-bg);
}
.tsx-app .tsx-pill-n { font-size: 12px; font-weight: 600; opacity: .65; font-variant-numeric: tabular-nums; }
.tsx-app .tsx-sort { margin-left: auto; }
.tsx-app .tsx-sort select {
	height: 34px; margin: 0; padding: 0 30px 0 12px; border: 1px solid var(--tsx-line); border-radius: 999px;
	background: var(--tsx-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237a8699' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 11px center / 11px;
	color: var(--tsx-ink-2); font-size: 14px; -webkit-appearance: none; appearance: none; box-shadow: none;
}
.tsx-app .tsx-resultbar { display: flex; align-items: center; gap: 12px; min-height: 28px; margin-bottom: 8px; color: var(--tsx-ink-2); font-size: 14px; }
.tsx-app .tsx-resultbar:empty { min-height: 0; }

/* ---- Cards ---- */
.tsx-app .tsx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.tsx-app .tsx-card {
	display: flex; flex-direction: column; overflow: hidden;
	border: 1px solid var(--tsx-line); border-radius: var(--tsx-radius);
	background: var(--tsx-surface); color: var(--tsx-ink); text-decoration: none;
	transition: border-color .15s, transform .15s;
}
.tsx-app .tsx-card:hover { border-color: var(--tsx-ink-3); }
.tsx-app .tsx-card:focus-visible { outline-offset: 3px; }
.tsx-app .tsx-card-art {
	display: grid; place-items: center; height: 150px; padding: 14px 12px;
	background: var(--tsx-surface-2);
	border-bottom: 1px solid var(--tsx-line);
}
.tsx-app .tsx-card-art img { width: 100%; height: 100%; object-fit: contain; }
.tsx-app .tsx-card-art .tsx-panelmap { width: 100%; height: auto; max-height: 100%; }
.tsx-app .tsx-card-noart { font-size: 13px; color: var(--tsx-ink-3); }
.tsx-app .tsx-card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 14px 16px 16px; }
.tsx-app .tsx-card-title { font-size: 1.06rem; line-height: 1.3; font-weight: 700; letter-spacing: -.008em; color: var(--tsx-ink); }
.tsx-app .tsx-card-sub { margin-top: -4px; font-size: 14px; color: var(--tsx-ink-2); }
.tsx-app .tsx-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tsx-app .tsx-tag {
	display: inline-block; padding: 2px 8px; border-radius: 4px;
	background: var(--tsx-surface-2); color: var(--tsx-ink); font-size: 12.5px; font-weight: 600; line-height: 1.5;
}
.tsx-app .tsx-tag.is-quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--tsx-line); color: var(--tsx-ink-2); font-weight: 500; }
.tsx-app .tsx-progress { display: grid; gap: 6px; margin-top: auto; padding-top: 6px; }
.tsx-app .tsx-bar { display: block; height: 6px; border-radius: 3px; background: var(--tsx-surface-2); overflow: hidden; }
.tsx-app .tsx-bar > span { display: block; height: 100%; background: var(--tsx-done); border-radius: 3px; transition: width .4s; }
.tsx-app .tsx-progress-label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--tsx-ink-2); font-variant-numeric: tabular-nums; }
.tsx-app .tsx-progress-label svg { width: 15px; height: 15px; color: var(--tsx-done); }
.tsx-app .tsx-card.is-done .tsx-progress-label { color: var(--tsx-done); font-weight: 600; }
.tsx-app .tsx-card.is-flash { animation: tsx-flash 2.2s ease-out; }
@keyframes tsx-flash {
	0%, 30% { box-shadow: 0 0 0 3px var(--tsx-done); border-color: var(--tsx-done); }
	100% { box-shadow: 0 0 0 0 transparent; }
}

.tsx-app .tsx-empty {
	grid-column: 1 / -1; display: grid; justify-items: start; gap: 12px;
	padding: 28px; border: 1px dashed var(--tsx-line-2); border-radius: var(--tsx-radius); color: var(--tsx-ink-2);
}

/* ---- Panel map (the signature element) ---- */
.tsx-app .tsx-panelmap { width: 100%; height: auto; overflow: visible; }
.tsx-app .tsx-panelmap .tsx-pm rect:first-of-type {
	fill: var(--tsx-surface); stroke: var(--tsx-ink-3); stroke-width: 1;
	transition: fill .15s, stroke .15s;
}
.tsx-app .tsx-panelmap.is-mini .tsx-pm rect:first-of-type { fill: var(--tsx-surface); stroke: var(--tsx-line-2); stroke-width: .8; }
.tsx-app .tsx-panelmap .tsx-pm.is-done rect:first-of-type { fill: var(--tsx-done-soft); stroke: var(--tsx-done); }
.tsx-app .tsx-panelmap.is-mini .tsx-pm.is-done rect:first-of-type { fill: var(--tsx-done); stroke: var(--tsx-done); }
.tsx-app .tsx-panelmap .tsx-pm.is-selected rect:first-of-type { stroke: var(--tsx-select); stroke-width: 3; fill: var(--tsx-select-soft); }
.tsx-app .tsx-panelmap .tsx-pm.is-selected.is-done rect:first-of-type { fill: var(--tsx-done-soft); }
.tsx-app .tsx-panelmap [data-uid]:hover rect:first-of-type { stroke: var(--tsx-ink); }
.tsx-app .tsx-pm-code { font-size: 13px; font-weight: 700; fill: var(--tsx-ink); text-anchor: middle; pointer-events: none; }
.tsx-app .tsx-pm-size { font-size: 11.5px; fill: var(--tsx-ink-2); text-anchor: middle; pointer-events: none; font-variant-numeric: tabular-nums; }
.tsx-app .tsx-row-label { font-size: 13px; font-weight: 600; fill: var(--tsx-ink-2); }
.tsx-app .tsx-tick { stroke: var(--tsx-line-2); stroke-width: 1; }
.tsx-app .tsx-tick.is-major { stroke: var(--tsx-ink-3); }
.tsx-app .tsx-tick-label { font-size: 10.5px; fill: var(--tsx-ink-3); font-variant-numeric: tabular-nums; }
.tsx-app .g0 { fill: var(--tsx-g0); background: var(--tsx-g0); } .tsx-app .g1 { fill: var(--tsx-g1); background: var(--tsx-g1); }
.tsx-app .g2 { fill: var(--tsx-g2); background: var(--tsx-g2); } .tsx-app .g3 { fill: var(--tsx-g3); background: var(--tsx-g3); }
.tsx-app .g4 { fill: var(--tsx-g4); background: var(--tsx-g4); } .tsx-app .g5 { fill: var(--tsx-g5); background: var(--tsx-g5); }
.tsx-app .g6 { fill: var(--tsx-g6); background: var(--tsx-g6); } .tsx-app .g7 { fill: var(--tsx-g7); background: var(--tsx-g7); }

/* ---- Vehicle view ---- */
.tsx-app .tsx-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.tsx-app .tsx-backlink {
	display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 4px; margin-left: -4px;
	border-radius: var(--tsx-radius-s); color: var(--tsx-ink-2); font-size: 15px; font-weight: 600; text-decoration: none;
}
.tsx-app .tsx-backlink svg { width: 18px; height: 18px; }
.tsx-app .tsx-backlink:hover { color: var(--tsx-ink); background: var(--tsx-surface-2); }

.tsx-app .tsx-vhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; margin-bottom: 22px; }
.tsx-app .tsx-vhead-text { display: grid; gap: 10px; min-width: min(100%, 320px); flex: 1 1 420px; }
.tsx-app .tsx-vtitle { font-size: clamp(1.6rem, 1.15rem + 1.9vw, 2.5rem); line-height: 1.1; font-weight: 750; letter-spacing: -.02em; color: var(--tsx-ink); }
.tsx-app .tsx-vtitle:focus { outline: none; }
.tsx-app .tsx-vsub { color: var(--tsx-ink-2); }
.tsx-app .tsx-vprogress { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tsx-app .tsx-vprogress-text { display: grid; gap: 1px; font-variant-numeric: tabular-nums; }
.tsx-app .tsx-vprogress-text strong { font-size: 15px; color: var(--tsx-ink); }
.tsx-app .tsx-sync { font-size: 12.5px; color: var(--tsx-ink-3); }
.tsx-app .tsx-sync.is-error { color: var(--tsx-accent-ink); }
.tsx-app .tsx-ring { position: relative; width: 52px; height: 52px; flex: none; }
.tsx-app .tsx-ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.tsx-app .tsx-ring circle { fill: none; stroke-width: 5; }
.tsx-app .tsx-ring-bg { stroke: var(--tsx-surface-2); }
.tsx-app .tsx-ring-fg { stroke: var(--tsx-done); stroke-linecap: round; transition: stroke-dashoffset .5s; }
.tsx-app .tsx-ring > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tsx-app .tsx-ring.is-complete > span { color: var(--tsx-done); }
.tsx-app .tsx-ring > span svg { width: 22px; height: 22px; }

.tsx-app .tsx-mapwrap {
	position: relative; padding: 18px 20px 14px; margin-bottom: 14px;
	border: 1px solid var(--tsx-line); border-radius: var(--tsx-radius);
	background-color: var(--tsx-surface);
	background-image:
		linear-gradient(var(--tsx-line) 1px, transparent 1px),
		linear-gradient(90deg, var(--tsx-line) 1px, transparent 1px);
	background-size: 24px 24px;
	background-position: -1px -1px;
	background-blend-mode: normal;
}
.tsx-app .tsx-mapwrap::before {
	content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
	background: color-mix(in srgb, var(--tsx-surface) 82%, transparent);
}
.tsx-app .tsx-mapwrap > * { position: relative; }
.tsx-app .tsx-mapscroll { overflow-x: auto; }
.tsx-app .tsx-mapscroll .tsx-panelmap { min-width: 600px; }
.tsx-app .tsx-maphint { margin-top: 10px; font-size: 13px; color: var(--tsx-ink-3); }
.tsx-app .tsx-mapswitch { margin-bottom: 12px; }
.tsx-app .tsx-blueprint { display: block; }
.tsx-app .tsx-blueprint img { display: block; max-width: 100%; max-height: 520px; margin: 0 auto; border-radius: var(--tsx-radius-s); }

.tsx-app .tsx-info { margin-bottom: 18px; padding: 12px 16px; border: 1px solid var(--tsx-line); border-radius: var(--tsx-radius); background: var(--tsx-surface); }
.tsx-app .tsx-info summary { cursor: pointer; font-weight: 650; }
.tsx-app .tsx-info p { margin-top: 8px; max-width: 90ch; color: var(--tsx-ink-2); font-size: 15px; }
.tsx-app .tsx-info strong { color: var(--tsx-ink); margin-right: 4px; }
.tsx-app .tsx-content { margin-top: 10px; font-size: 15px; }

/* Segmented control */
.tsx-app .tsx-seg { display: inline-flex; padding: 3px; border: 1px solid var(--tsx-line); border-radius: 999px; background: var(--tsx-surface); }
.tsx-app .tsx-seg button {
	min-width: 44px; min-height: 30px; padding: 3px 12px; margin: 0; border: 0; border-radius: 999px;
	background: transparent; color: var(--tsx-ink-2); box-shadow: none; font-size: 14px; font-weight: 600;
}
.tsx-app .tsx-seg button[aria-pressed="true"] { background: var(--tsx-ink); color: var(--tsx-bg); }

.tsx-app .tsx-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 10px; }
.tsx-app .tsx-tabs, .tsx-app .tsx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tsx-app .tsx-tab { border-radius: var(--tsx-radius-s); }

.tsx-app .tsx-groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; }
.tsx-app .tsx-groups-label { margin-right: 4px; font-size: 13px; font-weight: 600; color: var(--tsx-ink-3); }
.tsx-app .tsx-chip { min-height: 30px; padding: 3px 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; border-radius: var(--tsx-radius-s); }
.tsx-app .tsx-chip.is-active { border-color: var(--tsx-select); background: var(--tsx-select-soft); color: var(--tsx-ink); }
.tsx-app .tsx-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.tsx-app .tsx-swatch.is-none { background: transparent; }

/* ---- Table ---- */
.tsx-app .tsx-tablewrap { border: 1px solid var(--tsx-line); border-radius: var(--tsx-radius); background: var(--tsx-surface); overflow: hidden; }
.tsx-app .tsx-table { width: 100%; margin: 0; border: 0; border-collapse: collapse; border-spacing: 0; font-size: 15px; background: transparent; }
.tsx-app .tsx-table th, .tsx-app .tsx-table td { padding: 11px 12px; border: 0; border-bottom: 1px solid var(--tsx-line); text-align: left; vertical-align: middle; background: transparent; color: inherit; }
.tsx-app .tsx-table thead th { padding-top: 10px; padding-bottom: 10px; font-size: 12.5px; font-weight: 650; color: var(--tsx-ink-3); background: var(--tsx-surface-2); }
.tsx-app .tsx-table tbody tr:last-child td { border-bottom: 0; }
.tsx-app .tsx-table tbody tr { cursor: pointer; transition: background-color .12s; }
.tsx-app .tsx-table tbody tr:hover td { background: color-mix(in srgb, var(--tsx-surface-2) 55%, transparent); }
.tsx-app .tsx-table tbody tr:focus-visible { outline: 2px solid var(--tsx-select); outline-offset: -2px; }
.tsx-app .tsx-table tbody tr.is-selected td { background: var(--tsx-select-soft); }
.tsx-app .tsx-table tbody tr.is-done .tsx-size, .tsx-app .tsx-table tbody tr.is-done .tsx-code strong { color: var(--tsx-ink-3); }
.tsx-app .tsx-table tbody tr.is-pulse td { animation: tsx-pulse .5s ease-out; }
@keyframes tsx-pulse { from { background: var(--tsx-done-soft); } }
.tsx-app .tsx-table input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--tsx-select); cursor: pointer; vertical-align: middle; }
.tsx-app .tsx-col-check { width: 44px; padding-right: 0 !important; }
.tsx-app .tsx-code { white-space: nowrap; }
.tsx-app .tsx-code .tsx-swatch { margin-right: 8px; vertical-align: 1px; }
.tsx-app .tsx-code strong { font-weight: 700; }
.tsx-app .tsx-col-pos { color: var(--tsx-ink-2); font-size: 14px; }
.tsx-app .tsx-note { display: block; margin-top: 2px; font-size: 12.5px; color: var(--tsx-accent-ink); }
.tsx-app .tsx-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tsx-app .tsx-size { font-size: 16px; font-weight: 700; color: var(--tsx-ink); }
.tsx-app .tsx-x { margin: 0 .3em; color: var(--tsx-ink-3); font-weight: 400; }
.tsx-app .tsx-sub { display: block; font-size: 12px; color: var(--tsx-ink-3); font-weight: 400; }
.tsx-app .tsx-col-bleed, .tsx-app .tsx-col-safe { color: var(--tsx-ink-2); font-size: 14px; }
.tsx-app .tsx-missing { color: var(--tsx-accent-ink); font-size: 13px; font-weight: 600; }
.tsx-app .tsx-muted { color: var(--tsx-ink-3); }
.tsx-app .tsx-file {
	display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px;
	border: 1px solid var(--tsx-line); border-radius: var(--tsx-radius-s);
	color: var(--tsx-ink); font-size: 12.5px; font-weight: 650; text-decoration: none;
}
.tsx-app .tsx-file svg { width: 15px; height: 15px; }
.tsx-app .tsx-file:hover { border-color: var(--tsx-ink-3); }
.tsx-app .tsx-col-status { width: 1%; white-space: nowrap; }
.tsx-app .tsx-status {
	display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 104px;
	min-height: 32px; padding: 4px 12px; margin: 0;
	border: 1px solid var(--tsx-line-2); border-radius: 999px;
	background: transparent; color: var(--tsx-ink-2); box-shadow: none;
	font-size: 13.5px; font-weight: 650;
}
.tsx-app .tsx-status:hover { border-color: var(--tsx-ink-3); color: var(--tsx-ink); }
.tsx-app .tsx-status svg { width: 15px; height: 15px; }
.tsx-app .tsx-status.is-done { background: var(--tsx-done-soft); border-color: transparent; color: var(--tsx-done); }

/* Export settings */
.tsx-app .tsx-exportopts { margin-top: 14px; font-size: 14px; color: var(--tsx-ink-2); }
.tsx-app .tsx-exportopts summary { cursor: pointer; font-weight: 650; color: var(--tsx-ink); }
.tsx-app .tsx-exportopts-body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 10px; padding: 14px 16px; border: 1px solid var(--tsx-line); border-radius: var(--tsx-radius); background: var(--tsx-surface); }
.tsx-app .tsx-exportopts label { display: inline-flex; align-items: center; gap: 8px; }
.tsx-app .tsx-exportopts select { height: 32px; margin: 0; padding: 0 8px; border: 1px solid var(--tsx-line-2); border-radius: var(--tsx-radius-s); background: var(--tsx-surface); }
.tsx-app .tsx-exportopts input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--tsx-select); }
.tsx-app .tsx-hint { flex-basis: 100%; font-size: 13px; color: var(--tsx-ink-3); max-width: 90ch; }

/* ---- Batch bar ---- */
.tsx-app .tsx-batch {
	position: sticky; bottom: 14px; z-index: 20;
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px;
	margin-top: 16px; padding: 10px 12px 10px 18px;
	border: 1px solid var(--tsx-line-2); border-radius: 14px;
	background: color-mix(in srgb, var(--tsx-surface) 94%, transparent);
	-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
	box-shadow: 0 10px 30px rgba(10, 18, 30, .18);
	animation: tsx-rise .2s ease-out;
}
.tsx-app .tsx-batch[hidden] { display: none; }
@keyframes tsx-rise { from { transform: translateY(8px); opacity: 0; } }
.tsx-app .tsx-batch-count { display: grid; font-variant-numeric: tabular-nums; }
.tsx-app .tsx-batch-count span { font-size: 12.5px; color: var(--tsx-ink-3); }
.tsx-app .tsx-batch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tsx-app .tsx-batch-sep { width: 1px; height: 24px; margin: 0 4px; background: var(--tsx-line-2); }

/* ---- Completion & toast ---- */
.tsx-app .tsx-done-overlay {
	position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center;
	background: color-mix(in srgb, var(--tsx-bg) 72%, transparent);
	-webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
	opacity: 0; transition: opacity .2s;
}
.tsx-app .tsx-done-overlay[hidden] { display: none; }
.tsx-app .tsx-done-overlay.is-on { opacity: 1; }
.tsx-app .tsx-done-card {
	display: grid; justify-items: center; gap: 6px; padding: 30px 40px; text-align: center;
	border-radius: 18px; background: var(--tsx-surface); box-shadow: var(--tsx-shadow), 0 20px 50px rgba(0,0,0,.2);
	transform: scale(.94); transition: transform .3s cubic-bezier(.2, .9, .3, 1.3);
}
.tsx-app .tsx-done-overlay.is-on .tsx-done-card { transform: scale(1); }
.tsx-app .tsx-done-card strong { font-size: 1.25rem; }
.tsx-app .tsx-done-card > span:last-child { color: var(--tsx-ink-2); font-size: 14px; }
.tsx-app .tsx-done-mark { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 6px; border-radius: 50%; background: var(--tsx-done); color: #fff; }
.tsx-app .tsx-done-mark svg { width: 34px; height: 34px; }
.tsx-app .tsx-done-mark svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tsx-draw .45s .15s ease-out forwards; }
@keyframes tsx-draw { to { stroke-dashoffset: 0; } }

.tsx-app .tsx-toast {
	position: fixed; left: 50%; bottom: 22px; z-index: 100001;
	display: flex; align-items: center; gap: 14px; max-width: min(92vw, 640px);
	padding: 11px 16px; border-radius: 10px;
	background: var(--tsx-ink); color: var(--tsx-bg); font-size: 14.5px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
	transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
	transition: transform .2s, opacity .2s;
}
.tsx-app:has(.tsx-batch:not([hidden])) .tsx-toast { bottom: 96px; }
@media (max-width: 680px) { .tsx-app:has(.tsx-batch:not([hidden])) .tsx-toast { bottom: 190px; } }
.tsx-app .tsx-toast.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.tsx-app .tsx-toast:empty { display: none; }
.tsx-app .tsx-toast .tsx-link { color: inherit; flex: none; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
	.tsx-app .tsx-col-safe, .tsx-app .tsx-col-file { display: none; }
}
@media (max-width: 680px) {
	.tsx-app { padding-left: 16px; padding-right: 16px; }
	.tsx-app .tsx-pillset { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
	.tsx-app .tsx-pillset::-webkit-scrollbar { display: none; }
	.tsx-app .tsx-pillset-label { width: auto; margin-right: 4px; }
	.tsx-app .tsx-sort { margin-left: 8px; }
	.tsx-app .tsx-mapwrap { padding: 14px 12px 10px; }

	/* Table becomes stacked rows */
	.tsx-app .tsx-table thead { display: none; }
	.tsx-app .tsx-table, .tsx-app .tsx-table tbody { display: block; }
	.tsx-app .tsx-table tbody tr {
		display: grid; grid-template-columns: 34px 1fr auto; grid-template-areas: "chk code status" "chk size status" "chk pos pos" "chk bleed bleed";
		gap: 2px 10px; padding: 12px; border-bottom: 1px solid var(--tsx-line);
	}
	.tsx-app .tsx-table tbody tr:last-child { border-bottom: 0; }
	.tsx-app .tsx-table tbody td { display: block; padding: 0; border: 0; text-align: left !important; }
	.tsx-app .tsx-table td.tsx-col-check { grid-area: chk; padding-top: 2px; }
	.tsx-app .tsx-table td.tsx-code { grid-area: code; }
	.tsx-app .tsx-table td.tsx-size { grid-area: size; font-size: 18px; }
	.tsx-app .tsx-table td.tsx-col-pos { grid-area: pos; }
	.tsx-app .tsx-table td.tsx-col-bleed { grid-area: bleed; }
	.tsx-app .tsx-table td.tsx-col-bleed .tsx-sub { display: inline; margin-left: 6px; }
	.tsx-app .tsx-table td.tsx-col-status { grid-area: status; align-self: center; width: auto; }
	.tsx-app .tsx-status { min-width: 0; }

	.tsx-app .tsx-batch { bottom: 8px; padding: 10px; }
	.tsx-app .tsx-batch-actions { width: 100%; }
	.tsx-app .tsx-batch-sep { display: none; }
	.tsx-app .tsx-vprogress { width: 100%; }
	.tsx-app .tsx-vprogress .tsx-btn { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
	.tsx-app *, .tsx-app *::before, .tsx-app *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
	.tsx-app .tsx-done-mark svg path { stroke-dashoffset: 0; }
}

@media print {
	.tsx-app { background: #fff; color: #000; padding: 0; }
	.tsx-app .tsx-batch, .tsx-app .tsx-toolbar, .tsx-app .tsx-groups, .tsx-app .tsx-icon-btn, .tsx-app .tsx-backlink, .tsx-app .tsx-exportopts, .tsx-app .tsx-col-check, .tsx-app .tsx-toast { display: none !important; }
	.tsx-app .tsx-mapwrap { background: none; }
}
