/* Shared UI for every tool: tokens (light/dark), layout, start form, progress, results list. */
:root {
	--bg: #f7f7f5;
	--surface: #ffffff;
	--sunken: #f0f0ed;
	--fg: #1a1a19;
	--muted: #6b6b66;
	--line: #e4e4df;
	--line-strong: #d0d0c9;
	--accent: #157f5b;
	--accent-fg: #ffffff;
	--accent-soft: #e3f2ec;
	--err: #c4321f;
	--err-soft: #fdecea;
	--warn: #9a5b00;
	--warn-soft: #fdf3e1;
	--ok: #157f5b;
	--ok-soft: #e3f2ec;
	--ring: color-mix(in srgb, var(--accent) 45%, transparent);
	--radius: 10px;
	--shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 2px 8px rgb(0 0 0 / 0.04);
	--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #121211;
		--surface: #1b1b1a;
		--sunken: #232321;
		--fg: #ecece8;
		--muted: #9a9a93;
		--line: #2c2c2a;
		--line-strong: #3a3a37;
		--accent: #3fbf8f;
		--accent-fg: #08140f;
		--accent-soft: #14302a;
		--err: #f07563;
		--err-soft: #3a1a15;
		--warn: #e8b04f;
		--warn-soft: #372a12;
		--ok: #3fbf8f;
		--ok-soft: #14302a;
		--shadow: none;
		color-scheme: dark;
	}
}

* {
	box-sizing: border-box;
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font:
		15px/1.55 system-ui,
		-apple-system,
		"Segoe UI",
		sans-serif;
	-webkit-font-smoothing: antialiased;
}
a {
	color: inherit;
	text-underline-offset: 2px;
}
code {
	font: 13px/1.4 var(--mono);
}
[hidden] {
	display: none !important;
}
:focus-visible {
	outline: 2px solid var(--ring);
	outline-offset: 2px;
	border-radius: 6px;
}
.wrap {
	max-width: 920px;
	margin: 0 auto;
	padding: 0 16px;
}
.muted {
	color: var(--muted);
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

header.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 0;
}
.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 650;
	text-decoration: none;
}
.brand svg {
	width: 26px;
	height: 26px;
}
.brand span {
	color: var(--muted);
	font-weight: 500;
}
.top nav {
	display: flex;
	gap: 16px;
	font-size: 14px;
}
.top nav a {
	color: var(--muted);
	text-decoration: none;
}
.top nav a:hover {
	color: var(--fg);
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font: inherit;
	font-weight: 550;
	font-size: 14px;
	padding: 8px 14px;
	border-radius: 8px;
	border: 1px solid var(--line-strong);
	background: var(--surface);
	color: var(--fg);
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}
.btn:hover {
	background: var(--sunken);
}
.btn.primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-fg);
}
.btn.primary:hover {
	filter: brightness(1.07);
}
.btn:disabled {
	opacity: 0.6;
	cursor: progress;
}
.btn svg {
	width: 16px;
	height: 16px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

/* Start */
.hero {
	padding: 56px 0 32px;
	text-align: center;
}
.hero h1 {
	font-size: clamp(28px, 5vw, 40px);
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0 0 12px;
}
.hero p {
	margin: 0 auto 28px;
	max-width: 560px;
	color: var(--muted);
	font-size: 16px;
}
.scan-form {
	display: flex;
	gap: 8px;
	max-width: 600px;
	margin: 0 auto;
	padding: 6px;
}
.scan-form .field {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 10px;
	min-width: 0;
}
.scan-form .field svg {
	width: 18px;
	height: 18px;
	color: var(--muted);
	flex: none;
}
.scan-form input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	color: var(--fg);
	font: inherit;
	font-size: 16px;
	padding: 10px 0;
	outline: none;
}
.scan-form .btn {
	padding: 10px 20px;
	font-size: 15px;
}
.scan-form:focus-within {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--ring);
}
.hero .form-error {
	color: var(--err);
	margin: 12px auto 0;
	max-width: 600px;
	font-size: 14px;
	min-height: 1.5em;
}
.signed {
	max-width: 600px;
	margin: 14px auto 0;
	text-align: left;
	font-size: 14px;
}
.signed summary {
	cursor: pointer;
	color: var(--muted);
	text-align: center;
}
.signed summary:hover {
	color: var(--fg);
}
.signed .signed-body {
	margin-top: 10px;
	padding: 14px 16px;
	display: grid;
	gap: 10px;
}
.signed p {
	margin: 0;
	color: var(--muted);
	font-size: 13.5px;
}
.signed label {
	display: grid;
	gap: 4px;
	font-size: 13px;
	font-weight: 550;
}
.signed input {
	font: 12.5px var(--mono);
	padding: 8px 10px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: var(--surface);
	color: var(--fg);
	min-width: 0;
}
.signed input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--ring);
}
.facts {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 20px;
	margin: 16px 0 0;
	padding: 0;
	list-style: none;
	color: var(--muted);
	font-size: 13.5px;
}
.facts li::before {
	content: "✓ ";
	color: var(--ok);
	font-weight: 700;
}
.recent {
	max-width: 600px;
	margin: 40px auto 0;
	text-align: left;
}
.recent h2 {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	margin: 0 0 8px;
	font-weight: 600;
}
.recent ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.recent a {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	text-decoration: none;
	border-bottom: 1px solid var(--line);
}
.recent li:last-child a {
	border-bottom: 0;
}
.recent a:hover {
	background: var(--sunken);
}

/* Scan header */
.scan-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 24px 0 16px;
}
.scan-head h1 {
	margin: 0;
	font-size: 24px;
	letter-spacing: -0.01em;
	word-break: break-all;
}
.scan-head h1 a {
	text-decoration: none;
}
.scan-head h1 a:hover {
	text-decoration: underline;
}
.scan-head .meta {
	color: var(--muted);
	font-size: 13.5px;
	margin-top: 2px;
}
.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Progress */
.progress {
	padding: 24px;
}
.steps {
	list-style: none;
	margin: 0 0 20px;
	padding: 0;
	display: grid;
	gap: 10px;
}
.steps li {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--muted);
}
.steps li .dot {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid var(--line-strong);
	flex: none;
	display: grid;
	place-items: center;
}
.steps li.done {
	color: var(--fg);
}
.steps li.done .dot {
	background: var(--ok);
	border-color: var(--ok);
}
.steps li.done .dot::after {
	content: "";
	width: 8px;
	height: 5px;
	border: 2px solid var(--accent-fg);
	border-top: 0;
	border-right: 0;
	transform: rotate(-45deg) translate(1px, -1px);
}
.steps li.active {
	color: var(--fg);
	font-weight: 550;
}
.steps li.active .dot {
	border-color: var(--accent);
	border-top-color: transparent;
	animation: spin 0.8s linear infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
.bar {
	height: 8px;
	border-radius: 99px;
	background: var(--sunken);
	overflow: hidden;
}
.bar > div {
	height: 100%;
	width: 0;
	background: var(--accent);
	border-radius: inherit;
	transition: width 0.6s ease;
}
.bar-label {
	display: flex;
	justify-content: space-between;
	font-size: 13.5px;
	color: var(--muted);
	margin-top: 8px;
}
.note {
	margin-top: 20px;
	padding: 12px 14px;
	background: var(--sunken);
	border-radius: 8px;
	font-size: 13.5px;
	color: var(--muted);
}

/* Failure */
.failure {
	padding: 24px;
	border-color: color-mix(in srgb, var(--err) 35%, var(--line));
}
.failure h2 {
	margin: 0 0 6px;
	font-size: 17px;
	color: var(--err);
}
.failure p {
	margin: 0 0 16px;
	color: var(--muted);
	word-break: break-word;
}

/* Summary */
.stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}
.stat {
	padding: 14px 16px;
}
.stat .label {
	font-size: 13px;
	color: var(--muted);
}
.stat .value {
	font-size: 26px;
	font-weight: 650;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}
.stat .sub {
	font-size: 12.5px;
	color: var(--muted);
}
.stat.err .value {
	color: var(--err);
}
.stat.warn .value {
	color: var(--warn);
}
.stat.ok .value {
	color: var(--ok);
}
.meter {
	display: flex;
	height: 6px;
	border-radius: 99px;
	overflow: hidden;
	background: var(--sunken);
	margin-top: 8px;
	gap: 2px;
}
.meter i {
	display: block;
}
.meter .m-ok {
	background: var(--ok);
}
.meter .m-warn {
	background: var(--warn);
}
.meter .m-err {
	background: var(--err);
}

/* Toolbar */
.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 12px;
}
.seg {
	display: inline-flex;
	padding: 3px;
	background: var(--sunken);
	border-radius: 9px;
	border: 1px solid var(--line);
}
.seg button {
	font: inherit;
	font-size: 13.5px;
	font-weight: 550;
	border: 0;
	background: transparent;
	color: var(--muted);
	padding: 5px 12px;
	border-radius: 6px;
	cursor: pointer;
}
.seg button[aria-pressed="true"] {
	background: var(--surface);
	color: var(--fg);
	box-shadow: var(--shadow);
}
.seg button .n {
	font-variant-numeric: tabular-nums;
	opacity: 0.7;
	margin-left: 4px;
}
.search {
	flex: 1;
	min-width: 180px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 10px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: var(--surface);
}
.search:focus-within {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--ring);
}
.search svg {
	width: 16px;
	height: 16px;
	color: var(--muted);
	flex: none;
}
.search input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	color: var(--fg);
	font: inherit;
	font-size: 14px;
	padding: 7px 0;
	outline: none;
}

/* Lists */
.list {
	overflow: hidden;
}
.item {
	border-bottom: 1px solid var(--line);
}
.item:last-child {
	border-bottom: 0;
}
.item > summary {
	list-style: none;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	cursor: pointer;
}
.item > summary::-webkit-details-marker {
	display: none;
}
.item > summary:hover {
	background: var(--sunken);
}
.item > summary .chev {
	width: 16px;
	height: 16px;
	color: var(--muted);
	transition: transform 0.15s;
}
.item[open] > summary .chev {
	transform: rotate(90deg);
}
.item .title {
	min-width: 0;
}
.item .title code,
.item .title .path {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.item .title .sample {
	display: block;
	font-size: 13px;
	color: var(--muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.count {
	font-size: 13px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.badge {
	font-size: 11.5px;
	font-weight: 650;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 2px 7px;
	border-radius: 5px;
	white-space: nowrap;
}
.badge.error {
	color: var(--err);
	background: var(--err-soft);
}
.badge.warn {
	color: var(--warn);
	background: var(--warn-soft);
}
.badge.fail {
	color: var(--muted);
	background: var(--sunken);
}
.badge.kind {
	color: var(--muted);
	background: var(--sunken);
	text-transform: none;
	font-weight: 550;
	letter-spacing: 0;
}
.detail {
	padding: 0 16px 14px 44px;
}
.detail table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
}
.detail td {
	padding: 7px 8px 7px 0;
	border-top: 1px solid var(--line);
	vertical-align: top;
}
.detail td.loc {
	font: 12.5px var(--mono);
	color: var(--muted);
	white-space: nowrap;
	width: 1%;
}
.detail td.sev {
	width: 1%;
}
.detail .doc {
	font-size: 13px;
	margin: 0 0 8px;
}
.detail a.ext {
	word-break: break-all;
}
.group-h {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	padding: 14px 16px 6px;
	font-weight: 600;
	border-bottom: 1px solid var(--line);
	background: var(--sunken);
}
.empty {
	padding: 40px 16px;
	text-align: center;
	color: var(--muted);
}
.empty strong {
	display: block;
	color: var(--fg);
	font-size: 16px;
	margin-bottom: 4px;
}

footer {
	padding: 48px 0 32px;
	color: var(--muted);
	font-size: 13px;
	text-align: center;
}

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 20px);
	opacity: 0;
	background: var(--fg);
	color: var(--bg);
	padding: 9px 14px;
	border-radius: 8px;
	font-size: 14px;
	transition: 0.2s;
	pointer-events: none;
}
.toast.show {
	opacity: 1;
	transform: translate(-50%, 0);
}

@media (max-width: 600px) {
	.hero {
		padding-top: 32px;
	}
	.scan-form {
		flex-direction: column;
	}
	.scan-form .field {
		padding: 4px 8px;
	}
	.item > summary {
		grid-template-columns: auto minmax(0, 1fr) auto;
	}
	.item > summary .count {
		grid-column: 2;
		grid-row: 2;
	}
	.detail {
		padding-left: 16px;
	}
	.detail td.loc {
		display: none;
	}
}
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}
