body:has(.th-scanner-app),
body:has(.th-scanner-login) {
	background: #0b1020;
}

.th-scanner-app,
.th-scanner-login {
	--ink: #0b1020;
	--navy: #111a33;
	--dark-card: #17213f;
	--muted: #aeb8cc;
	--line: #2b3659;
	--brand: #2f6bff;
	--brand-hover: #5a8bff;
	--brand-dark: #0b1020;
	--cyan: #36d6d0;
	--success: #20c77a;
	--warning: #ffc857;
	--danger: #f04e69;
	color: #fff;
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.th-scanner-app {
	background:
		radial-gradient(circle at 90% 3%, rgba(54,214,208,.12), transparent 24%),
		linear-gradient(180deg, #0b1020 0%, #111a33 100%);
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	min-height: 100vh;
	padding-bottom: 50px;
}

.th-scanner-header {
	align-items: center;
	background: var(--brand-dark);
	color: #fff;
	display: flex;
	gap: 20px;
	justify-content: space-between;
	padding: 14px max(20px, calc((100vw - 1180px) / 2));
	border-bottom: 1px solid var(--line);
}

.th-scanner-logo {
	align-items: center;
	display: flex;
	gap: 10px;
}

.th-scanner-logo > span {
	align-items: center;
	background: var(--brand);
	border-radius: 10px;
	color: #fff;
	display: inline-flex;
	font-weight: 900;
	height: 36px;
	justify-content: center;
	letter-spacing: -.08em;
	width: 36px;
}

.th-scanner-user {
	align-items: center;
	display: flex;
	font-size: .82rem;
	gap: 12px;
}

.th-scanner-user a {
	color: #fff;
	text-decoration: none;
}

.th-online-state {
	background: rgba(32, 199, 122, .16);
	border-radius: 999px;
	color: #72e2ad;
	font-size: .72rem;
	font-weight: 800;
	padding: 5px 9px;
}

.th-online-state.is-offline {
	background: rgba(255, 200, 87, .14);
	color: var(--warning);
}

.th-scanner-toolbar {
	align-items: end;
	display: flex;
	gap: 16px;
	justify-content: space-between;
	margin: 0 auto;
	max-width: 1180px;
	padding: 24px 20px 14px;
}

.th-scanner-toolbar label {
	display: grid;
	gap: 6px;
	max-width: 600px;
	width: 100%;
}

.th-scanner-toolbar label > span {
	color: var(--muted);
	font-size: .72rem;
	font-weight: 800;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.th-scanner-toolbar select,
.th-manual-scan input {
	background: #fff;
	border: 1px solid #dde3ee;
	border-radius: 10px;
	color: var(--ink);
	font-size: 16px;
	min-height: 48px;
	padding: 0 13px;
	width: 100%;
}

.th-install-button,
.th-camera-button,
.th-manual-scan button {
	background: var(--brand);
	border: 0;
	border-radius: 10px;
	color: #fff;
	cursor: pointer;
	font-weight: 800;
	min-height: 48px;
	padding: 0 18px;
	white-space: nowrap;
}

.th-install-button:hover,
.th-camera-button:hover,
.th-manual-scan button:hover {
	background: var(--brand-hover);
}

.th-scanner-stats {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(3, 1fr);
	margin: 0 auto;
	max-width: 1180px;
	padding: 0 20px 18px;
}

.th-scanner-stats > div {
	background: var(--dark-card);
	border: 1px solid var(--line);
	border-radius: 14px;
	border-left: 4px solid var(--cyan);
	display: grid;
	gap: 4px;
	padding: 14px 16px;
}

.th-scanner-stats span {
	color: var(--muted);
	font-size: .75rem;
	font-weight: 700;
}

.th-scanner-stats strong {
	font-size: 1.55rem;
}

.th-scanner-main {
	display: grid;
	gap: 22px;
	grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
	margin: 0 auto;
	max-width: 1180px;
	padding: 0 20px;
}

.th-camera-card,
.th-scan-result,
.th-recent-scans {
	background: var(--dark-card);
	border: 1px solid var(--line);
	border-radius: 14px;
	box-shadow: 0 8px 30px rgba(0,0,0,.18);
	padding: 18px;
}

.th-camera-frame {
	aspect-ratio: 4 / 3;
	background: #080c18;
	border: 1px solid #273252;
	border-radius: 14px;
	overflow: hidden;
	position: relative;
}

.th-camera-frame video {
	height: 100%;
	object-fit: cover;
	width: 100%;
}

.th-camera-placeholder {
	align-items: center;
	color: #fff;
	display: flex;
	flex-direction: column;
	inset: 0;
	justify-content: center;
	padding: 30px;
	position: absolute;
	text-align: center;
}

.th-camera-placeholder[hidden] {
	display: none;
}

.th-camera-placeholder small {
	color: #aeb4c0;
	margin-top: 6px;
}

.th-camera-icon {
	border: 2px solid var(--cyan);
	border-radius: 16px;
	color: var(--cyan);
	font-size: 40px;
	line-height: 1;
	margin-bottom: 16px;
	padding: 12px 16px;
}

.th-scan-guide {
	border: 3px solid var(--cyan);
	border-radius: 14px;
	box-shadow: 0 0 0 999px rgba(0,0,0,.28), 0 0 28px rgba(54,214,208,.25);
	height: min(62%, 300px);
	left: 50%;
	pointer-events: none;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(62%, 300px);
	z-index: 2;
}

.th-camera-frame:has(.th-camera-placeholder:not([hidden])) .th-scan-guide {
	opacity: 0;
}

.th-camera-button {
	margin-top: 12px;
	width: 100%;
}

.th-manual-scan {
	border-top: 1px solid var(--line);
	margin-top: 18px;
	padding-top: 18px;
}

.th-manual-scan > label {
	display: block;
	font-size: .8rem;
	font-weight: 800;
	margin-bottom: 7px;
}

.th-manual-scan > div {
	display: flex;
	gap: 8px;
}

.th-manual-scan input {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.th-scan-side {
	display: grid;
	gap: 18px;
}

.th-scan-result {
	text-align: center;
	transition: background .15s ease, border-color .15s ease;
}

.th-result-icon {
	align-items: center;
	background: #243052;
	border-radius: 50%;
	display: flex;
	font-size: 28px;
	font-weight: 900;
	height: 62px;
	justify-content: center;
	margin: 8px auto 14px;
	width: 62px;
}

.th-scan-result.is-success {
	background: var(--success);
	border-color: var(--success);
	color: #fff;
}

.th-scan-result.is-success .th-result-icon {
	background: #fff;
	color: var(--success);
}

.th-scan-result.is-duplicate {
	background: var(--warning);
	border-color: var(--warning);
	color: var(--ink);
}

.th-scan-result.is-duplicate .th-result-icon {
	background: var(--ink);
	color: var(--warning);
}

.th-scan-result.is-error,
.th-scan-result.is-network {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
}

.th-scan-result.is-error .th-result-icon,
.th-scan-result.is-network .th-result-icon {
	background: #fff;
	color: var(--danger);
}

.th-result-kicker {
	color: var(--muted);
	font-size: .7rem;
	font-weight: 900;
	letter-spacing: .1em;
	margin: 0 0 5px;
	text-transform: uppercase;
}

.th-scan-result h2 {
	font-size: 1.6rem;
	margin: 0 0 5px;
}

.th-scan-result > p:not(.th-result-kicker) {
	color: var(--muted);
	margin: 0;
}

.th-scan-result.is-success .th-result-kicker,
.th-scan-result.is-success > p:not(.th-result-kicker),
.th-scan-result.is-success .th-result-details span,
.th-scan-result.is-error .th-result-kicker,
.th-scan-result.is-error > p:not(.th-result-kicker),
.th-scan-result.is-error .th-result-details span,
.th-scan-result.is-network .th-result-kicker,
.th-scan-result.is-network > p:not(.th-result-kicker),
.th-scan-result.is-network .th-result-details span {
	color: rgba(255,255,255,.82);
}

.th-scan-result.is-duplicate .th-result-kicker,
.th-scan-result.is-duplicate > p:not(.th-result-kicker),
.th-scan-result.is-duplicate .th-result-details span {
	color: rgba(11,16,32,.7);
}

.th-result-details {
	border-top: 1px solid rgba(255,255,255,.28);
	display: grid;
	gap: 8px;
	margin-top: 18px;
	padding-top: 16px;
	text-align: left;
}

.th-scan-result.is-duplicate .th-result-details {
	border-top-color: rgba(11,16,32,.18);
}

.th-result-details[hidden] {
	display: none;
}

.th-result-details > div {
	display: grid;
	gap: 2px;
	grid-template-columns: 90px 1fr;
}

.th-result-details span {
	color: var(--muted);
	font-size: .75rem;
}

.th-result-details strong {
	font-size: .82rem;
}

.th-recent-scans h2 {
	font-size: 1rem;
	margin: 0 0 13px;
}

.th-recent-scans ul {
	display: grid;
	gap: 9px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.th-recent-scans li {
	align-items: center;
	border-bottom: 1px solid var(--line);
	display: flex;
	gap: 10px;
	padding: 0 0 9px;
}

.th-recent-scans li > span {
	align-items: center;
	background: rgba(32,199,122,.15);
	border-radius: 50%;
	color: var(--success);
	display: flex;
	font-size: .75rem;
	font-weight: 900;
	height: 28px;
	justify-content: center;
	width: 28px;
}

.th-recent-scans li.is-warning > span {
	background: rgba(255,200,87,.15);
	color: var(--warning);
}

.th-recent-scans li div {
	display: grid;
}

.th-recent-scans li small,
.th-recent-scans li.is-empty {
	color: var(--muted);
	font-size: .75rem;
}

.th-scanner-login {
	background: var(--dark-card);
	border: 1px solid var(--line);
	border-radius: 14px;
	box-shadow: 0 25px 70px rgba(0,0,0,.3);
	margin: 9vh auto;
	max-width: 470px;
	padding: 34px;
}

.th-scanner-login h1 {
	font-size: 2rem;
	letter-spacing: -.04em;
	margin: 24px 0 8px;
}

.th-scanner-login > p {
	color: var(--muted);
}

.th-scanner-login label {
	font-size: .82rem;
	font-weight: 700;
}

.th-scanner-login input[type="text"],
.th-scanner-login input[type="password"] {
	background: #fff;
	border: 1px solid #dde3ee;
	border-radius: 9px;
	color: var(--ink);
	font-size: 16px;
	min-height: 48px;
	width: 100%;
}

.th-scanner-login .button-primary {
	background: var(--brand);
	border: 0;
	border-radius: 9px;
	font-weight: 800;
	min-height: 46px;
	padding: 0 20px;
}

@media (max-width: 800px) {
	.th-scanner-main {
		grid-template-columns: 1fr;
	}

	.th-scanner-user > span:not(.th-online-state) {
		display: none;
	}
}

@media (max-width: 520px) {
	.th-scanner-toolbar {
		align-items: stretch;
		flex-direction: column;
	}

	.th-scanner-stats {
		gap: 7px;
	}

	.th-scanner-stats > div {
		padding: 11px;
	}

	.th-scanner-stats span {
		font-size: .65rem;
	}

	.th-scanner-stats strong {
		font-size: 1.25rem;
	}

	.th-manual-scan > div {
		flex-direction: column;
	}
}
