:root {
	--bg-body: #1a1a2e;
	--bg-section: #16213e;
	--bg-card: #0f0f23;
	--bg-hover: #1a1a3e;
	--text-primary: #eee;
	--text-heading: #fff;
	--text-store-name: #fff;
	--text-ebay-link: #fff;
	--text-muted: #aaa;
	--text-label: #888;
	--text-dim: #666;
	--text-detail: #ccc;
	--accent-teal: #4ecdc4;
	--accent-green: #5deb63;
	--accent-orange: #e76f51;
	--accent-price: #4ade80;
	--accent-profit: #2a9d8f;
	--accent-profit-pos: #81c784;
	--accent-profit-neg: #ef5350;
	--border-color: #333;
	--border-muted: #444;
	--border-subtle: rgba(255, 255, 255, 0.05);
	--shadow-section: rgba(0, 0, 0, 0.3);
	--shadow-map: rgba(0, 0, 0, 0.5);
	--modal-backdrop: rgba(0, 0, 0, 0.9);
	--badge-bg: #0f3460;
	--badge-text: #64b5f6;
	--badge-sold-bg: #1b5e20;
	--badge-sold-text: #81c784;
	--ebay-btn: #0064d2;
	--ebay-btn-hover: #004ba0;
	--profit-card-gradient-start: #1a1a3e;
	--profit-card-gradient-end: #0f0f23;
	--profit-border: #1a1a2e;
	--avatar-border: #1a1a2e;
	--scrollbar-thumb: #333;
	--scrollbar-track: transparent;
	--chart-grid: rgba(255, 255, 255, 0.1);
	--chart-tick: #888;
}

[data-theme="light"] {
	--bg-body: #f0f2f5;
	--bg-section: #ffffff;
	--bg-card: #f5f6f8;
	--bg-hover: #e8eaed;
	--text-primary: #333;
	--text-heading: #111;
	--text-store-name: #fff;
	--text-ebay-link: #fff;
	--text-muted: #666;
	--text-label: #888;
	--text-dim: #999;
	--text-detail: #555;
	--accent-teal: #0d9488;
	--accent-green: #16a34a;
	--accent-orange: #c44125;
	--accent-price: #16a34a;
	--accent-profit: #0d9488;
	--accent-profit-pos: #16a34a;
	--accent-profit-neg: #dc2626;
	--border-color: #d1d5db;
	--border-muted: #ccc;
	--border-subtle: rgba(0, 0, 0, 0.06);
	--shadow-section: rgba(0, 0, 0, 0.08);
	--shadow-map: rgba(0, 0, 0, 0.12);
	--modal-backdrop: rgba(0, 0, 0, 0.5);
	--badge-bg: #dbeafe;
	--badge-text: #1d4ed8;
	--badge-sold-bg: #dcfce7;
	--badge-sold-text: #166534;
	--ebay-btn: #0064d2;
	--ebay-btn-hover: #004ba0;
	--profit-card-gradient-start: #f0f4ff;
	--profit-card-gradient-end: #f5f6f8;
	--profit-border: #e5e7eb;
	--avatar-border: #ffffff;
	--scrollbar-thumb: #ccc;
	--scrollbar-track: transparent;
	--chart-grid: rgba(0, 0, 0, 0.1);
	--chart-tick: #666;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	background: var(--bg-body);
	color: var(--text-primary);
	min-height: 100vh;
}

.store-header {
	margin-bottom: 30px;
}

.banner-container {
	width: 100%;
	max-height: 300px;
	overflow: hidden;
	border-radius: 0 0 12px 12px;
}

.store-banner {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
	max-height: 300px;
}

.store-info {
	max-width: 1400px;
	margin: -20px auto 0;
	padding: 0 20px;
	display: flex;
	align-items: flex-start;
	gap: 20px;
}

.store-avatar {
	width: 100px;
	height: 100px;
	border-radius: 12px;
	border: 4px solid var(--avatar-border);
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
	image-rendering: pixelated;
}

.store-text {
	padding-bottom: 10px;
}

.store-name {
	font-size: 2rem;
	margin: 0;
	text-shadow:
		0 0 5px #000,
		0 0 10px #000,
		0 0 15px #000;
}

.store-name a {
	color: var(--text-store-name);
	text-decoration: none;
	transition: color 0.2s ease;
}

.store-name a:hover {
	color: var(--accent-teal);
}

.store-tagline {
	color: var(--text-muted);
	font-size: 1rem;
	margin-top: 5px;
}

.container {
	max-width: 95%;
	margin: 0 auto;
	padding: 20px;
}

section {
	margin-bottom: 40px;
}

section h2 {
	font-size: 1.8rem;
	margin-bottom: 10px;
	color: var(--text-heading);
	text-align: center;
}

.stats,
.items-stats {
	font-size: 1.1rem;
	color: var(--text-muted);
	text-align: center;
	margin-bottom: 20px;
}

.stats span,
.items-stats span {
	color: var(--accent-teal);
	font-weight: bold;
}

.items-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.listings-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.listings-stats {
	font-size: 1.1rem;
	color: var(--text-muted);
	text-align: center;
	margin-bottom: 20px;
}

.listings-stats span {
	color: var(--accent-green);
	font-weight: bold;
}

.sort-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 15px;
	flex-wrap: wrap;
}

.sort-controls span {
	color: var(--text-muted);
	font-size: 0.9rem;
}

.sort-btn {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 6px 12px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.85rem;
	transition: all 0.2s ease;
}

.sort-btn:hover {
	border-color: var(--accent-teal);
	color: var(--accent-teal);
}

.sort-btn.active {
	background: var(--accent-teal);
	color: var(--bg-card);
	border-color: var(--accent-teal);
	font-weight: bold;
}

.sort-dir-btn {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--accent-teal);
	padding: 6px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	transition: all 0.2s ease;
}

.sort-dir-btn:hover {
	border-color: var(--accent-teal);
	background: var(--bg-hover);
}

.display-toggle {
	display: flex;
	gap: 4px;
	margin-left: auto;
}

.fullscreen-toggle {
	display: flex;
	gap: 4px;
	margin-left: 12px;
}

.fullscreen-btn {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 6px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	transition: all 0.2s ease;
}

.fullscreen-btn:hover {
	border-color: var(--accent-teal);
	color: var(--accent-teal);
}

.fullscreen-btn.active {
	background: var(--accent-teal);
	color: var(--bg-card);
	border-color: var(--accent-teal);
}

.section-fullscreen .listings-list,
.section-fullscreen .items-list,
.section-fullscreen .costs-list {
	max-height: 80vh;
}

.section-fullscreen .listings-list.gallery-mode,
.section-fullscreen .items-list.gallery-mode {
	max-height: 80vh;
}

.section-fullscreen #map {
	height: 80vh;
}

.map-controls {
	display: flex;
	align-items: center;
	margin-bottom: 10px;
}

.display-btn {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 6px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	transition: all 0.2s ease;
}

.display-btn:hover {
	border-color: var(--accent-teal);
	color: var(--accent-teal);
}

.display-btn.active {
	background: var(--accent-teal);
	color: var(--bg-card);
	border-color: var(--accent-teal);
}

.listings-list {
	max-height: 400px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.listings-list.gallery-mode {
	flex-direction: row;
	flex-wrap: wrap;
	max-height: 600px;
}

.listings-list.gallery-mode .listing-row {
	flex-direction: column;
	width: calc(25% - 6px);
	padding: 10px;
	align-items: stretch;
}

@media (min-width: 1920px) {
	.listings-list.gallery-mode .listing-row {
		width: calc(20% - 7px);
	}
}

.listings-list.gallery-mode .item-thumb,
.listings-list.gallery-mode .listing-thumb {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	margin: 0 0 10px 0;
	border-radius: 8px;
}

.listings-list.gallery-mode .item-thumb-placeholder,
.listings-list.gallery-mode .listing-thumb-placeholder {
	display: none;
}

.listings-list.gallery-mode .listing-info {
	text-align: center;
	align-content: center;
}

.listings-list.gallery-mode .listing-title {
	white-space: normal;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.9rem;
}

.listings-list.gallery-mode .listing-details {
	justify-content: center;
	margin-top: 8px;
}

.listings-list.gallery-mode .listing-price {
	margin: 10px 0 0 0;
	text-align: center;
	font-size: 1rem;
}

.listing-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 15px;
	background: var(--bg-card);
	border-radius: 8px;
	transition: background 0.2s ease;
	text-decoration: none;
	color: inherit;
}

.listing-row:hover {
	background: var(--bg-hover);
}

.listing-info {
	flex: 1;
	min-width: 0;
}

.listing-title {
	color: var(--accent-green);
	font-weight: 500;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
}

.listing-title:hover {
	text-decoration: underline;
}

.listing-details {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-top: 3px;
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.listing-condition {
	color: var(--text-muted);
}

.listing-category {
	color: var(--text-muted);
}

.listing-watchers {
	color: var(--accent-green);
}

.listing-views {
	color: var(--accent-blue);
}

.listing-impressions {
	color: var(--text-muted);
}

.listing-price {
	color: var(--accent-green);
	font-weight: bold;
	font-size: 1.1rem;
	margin-left: 15px;
	white-space: nowrap;
}

.items-list {
	max-height: 400px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.items-list.gallery-mode {
	flex-direction: row;
	flex-wrap: wrap;
	max-height: 600px;
}

.items-list.gallery-mode .item-row {
	flex-direction: column;
	width: calc(25% - 6px);
	padding: 10px;
	align-items: stretch;
}

@media (min-width: 1920px) {
	.items-list.gallery-mode .item-row {
		width: calc(20% - 7px);
	}
}

.items-list.gallery-mode .item-thumb {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	margin: 0 0 10px 0;
	border-radius: 8px;
}

.items-list.gallery-mode .item-thumb-placeholder {
	display: none;
}

.items-list.gallery-mode .item-info {
	text-align: center;
	align-content: center;
}

.items-list.gallery-mode .item-title {
	white-space: normal;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 0.9rem;
}

.items-list.gallery-mode .item-details {
	justify-content: center;
	margin-top: 8px;
}

.items-list.gallery-mode .item-price {
	margin: 10px 0 0 0;
	text-align: center;
	font-size: 1rem;
}

.item-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 15px;
	background: var(--bg-card);
	border-radius: 8px;
	transition: background 0.2s ease;
	text-decoration: none;
	color: inherit;
}

.item-row:hover {
	background: var(--bg-hover);
}

.item-info {
	flex: 1;
	min-width: 0;
}

.item-title {
	color: var(--accent-teal);
	font-weight: 500;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
}

.item-title:hover {
	text-decoration: underline;
}

.item-details {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-top: 3px;
	display: flex;
	gap: 12px;
	align-items: center;
}

.item-date {
	color: var(--text-muted);
}

.item-price {
	color: var(--accent-teal);
	font-weight: bold;
	font-size: 1.1rem;
	margin-left: 15px;
	white-space: nowrap;
}

.item-profit {
	color: var(--accent-profit);
	font-weight: normal;
	font-size: 0.9rem;
}

.item-profit.bad {
	color: red;
}

.repeat-buyer-badge {
	background: var(--bg-hover);
	border: 1px solid var(--border-color);
	color: var(--accent-teal);
	padding: 3px 7px;
	border-radius: 4px;
	font-size: 0.75rem;
	white-space: nowrap;
}

.order-group-badge {
	background: rgba(244, 162, 97, 0.15);
	border: 1px solid rgba(244, 162, 97, 0.45);
	color: var(--accent-orange);
	padding: 3px 7px;
	border-radius: 4px;
	font-size: 0.75rem;
	font-weight: 600;
	white-space: nowrap;
}

.detail-badge.repeat-buyer {
	background: rgba(78, 205, 196, 0.15);
	color: var(--accent-teal);
}

.costs-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.costs-stats {
	font-size: 1.1rem;
	color: var(--text-muted);
	text-align: center;
	margin-bottom: 20px;
}

.costs-stats span {
	color: var(--accent-orange);
	font-weight: bold;
}

.costs-list {
	max-height: 400px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cost-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 15px;
	background: var(--bg-card);
	border-radius: 8px;
	transition: background 0.2s ease;
}

.cost-row:hover {
	background: var(--bg-hover);
}

.cost-info {
	flex: 1;
	min-width: 0;
}

.cost-description {
	color: var(--accent-orange);
	font-weight: 500;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cost-details {
	font-size: 0.8rem;
	color: var(--text-muted);
	margin-top: 3px;
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.cost-quantity {
	color: var(--text-muted);
}

.cost-per-unit {
	color: var(--text-muted);
}

.cost-date {
	color: var(--text-muted);
}

.cost-price {
	color: var(--accent-orange);
	font-weight: bold;
	font-size: 1.1rem;
	margin-left: 15px;
	white-space: nowrap;
}

.cost-type {
	color: var(--accent-teal);
	font-size: 0.8rem;
	font-weight: 600;
}

.costs-breakdown {
	margin-top: 20px;
}

.costs-breakdown summary {
	cursor: pointer;
	color: var(--text-muted);
	font-size: 0.9rem;
	padding: 8px 0;
}

.costs-breakdown summary:hover {
	color: var(--text-heading);
}

.costs-breakdown-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
	font-size: 0.9rem;
}

.costs-breakdown-table th,
.costs-breakdown-table td {
	padding: 8px 12px;
	text-align: right;
	border-bottom: 1px solid var(--border-color);
}

.costs-breakdown-table th:first-child,
.costs-breakdown-table td:first-child {
	text-align: left;
}

.costs-breakdown-table th {
	color: var(--text-heading);
	font-weight: 600;
}

.costs-breakdown-table td {
	color: var(--text-muted);
}

.costs-breakdown-total td {
	border-top: 2px solid var(--accent-teal);
	color: var(--text-heading);
}

#map {
	height: 400px;
	border-radius: 12px;
	box-shadow: 0 10px 40px var(--shadow-map);
}

.leaflet-popup-content-wrapper {
	background: var(--bg-section);
	color: var(--text-heading);
	border-radius: 8px;
}

.leaflet-popup-tip {
	background: var(--bg-section);
}

.popup-content h3 {
	color: var(--accent-teal);
	margin-bottom: 5px;
}

.popup-content p {
	margin: 3px 0;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.popup-content .shipment-count {
	color: var(--text-heading);
	font-weight: bold;
}

.profit-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.profit-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 20px;
}

.profit-card {
	background: var(--bg-card);
	border-radius: 10px;
	padding: 20px;
}

.profit-card h3 {
	color: var(--text-muted);
	font-size: 1rem;
	margin-bottom: 15px;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.profit-card-total {
	background: linear-gradient(135deg, var(--profit-card-gradient-start) 0%, var(--profit-card-gradient-end) 100%);
	border: 1px solid var(--accent-teal);
}

.profit-card-total h3 {
	color: var(--accent-teal);
}

.profit-row {
	display: flex;
	justify-content: space-between;
	padding: 8px 0;
	border-bottom: 1px solid var(--profit-border);
}

.profit-row:last-child {
	border-bottom: none;
}

.profit-row span:first-child {
	color: var(--text-muted);
}

.profit-row span:last-child {
	color: var(--accent-teal);
	font-weight: bold;
	width: 100%;
	text-align: right;
}

.profit-row.cost span:last-child {
	color: var(--accent-orange);
}

.profit-details {
	margin-top: 20px;
	background: var(--bg-section);
	border-radius: 8px;
	border: 1px solid var(--border-color);
}

.profit-details summary {
	padding: 12px 16px;
	cursor: pointer;
	color: var(--text-muted);
	font-weight: bold;
}

.profit-details summary:hover {
	color: var(--accent-teal);
}

.transaction-details {
	margin-top: 20px;
}

.transaction-details .profit-row span:last-child {
	width: auto;
}

.profit-details pre {
	padding: 16px;
	font-size: 0.85rem;
	line-height: 1.6;
	overflow-x: auto;
	color: var(--text-detail);
	white-space: pre-wrap;
	word-wrap: break-word;
}

@media (max-width: 768px) {
	section h2 {
		font-size: 1.5rem;
	}

	#map {
		height: 50vh;
	}

	.item-row,
	.listing-row,
	.cost-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.item-price,
	.listing-price,
	.cost-price {
		margin-left: 0;
	}

	.profit-grid {
		grid-template-columns: 1fr;
	}

	.listings-list.gallery-mode .listing-row,
	.items-list.gallery-mode .item-row {
		width: calc(50% - 4px);
	}

	.display-toggle {
		margin-left: 0;
		margin-top: 8px;
	}

	.sort-controls {
		justify-content: center;
	}
}

.item-thumb,
.listing-thumb {
	width: 50px;
	height: 50px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	margin-right: 12px;
}

.optimizer-thumb {
	width: 120px;
	height: 120px;
}

.item-thumb-placeholder,
.listing-thumb-placeholder {
	display: none;
}

.view-images-btn {
	background: var(--bg-hover);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 4px 8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.8rem;
	transition: all 0.2s ease;
	margin-left: 10px;
	white-space: nowrap;
}

.view-images-btn:hover {
	border-color: var(--accent-teal);
	color: var(--accent-teal);
	background: var(--bg-card);
}

.ebay-row-btn {
	background: var(--bg-hover);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 4px 8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.8rem;
	transition: all 0.2s ease;
	white-space: nowrap;
	text-decoration: none;
}

.ebay-row-btn:hover {
	border-color: var(--ebay-btn);
	color: var(--ebay-btn);
	background: var(--bg-card);
}

.modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--modal-backdrop);
	z-index: 2000;
	overflow-y: auto;
	padding: 20px;
}

.modal.active {
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

.modal-content {
	background: var(--bg-section);
	border-radius: 12px;
	max-width: 900px;
	width: 100%;
	padding: 25px;
	position: relative;
	margin: auto;
}

.modal-content h3 {
	margin-bottom: 20px;
}

.modal-close {
	position: absolute;
	top: 15px;
	right: 20px;
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: 2rem;
	cursor: pointer;
	transition: color 0.2s ease;
	line-height: 1;
}

.modal-close:hover {
	color: var(--text-heading);
}

.modal-title {
	font-size: 1.3rem;
	color: var(--text-heading);
	margin-bottom: 20px;
	padding-right: 40px;
}

.modal-images {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
	gap: 15px;
}

.modal-images img {
	width: 100%;
	border-radius: 8px;
	cursor: pointer;
	transition: transform 0.2s ease;
}

.modal-images img:hover {
	transform: scale(1.02);
}

.charts-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.charts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
	gap: 20px;
	grid-auto-rows: auto;
}

.chart-card {
	background: var(--bg-card);
	border-radius: 8px;
	padding: 20px;
}

.chart-card h3 {
	color: var(--text-muted);
	font-size: 1rem;
	margin-bottom: 15px;
	text-align: center;
	text-transform: uppercase;
	letter-spacing: 1px;
}

.chart-canvas-wrap {
	position: relative;
	height: 250px;
}

.chart-card canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
}

.chart-details {
	margin-top: 12px;
	border-top: 1px solid var(--border-color);
}

.chart-details summary {
	padding: 8px 0;
	cursor: pointer;
	color: var(--text-dim);
	font-size: 0.85rem;
}

.chart-details summary:hover {
	color: var(--accent-teal);
}

.chart-detail-row {
	display: flex;
	justify-content: space-between;
	padding: 4px 0;
	font-size: 0.85rem;
	color: var(--text-muted);
	border-bottom: 1px solid var(--border-subtle);
}

.chart-detail-row:last-child {
	border-bottom: none;
}

.chart-detail-row span:last-child {
	font-weight: bold;
	color: var(--text-detail);
}

.chart-detail-total {
	border-top: 1px solid var(--border-muted);
	margin-top: 4px;
	padding-top: 8px;
	color: var(--text-heading);
}

.chart-detail-total span:last-child {
	color: var(--accent-teal);
}

.filter-btn {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 6px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 1rem;
	transition: all 0.2s ease;
	position: relative;
}

.filter-btn:hover {
	border-color: var(--accent-teal);
	color: var(--accent-teal);
}

.filter-btn.active {
	background: var(--accent-teal);
	color: var(--bg-card);
	border-color: var(--accent-teal);
}

.filter-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: var(--accent-orange, #e68a00);
	color: #fff;
	border-radius: 50%;
	font-size: 0.65rem;
	min-width: 16px;
	height: 16px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	padding: 0 3px;
}

.filter-modal-content {
	max-width: 700px;
}

.filter-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px 20px;
	margin-bottom: 20px;
}

.filter-group {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.filter-group-full {
	grid-column: 1 / -1;
}

.filter-label {
	font-size: 0.8rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.filter-input {
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	color: var(--text-body);
	padding: 7px 10px;
	border-radius: 6px;
	font-size: 0.9rem;
	transition: border-color 0.2s ease;
	width: 100%;
	box-sizing: border-box;
}

.filter-input:focus {
	outline: none;
	border-color: var(--accent-teal);
}

.filter-checkboxes {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.filter-checkboxes label {
	display: flex;
	align-items: center;
	gap: 5px;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	padding: 4px 10px;
	font-size: 0.82rem;
	cursor: pointer;
	transition:
		border-color 0.2s ease,
		background 0.2s ease;
}

.filter-checkboxes label:hover {
	border-color: var(--accent-teal);
}

.filter-checkboxes input[type="checkbox"] {
	accent-color: var(--accent-teal);
	cursor: pointer;
}

.filter-checkboxes label:has(input:checked) {
	border-color: var(--accent-teal);
	background: color-mix(in srgb, var(--accent-teal) 15%, transparent);
}

.filter-actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	border-top: 1px solid var(--border-color);
	padding-top: 16px;
}

.filter-clear-btn {
	background: none;
	border: 1px solid var(--border-color);
	color: var(--text-muted);
	padding: 8px 18px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.9rem;
	transition: all 0.2s ease;
}

.filter-clear-btn:hover {
	border-color: var(--text-muted);
	color: var(--text-body);
}

.filter-apply-btn {
	background: var(--accent-teal);
	border: 1px solid var(--accent-teal);
	color: var(--bg-card);
	padding: 8px 18px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: bold;
	transition: opacity 0.2s ease;
}

.filter-apply-btn:hover {
	opacity: 0.85;
}

.listings-stats-filtered,
.items-stats-filtered {
	font-size: 0.8rem;
	color: var(--accent-teal);
}

.stat-negative {
	color: var(--accent-red, #e05252);
}

.item-detail-modal {
	max-width: 1000px;
}

.item-detail-header {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
}

.item-detail-images {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.item-detail-images .main-image {
	width: 100%;
	border-radius: 8px;
	cursor: pointer;
}

.item-detail-images .thumbnails {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.item-detail-images .thumbnails img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 4px;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s;
}

.item-detail-images .thumbnails img:hover,
.item-detail-images .thumbnails img.active {
	opacity: 1;
}

.item-detail-info h2 {
	color: var(--text-heading);
	font-size: 1.4rem;
	margin-bottom: 15px;
	line-height: 1.4;
}

.item-detail-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 20px;
}

.detail-badge {
	background: var(--badge-bg);
	color: var(--badge-text);
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 0.85rem;
}

.detail-badge.category {
	background: var(--bg-body);
	color: var(--text-muted);
}

.detail-badge.sold {
	background: var(--badge-sold-bg);
	color: var(--badge-sold-text);
}

.item-detail-price {
	font-size: 2rem;
	color: var(--accent-price);
	font-weight: bold;
	margin-bottom: 10px;
}

.item-detail-price .profit {
	font-size: 1rem;
	color: var(--accent-profit-pos);
	margin-left: 10px;
}

.item-detail-price .profit.negative {
	color: var(--accent-profit-neg);
}

.item-detail-sku {
	color: var(--text-dim);
	font-size: 0.85rem;
	margin-bottom: 4px;
}

.item-detail-description {
	color: var(--text-body);
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0 0 18px;
	white-space: pre-wrap;
}

.item-detail-date {
	color: var(--text-label);
	margin-bottom: 20px;
}

.item-detail-stats {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
	margin-bottom: 20px;
	padding: 15px;
	background: var(--bg-card);
	border-radius: 8px;
}

.item-detail-stats .stat {
	text-align: center;
}

.item-detail-stats .stat-value {
	font-size: 1.2rem;
	color: var(--text-heading);
	font-weight: bold;
}

.item-detail-stats .stat-label {
	font-size: 0.75rem;
	color: var(--text-label);
	text-transform: uppercase;
}

.ebay-link {
	display: inline-block;
	background: var(--ebay-btn);
	color: var(--text-ebay-link);
	padding: 12px 24px;
	border-radius: 24px;
	text-decoration: none;
	font-weight: bold;
	transition: background 0.2s;
}

.ebay-link:hover {
	background: var(--ebay-btn-hover);
}

.item-row,
.listing-row {
	cursor: pointer;
}

.item-row:hover,
.listing-row:hover {
	background: var(--bg-hover);
}

.site-footer {
	text-align: center;
	padding: 30px 0 10px;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	flex-direction: column;
}

.site-footer button, .site-footer a {
	background: transparent;
	border: 1px solid var(--border-color);
	color: var(--text-dim);
	padding: 8px 20px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 0.8rem;
	transition:
		color 0.2s,
		border-color 0.2s;
}

.site-footer a {
	font-size: 1.4rem;
}

.site-footer button:hover, .site-footer a:hover {
	color: var(--text-primary);
	border-color: var(--text-muted);
	text-decoration: none;
}

.site-footer #resetPreferences:hover {
	color: var(--accent-profit-neg);
	border-color: var(--accent-profit-neg);
}

.footer-links {
	display: flex;
	gap: 1rem;
	justify-content: center;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}

.footer-links a {
	background: transparent;
	border: none;
	padding: 0;
	color: var(--accent-teal);
	text-decoration: none;
	font-weight: bold;
	font-size: 0.95rem;
}

.footer-links a:hover {
	color: var(--accent-teal);
	border: none;
	text-decoration: underline;
}

/* Website item / listing product pages */
.item-page {
	max-width: 95%;
	margin: 0 auto;
	padding: 20px;
}

.item-page-header {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	margin-bottom: 40px;
}

.item-page-images .main-image {
	width: 100%;
	border-radius: 12px;
	margin-bottom: 15px;
	cursor: zoom-in;
}

.item-page-images .thumbnails {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.item-page-images .thumbnails img {
	width: 80px;
	height: 80px;
	object-fit: cover;
	border-radius: 8px;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s;
}

.item-page-images .thumbnails img:hover,
.item-page-images .thumbnails img.active {
	opacity: 1;
}

.item-page-info h1 {
	color: var(--text-heading);
	font-size: 1.8rem;
	margin-bottom: 15px;
	line-height: 1.4;
}

.item-page-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 20px;
}

.item-page-meta .badge {
	background: var(--badge-bg);
	color: var(--badge-text);
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 0.9rem;
}

.item-page-meta .badge.sold {
	background: var(--badge-sold-bg);
	color: var(--badge-sold-text);
}

.item-page-price {
	font-size: 2.5rem;
	color: var(--accent-price);
	font-weight: bold;
	margin-bottom: 5px;
}

.item-page-description {
	color: var(--text-body);
	font-size: 1rem;
	line-height: 1.7;
	margin-bottom: 18px;
	white-space: pre-wrap;
}

.item-page-date {
	color: var(--text-label);
	margin-bottom: 25px;
}

.item-page .ebay-btn {
	display: inline-block;
	background: var(--ebay-btn);
	color: #fff;
	padding: 15px 30px;
	border-radius: 30px;
	text-decoration: none;
	font-weight: bold;
	font-size: 1.1rem;
	transition: background 0.2s;
}

.item-page .ebay-btn:hover {
	background: var(--ebay-btn-hover);
}

.item-page .back-link {
	display: inline-block;
	color: var(--accent-teal);
	text-decoration: none;
	margin-bottom: 20px;
}

.item-page .back-link:hover {
	text-decoration: underline;
}

@media (max-width: 768px) {
	.item-page-header {
		grid-template-columns: 1fr;
	}
}

/* 404 error page */
.error-page {
	max-width: 600px;
	margin: 100px auto;
	text-align: center;
	padding: 20px;
}

.error-page h1 {
	font-size: 6rem;
	color: var(--accent-price);
	margin-bottom: 20px;
}

.error-page h2 {
	color: var(--text-heading);
	margin-bottom: 20px;
}

.error-page p {
	color: var(--text-label);
	margin-bottom: 30px;
}

.error-page a {
	display: inline-block;
	background: var(--ebay-btn);
	color: #fff;
	padding: 12px 24px;
	border-radius: 24px;
	text-decoration: none;
	font-weight: bold;
}

.error-page a:hover {
	background: var(--ebay-btn-hover);
}

.optimizer-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.optimizer-stats {
	color: var(--text-muted);
	margin-bottom: 15px;
}

.optimizer-stats span {
	color: var(--accent-teal);
	font-weight: bold;
}

.optimizer-legend {
	margin-bottom: 20px;
	background: var(--bg-card);
	border-radius: 8px;
	border: 1px solid var(--border-color);
}

.optimizer-legend summary {
	padding: 10px 16px;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.optimizer-legend summary:hover {
	color: var(--accent-teal);
}

.optimizer-legend-content {
	padding: 0 16px 16px;
}

.optimizer-legend-content p {
	color: var(--text-dim);
	font-size: 0.85rem;
	margin-bottom: 8px;
}

.optimizer-legend-row {
	display: flex;
	gap: 12px;
	padding: 4px 0;
	font-size: 0.85rem;
	color: var(--text-muted);
}

.optimizer-legend-label {
	min-width: 180px;
	font-weight: bold;
	color: var(--text-detail);
}

.optimizer-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.optimizer-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s;
	border-bottom: 1px solid var(--border-color);
}

.optimizer-row:hover {
	background: var(--bg-hover);
}

.optimizer-rank {
	min-width: 32px;
	font-weight: bold;
	color: var(--accent-teal);
	font-size: 0.85rem;
	text-align: center;
}

.optimizer-info {
	flex: 1;
	min-width: 0;
}

.optimizer-title {
	display: block;
	font-weight: 500;
	color: var(--text-primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	margin-bottom: 4px;
}

.optimizer-details {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 0.8rem;
	flex-wrap: wrap;
}

.optimizer-days {
	color: var(--text-muted);
}

.optimizer-watchers {
	color: var(--accent-teal);
	font-weight: bold;
}

.optimizer-score {
	color: var(--text-dim);
}

.optimizer-prices {
	display: flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.optimizer-current {
	color: var(--text-muted);
	text-decoration: line-through;
	font-size: 0.85rem;
}

.optimizer-arrow {
	color: var(--text-dim);
	font-size: 0.8rem;
}

.optimizer-reduced {
	color: var(--accent-price);
	font-weight: bold;
}

.optimizer-profit {
	display: flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	min-width: 140px;
	justify-content: flex-end;
}

.optimizer-profit-current {
	color: var(--text-muted);
	text-decoration: line-through;
	font-size: 0.85rem;
}

.optimizer-profit-reduced {
	color: var(--accent-profit-pos);
	font-weight: bold;
}

.optimizer-col {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.optimizer-label {
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--text-dim);
	margin-bottom: 2px;
}

@media (max-width: 768px) {
	.optimizer-row {
		flex-wrap: wrap;
	}

	.optimizer-rank {
		min-width: 28px;
	}

	.optimizer-prices,
	.optimizer-profit {
		width: 100%;
		padding-left: 40px;
	}

	.optimizer-legend-row {
		flex-direction: column;
		gap: 2px;
	}

	.optimizer-legend-label {
		min-width: auto;
	}
}

@media (max-width: 768px) {
	.item-detail-header {
		grid-template-columns: 1fr;
	}

	.item-detail-images {
		order: -1;
	}
}

.duplicates-section {
	background: var(--bg-section);
	border-radius: 12px;
	padding: 25px;
	box-shadow: 0 10px 40px var(--shadow-section);
}

.duplicates-stats {
	color: var(--text-muted);
	margin-bottom: 15px;
}

.duplicates-stats span {
	color: var(--accent-teal);
	font-weight: bold;
}

.duplicates-legend {
	margin-bottom: 20px;
	background: var(--bg-card);
	border-radius: 8px;
	border: 1px solid var(--border-color);
}

.duplicates-legend summary {
	padding: 10px 16px;
	cursor: pointer;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.duplicates-legend summary:hover {
	color: var(--accent-teal);
}

.duplicates-legend-content {
	padding: 0 16px 16px;
}

.duplicates-legend-content p {
	color: var(--text-dim);
	font-size: 0.85rem;
	margin-bottom: 8px;
}

.duplicates-legend-row {
	display: flex;
	gap: 12px;
	padding: 4px 0;
	font-size: 0.85rem;
	color: var(--text-muted);
}

.duplicates-legend-label {
	min-width: 180px;
	font-weight: bold;
	color: var(--text-detail);
}

.duplicates-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-height: 80vh;
	overflow-y: auto;
}

.duplicates-group {
	background: var(--bg-card);
	border-radius: 8px;
	border: 1px solid var(--border-color);
}

.duplicates-group-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: var(--bg-hover);
	font-size: 0.85rem;
	color: var(--text-muted);
}

.duplicates-match-pct {
	font-weight: bold;
	color: var(--accent-teal);
	min-width: 48px;
}

.duplicates-shared-words {
	color: var(--text-dim);
	font-size: 0.8rem;
}

.duplicates-group-items {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.duplicates-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	cursor: pointer;
	transition: background 0.2s;
}

.duplicates-row:hover {
	background: var(--bg-hover);
}

.duplicates-row:nth-child(2) {
	border-left: 1px solid var(--border-color);
}

.duplicates-row-info {
	flex: 1;
	min-width: 0;
}

.duplicates-row-title {
	display: block;
	font-weight: 500;
	color: var(--text-primary);
	margin-bottom: 4px;
	line-height: 1.4;
}

.duplicates-word-match {
	background: color-mix(in srgb, var(--accent-teal) 25%, transparent);
	border-radius: 2px;
	padding: 0 2px;
}

.duplicates-row-details {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 0.8rem;
	flex-wrap: wrap;
}

.duplicates-row-sku {
	color: var(--text-dim);
}

.duplicates-row-price {
	color: var(--accent-price);
	font-weight: bold;
	white-space: nowrap;
}

@media (max-width: 768px) {
	.duplicates-group-items {
		grid-template-columns: 1fr;
	}

	.duplicates-row:nth-child(2) {
		border-left: none;
		border-top: 1px solid var(--border-color);
	}

	.duplicates-row {
		flex-wrap: wrap;
	}

	.duplicates-legend-row {
		flex-direction: column;
		gap: 2px;
	}

	.duplicates-legend-label {
		min-width: auto;
	}
}
