/* Taskify — design tokens (keeps original teal spirit, refined) */
:root {
	color-scheme: light;
	--font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--page-bg: #e3eef3;
	--page-accent: #5a8fa8;
	--text: #1a2a32;
	--text-muted: #4a6670;
	--surface: #ffffff;
	--surface-elevated: rgba(255, 255, 255, 0.92);
	--border: rgba(26, 42, 50, 0.12);
	--shadow: 0 1px 2px rgba(26, 42, 50, 0.06), 0 8px 24px rgba(26, 42, 50, 0.08);
	--radius: 12px;
	--radius-sm: 8px;
	--focus: #3d7a9a;
	--danger: #c53030;
	--danger-hover: #9b2626;
	--primary: #3d6f87;
	--primary-hover: #335f73;
	--stats-bg: rgba(61, 122, 154, 0.12);
	--stats-border: rgba(61, 122, 154, 0.28);
	--stats-text: #1e4a5c;
	--tap-min: 44px;
}

[data-theme='dark'] {
	color-scheme: dark;
	--page-bg: #0f1419;
	--page-accent: #6b9fb8;
	--text: #e8eef2;
	--text-muted: #9fb0ba;
	--surface: #1a2330;
	--surface-elevated: rgba(26, 35, 48, 0.95);
	--border: rgba(232, 238, 242, 0.12);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.45);
	--focus: #8ecae6;
	--danger: #f56565;
	--danger-hover: #e53e3e;
	--primary: #7eb8cf;
	--primary-hover: #9fcbdf;
	--stats-bg: rgba(126, 184, 207, 0.12);
	--stats-border: rgba(126, 184, 207, 0.35);
	--stats-text: #cfe8f2;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	height: 100%;
}

body {
	min-height: 100%;
	margin: 0;
	font-family: var(--font);
	font-size: 1rem;
	line-height: 1.5;
	color: var(--text);
	background: var(--page-bg);
	-webkit-font-smoothing: antialiased;
}

.page-gradient {
	position: fixed;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(ellipse 80% 50% at 50% -20%, color-mix(in srgb, var(--page-accent) 35%, transparent), transparent),
		radial-gradient(ellipse 60% 40% at 100% 100%, color-mix(in srgb, var(--page-accent) 18%, transparent), transparent);
	z-index: 0;
}

.main {
	position: relative;
	z-index: 1;
	min-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	max-width: 42rem;
	margin: 0 auto;
	padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.5rem) 2rem;
}

.app-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.brand {
	min-width: 0;
}

.app-title {
	margin: 0 0 0.25rem;
	font-size: clamp(1.75rem, 4vw, 2.125rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--text);
}

.app-tagline {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--text-muted);
}

.theme-toggle {
	flex-shrink: 0;
	width: var(--tap-min);
	height: var(--tap-min);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	background: var(--surface-elevated);
	color: var(--text);
	cursor: pointer;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		transform 0.12s ease;
}

.theme-toggle:hover {
	border-color: color-mix(in srgb, var(--focus) 45%, var(--border));
}

.theme-toggle:active {
	transform: scale(0.97);
}

.theme-toggle:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.theme-toggle__icon {
	font-size: 1.125rem;
	line-height: 1;
}

.theme-toggle__icon--sun {
	display: none;
}

[data-theme='dark'] .theme-toggle__icon--sun {
	display: inline;
}

[data-theme='dark'] .theme-toggle__icon--moon {
	display: none;
}

.stats-panel {
	width: 100%;
	text-align: center;
	padding: 0.75rem 1rem;
	margin-bottom: 1.25rem;
	background: var(--stats-bg);
	border: 1px solid var(--stats-border);
	border-radius: var(--radius-sm);
	color: var(--stats-text);
	font-size: 0.9375rem;
	font-weight: 500;
	box-sizing: border-box;
}

.feedback {
	width: 100%;
	margin: 0 0 1rem;
	padding: 0.625rem 0.875rem;
	border-radius: var(--radius-sm);
	background: color-mix(in srgb, var(--danger) 12%, var(--surface));
	border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
	color: var(--text);
	font-size: 0.875rem;
}

.add-task {
	display: flex;
	width: 100%;
	gap: 0;
	align-items: stretch;
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	border: 1px solid var(--border);
	background: var(--surface);
}

.form-control {
	display: block;
	width: 100%;
	padding: 0.625rem 0.875rem;
	font-size: 1rem;
	line-height: 1.5;
	font-family: inherit;
	color: var(--text);
	background: var(--surface);
	border: none;
	border-radius: 0;
	transition:
		box-shadow 0.15s ease,
		background 0.15s ease;
}

.form-control::placeholder {
	color: var(--text-muted);
	opacity: 1;
}

.form-control:focus {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--focus);
}

.form-control--grow {
	flex: 1;
	min-width: 0;
}

.form-hint {
	margin: 0.5rem 0 1.25rem;
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.form-hint kbd {
	font-family: inherit;
	font-size: 0.75rem;
	padding: 0.1rem 0.35rem;
	border-radius: 4px;
	border: 1px solid var(--border);
	background: color-mix(in srgb, var(--surface) 80%, var(--page-bg));
}

.list-shell {
	position: relative;
	width: 100%;
	flex: 1;
}

.task-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: 100%;
	list-style: none;
	padding: 0;
	margin: 0;
}

.task-list[hidden] {
	display: none !important;
}

.task-row {
	display: flex;
	width: 100%;
	align-items: stretch;
	gap: 0;
	animation: row-in 0.2s ease-out;
}

@keyframes row-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.div-input-checkbox {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 0.5rem;
	min-width: 2.75rem;
	background: color-mix(in srgb, var(--surface) 92%, var(--page-bg));
	border: 1px solid var(--border);
	border-right: none;
	border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

input[type='checkbox'] {
	width: 1.125rem;
	height: 1.125rem;
	margin: 0;
	accent-color: var(--focus);
	cursor: pointer;
}

.task-label {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 0.625rem 0.75rem;
	cursor: text;
	border: 1px solid var(--border);
	border-left: none;
	border-right: none;
	border-radius: 0;
	user-select: none;
	transition:
		opacity 0.15s ease,
		text-decoration-color 0.15s ease;
}

.task-label--done {
	text-decoration: line-through;
	text-decoration-color: var(--text-muted);
	opacity: 0.72;
	cursor: default;
}

.task-row input.form-control {
	cursor: text;
	user-select: text;
	border-left: none;
	border-right: none;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--tap-min);
	padding: 0.5rem 1rem;
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	border: 1px solid transparent;
	cursor: pointer;
	transition:
		background 0.15s ease,
		border-color 0.15s ease,
		transform 0.1s ease;
}

.btn:active:not(:disabled) {
	transform: scale(0.98);
}

.btn:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.btn-primary {
	color: #fff;
	background: var(--primary);
	border-color: color-mix(in srgb, var(--primary) 80%, #000);
	padding-inline: 1.125rem;
}

.btn-primary:hover {
	background: var(--primary-hover);
}

.btn-delete {
	min-width: 3rem;
	padding-inline: 0.75rem;
	color: #fff;
	background: var(--danger);
	border-color: color-mix(in srgb, var(--danger) 75%, #000);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	font-size: 1.25rem;
	line-height: 1;
	font-weight: 500;
}

.btn-delete:hover {
	background: var(--danger-hover);
}

.btn-ghost {
	min-height: 2.75rem;
	color: var(--text-muted);
	background: transparent;
	border: 1px dashed var(--border);
	border-radius: var(--radius-sm);
	width: 100%;
	margin-top: 1.25rem;
}

.btn-ghost:hover {
	color: var(--text);
	border-color: var(--focus);
	background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.btn-sm {
	font-size: 0.875rem;
	min-height: 2.75rem;
}

.app-footer {
	width: 100%;
}

.empty-state {
	text-align: center;
	padding: 2rem 1rem;
	border: 1px dashed var(--border);
	border-radius: var(--radius);
	background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.empty-state[hidden] {
	display: none !important;
}

.empty-state__title {
	margin: 0 0 0.5rem;
	font-size: 1.0625rem;
	font-weight: 600;
	color: var(--text);
}

.empty-state__body {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--text-muted);
	max-width: 22rem;
	margin-inline: auto;
	line-height: 1.55;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.list-unstyled {
	list-style: none;
}

@media (max-width: 520px) {
	.add-task {
		flex-direction: column;
		border-radius: var(--radius);
	}

	.btn-primary {
		border-radius: 0 0 var(--radius) var(--radius);
		padding-block: 0.75rem;
	}

	.form-control--grow {
		border-radius: var(--radius) var(--radius) 0 0;
	}

	.task-label,
	.task-row .form-control {
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.task-row {
		animation: none;
	}

	.btn:active:not(:disabled),
	.theme-toggle:active {
		transform: none;
	}
}
