/* ==================================================
   Design tokens
   ================================================== */

:root {
	/* Backgrounds */
	--bg: #f8fafc;
	--surface: #ffffff;
	--surface-muted: #f1f5f9;
	--border: #e2e8f0;

	/* Text */
	--text: #0f172a;
	--muted: #475569;

	/* Brand */
	--brand: #0f766e;
	--brand-soft: #14b8a6;

	/* Semantic */
	--success: #16a34a;
	--danger: #dc2626;
	--warning: #d97706;

	/* Radius */
	--radius-sm: 6px;
	--radius-md: 10px;

	/* Spacing */
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 24px;
	--space-6: 32px;
}

/* ==================================================
   Base / reset
   ================================================== */

* {
	box-sizing: border-box;
}

html {
	font-size: 14px;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Inter, system-ui, sans-serif;
	line-height: 1.6;
}

/* ==================================================
   Layout
   ================================================== */

.layout {
	max-width: 1120px;
	margin: var(--space-6) auto;
	padding: 0 var(--space-4);
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: var(--space-5);
}

@media (max-width: 900px) {
	.layout {
		grid-template-columns: 1fr;
	}
}

/* ==================================================
   Header
   ================================================== */

.site-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

.header-inner {
	max-width: 1120px;
	margin: 0 auto;
	padding: var(--space-5) var(--space-4);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}

.brand h1 {
	margin: 0;
	font-size: 26px;
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--brand);
}

.brand p {
	margin: var(--space-1) 0 0;
	font-size: 13px;
	color: var(--muted);
}

.header-actions {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

/* ==================================================
   Panels
   ================================================== */

.panel {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.panel.results {
	border-left: 4px solid var(--brand);
}

/* ==================================================
   Typography
   ================================================== */

h2 {
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 var(--space-2);
}

h3 {
	font-size: 16px;
	font-weight: 600;
	margin: var(--space-4) 0 var(--space-2);
}

.section-title {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* ==================================================
   Forms
   ================================================== */

label {
	font-size: 12px;
	color: var(--muted);
	display: flex;
	align-items: center;
}

label:hover {
	color: var(--brand);
}

input,
select {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: var(--space-2) var(--space-3);
	font-size: 14px;
}

input:focus,
select:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

/* ==================================================
   Buttons
   ================================================== */

button {
	border: none;
	border-radius: var(--radius-sm);
	padding: var(--space-2) var(--space-4);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	background: var(--brand);
	color: #ffffff;
	display: inline-flex;
	align-items: center;
	transition:
		background 0.15s ease,
		transform 0.05s ease;
}

button:hover {
	background: var(--brand-soft);
	transform: translateY(-1px);
}

button.danger {
	background: var(--danger);
}

/* ==================================================
   Results
   ================================================== */

.total {
	font-size: 32px;
	font-weight: 600;
	letter-spacing: -0.02em;
	margin: var(--space-2) 0;
	color: var(--brand);
}

/* ==================================================
   Sub‑panels
   ================================================== */

.sub-panel {
	display: none;
	padding: var(--space-3);
	background: var(--surface-muted);
	border-radius: var(--radius-sm);
	border-left: 3px solid var(--border);
}

/* ==================================================
   Comparison grid
   ================================================== */

.compare-grid {
	display: grid;
	grid-template-columns: 1.4fr 1fr 1fr;
	margin-top: var(--space-3);
	font-size: 13px;
}

.compare-header {
	padding: var(--space-2);
	color: var(--brand);
	font-weight: 600;
	border-bottom: 1px solid var(--border);
}

.metric {
	padding: var(--space-2);
	color: var(--muted);
	border-bottom: 1px solid var(--border);
}

.value {
	padding: var(--space-2);
	text-align: center;
	border-bottom: 1px solid var(--border);
}

.value.good {
	color: var(--success);
	font-weight: 600;
}

.value.bad {
	color: var(--danger);
	font-weight: 600;
}

.value.neutral {
	color: var(--text);
}

/* ==================================================
   Icons
   ================================================== */

.icon {
	width: 16px;
	height: 16px;
	color: currentColor;
	display: inline-block;
	vertical-align: middle;
	filter: saturate(0.9);
}

.icon.label {
	margin-right: 6px;
}

.icon.button {
	margin-right: 6px;
}

.icon.section {
	width: 18px;
	height: 18px;
	margin-right: 8px;
	opacity: 0.9;
}

.icon.toggle {
	width: 18px;
	height: 18px;
	margin-right: 6px;
	transition: transform 0.3s ease;
}

button:hover .icon {
	filter: brightness(1.1);
}

/* ==================================================
   Theme toggle
   ================================================== */

.theme-toggle {
	background: var(--surface-muted);
	color: var(--text);
	border: 1px solid var(--border);
	font-size: 12px;
	padding: 6px 10px;
}

.theme-toggle:hover {
	background: var(--surface);
}

/* ==================================================
   Toasts
   ================================================== */

#toastContainer {
	position: fixed;
	top: var(--space-4);
	right: var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	z-index: 1000;
}

/* ==================================================
   Footer
   ================================================== */

.site-footer {
	margin-top: var(--space-6);
	padding: var(--space-5) var(--space-4);
	border-top: 1px solid var(--border);
	background: var(--surface-muted);
}

.footer-inner {
	max-width: 1120px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	font-size: 12px;
	color: var(--muted);
}

.footer-inner strong {
	color: var(--text);
	font-weight: 500;
}

.footer-meta {
	opacity: 0.8;
}

.footer-meta a {
	color: var(--brand);
}

/* ==================================================
   Dark theme
   ================================================== */

html[data-theme="dark"] {
	--bg: #0b1020;
	--surface: #141a33;
	--surface-muted: #1b2142;
	--border: #2a3160;

	--text: #f5f7ff;
	--muted: #a4abc9;

	--brand: #5eead4;
	--brand-soft: #2dd4bf;

	--success: #4ade80;
	--danger: #f87171;
	--warning: #facc15;
}

html[data-theme="dark"] .icon.toggle {
	transform: rotate(180deg);
}

/* ==================================================
   Responsive tweaks
   ================================================== */

@media (max-width: 600px) {
	label {
		font-size: 11px;
	}

	.section-title {
		font-size: 18px;
	}

	.icon.label {
		margin-right: 4px;
	}

	.header-inner {
		flex-direction: column;
		align-items: flex-start;
	}

	.site-footer {
		text-align: left;
	}
}
