.pett {
	--pett-accent: var(--pe-accent, #C82F2D);
	--pett-accent-dark: var(--pe-accent-dark, #A32523);
	--pett-dark: var(--pe-dark, #21252B);
	--pett-text: var(--pe-text, #2E3238);
	--pett-muted: var(--pe-muted, #62666D);
	--pett-line: var(--pe-line, #E4E4E5);
	--pett-soft: var(--pe-soft, #F6F6F7);
	--pett-good: #1F7A4D;
	--pett-good-bg: #E6F4EC;
	--pett-fair: #8A5A00;
	--pett-fair-bg: #FFF3DC;
	--pett-poor: #8E2220;
	--pett-poor-bg: #FBE9E8;
	color: var(--pett-text);
	font-size: 16px;
	line-height: 1.5;
}
.pett *,
.pett *::before,
.pett *::after { box-sizing: border-box; }
.pett [hidden] { display: none !important; }
.pett-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Inputs */
.pett-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 16px;
	margin-bottom: 20px;
}
.pett-field label {
	display: block;
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 700;
	color: var(--pett-dark);
}
.pett .pett-brand,
.pett .pett-num,
.pett .pett-filter {
	width: 100%;
	min-height: 50px;
	padding: 12px 14px;
	border: 1px solid #CFD1D4;
	border-radius: 8px;
	background: #fff;
	color: var(--pett-dark);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.3;
}
.pett .pett-brand:focus,
.pett .pett-num:focus,
.pett .pett-filter:focus {
	outline: none;
	border-color: var(--pett-accent);
	box-shadow: 0 0 0 3px rgba(200, 47, 45, .15);
}

/* Source */
.pett-source {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px;
	margin-bottom: 20px;
	background: var(--pett-soft);
	border: 1px solid var(--pett-line);
	border-radius: 10px;
}
.pett-source-swatch {
	width: 64px;
	height: 64px;
	flex-shrink: 0;
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, .12);
}
.pett-source-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.pett-source-title {
	font-size: 18px;
	line-height: 1.3;
	color: var(--pett-dark);
}
.pett-source-codes {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 14px;
	color: var(--pett-muted);
	white-space: pre-wrap;
}

/* Target brand chips */
.pett-targets { margin-bottom: 16px; }
.pett-targets-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 14px;
	margin-bottom: 10px;
	font-size: 14px;
	font-weight: 700;
	color: var(--pett-dark);
}
.pett .pett-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--pett-accent);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.pett .pett-link:hover,
.pett .pett-link:focus { background: none; color: var(--pett-accent-dark); }
.pett-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-height: 132px;
	overflow-y: auto;
	padding: 2px;
}
.pett-chip {
	position: relative;
	display: inline-flex;
	margin: 0;
	cursor: pointer;
}
.pett-chip input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}
.pett-chip span {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--pett-line);
	border-radius: 999px;
	background: #fff;
	color: var(--pett-muted);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.pett-chip input:checked + span {
	background: var(--pett-dark);
	border-color: var(--pett-dark);
	color: #fff;
}
.pett-chip input:focus-visible + span {
	outline: 2px solid var(--pett-accent);
	outline-offset: 2px;
}

.pett .pett-status {
	margin: 0 0 16px;
	font-size: 14px;
	color: var(--pett-muted);
}

/* Results */
.pett-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 14px;
}
.pett-card {
	border: 1px solid var(--pett-line);
	border-radius: 10px;
	background: #fff;
	padding: 14px;
}
.pett .pett-card-title {
	margin: 0 0 8px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--pett-dark);
}
.pett-match {
	display: grid;
	grid-template-columns: 36px minmax(0, 1fr) auto;
	grid-template-areas:
		"sw meta copy"
		"sw score copy";
	align-items: center;
	gap: 2px 10px;
	padding: 8px 0;
}
.pett-match + .pett-match { border-top: 1px dashed var(--pett-line); }
.pett-match .pett-sw { grid-area: sw; }
.pett-match-meta {
	grid-area: meta;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 8px;
	min-width: 0;
	font-size: 14px;
	line-height: 1.35;
}
.pett-match-meta strong { color: var(--pett-dark); }
.pett-match-meta small { color: var(--pett-muted); font-size: 12px; }
.pett-match.is-best .pett-match-meta { font-size: 15px; }
.pett-match:not(.is-best) { opacity: .85; }
.pett-score {
	grid-area: score;
	justify-self: start;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
}
.pett-score.is-good { background: var(--pett-good-bg); color: var(--pett-good); }
.pett-score.is-fair { background: var(--pett-fair-bg); color: var(--pett-fair); }
.pett-score.is-poor { background: var(--pett-poor-bg); color: var(--pett-poor); }
.pett .pett-copy {
	grid-area: copy;
	padding: 6px 10px;
	border: 1px solid var(--pett-line);
	border-radius: 6px;
	background: #fff;
	color: var(--pett-dark);
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}
.pett .pett-copy:hover,
.pett .pett-copy:focus {
	background: #fff;
	border-color: var(--pett-accent);
	color: var(--pett-accent);
}

.pett-sw {
	display: inline-block;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, .12);
	vertical-align: middle;
}

/* Footer */
.pett-foot {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--pett-line);
}
.pett-foot p {
	margin: 0 0 12px;
	font-size: 15px;
}
.pett-foot a:not(.pett-cta) {
	color: var(--pett-accent);
	font-weight: 600;
}
.pett a.pett-cta {
	display: inline-block;
	margin: 4px 0 16px;
	padding: 12px 22px;
	border-radius: 6px;
	background: var(--pett-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	text-decoration: none;
}
.pett a.pett-cta:hover,
.pett a.pett-cta:focus { background: var(--pett-accent-dark); color: #fff; }
.pett .pett-note {
	margin: 0;
	font-size: 13px;
	line-height: 1.55;
	color: var(--pett-muted);
}

/* Chart */
.pett-chart-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin-bottom: 14px;
}
.pett-chart-bar .pett-filter {
	flex: 1 1 280px;
	width: auto;
}
.pett-count {
	font-size: 14px;
	font-weight: 600;
	color: var(--pett-muted);
}
.pett-table-wrap {
	overflow-x: auto;
	max-height: 720px;
	overflow-y: auto;
	border: 1px solid var(--pett-line);
	border-radius: 10px;
	margin-bottom: 12px;
}
.pett .pett-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 15px;
}
.pett .pett-table th,
.pett .pett-table td {
	padding: 8px 12px;
	border: 0;
	border-bottom: 1px solid var(--pett-line);
	text-align: left;
	vertical-align: middle;
	white-space: nowrap;
}
.pett .pett-table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--pett-soft);
	color: var(--pett-dark);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .04em;
}
.pett .pett-table td:nth-child(3) { white-space: normal; min-width: 140px; }
.pett .pett-table a {
	color: var(--pett-accent);
	font-weight: 600;
}

@media (max-width: 767px) {
	.pett-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
	.pett-results { grid-template-columns: minmax(0, 1fr); }
	.pett-source-swatch { width: 52px; height: 52px; }
	.pett-chips { max-height: 96px; }
}

/* Hex color match */
.pett-match-tool .pett-field { margin-bottom: 20px; }
.pett-hexrow {
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 420px;
}
.pett .pett-picker {
	width: 56px;
	height: 50px;
	flex-shrink: 0;
	padding: 4px;
	border: 1px solid #CFD1D4;
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}
.pett .pett-hex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Brand overview tables */
.pett-inline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.pett-sw--sm {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	border-radius: 5px;
}
.pett-data-wrap {
	overflow-x: auto;
	margin: 0 0 22px;
}
.pett-data-wrap .pett-data { margin: 0; }
.pett-data td,
.pett-data th { vertical-align: middle; }

/* Chart index */
.pett-index {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 12px;
}
.pett a.pett-index__item {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 16px 18px;
	border: 1px solid var(--pett-line);
	border-radius: 10px;
	background: #fff;
	color: var(--pett-dark);
	text-decoration: none;
	transition: border-color .15s ease, transform .15s ease;
}
.pett a.pett-index__item:hover {
	border-color: var(--pett-accent);
	transform: translateY(-2px);
}
.pett-index__name {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}
.pett-index__count {
	font-size: 13px;
	color: var(--pett-muted);
}
