:root {
	--bg: #f6f1e8;
	--surface: #fffdf8;
	--surface-strong: #f0e3cb;
	--text: #1d1d1b;
	--muted: #6c6a63;
	--brand: #177245;
	--brand-dark: #0f5c36;
	--accent: #ffb84d;
	--border: #e4d7c3;
	--danger: #a63c3c;
	--shadow: 0 20px 45px rgba(58, 43, 18, 0.08);
	--radius: 24px;
	--radius-sm: 18px;
	--radius-xs: 14px;
	--transition: 0.2s ease;
}

body {
	background:
		radial-gradient(circle at top, rgba(255, 184, 77, 0.22), transparent 28%),
		linear-gradient(180deg, #fbf7ef 0%, var(--bg) 100%);
	color: var(--text);
	font-family: "Segoe UI", sans-serif;
	min-height: 100vh;
}

.auth-body {
	display: grid;
	place-items: center;
	padding: 1.5rem;
}

.auth-shell,
.app-shell {
	width: min(100%, 720px);
	margin: 0 auto;
}

.auth-card,
.card-panel,
.checkout-item,
.list-card,
.history-card {
	background: rgba(255, 253, 248, 0.92);
	border: 1px solid var(--border);
	border-radius: 24px;
	box-shadow: var(--shadow);
}

.auth-card {
	padding: 1.5rem;
}

.auth-card__hero h1,
.page-header h1 {
	font-size: clamp(2rem, 6vw, 2.9rem);
	font-weight: 800;
	letter-spacing: -0.04em;
	margin-bottom: 0.75rem;
}

.auth-card__hero p,
.page-header p,
.section-title p,
.empty-state p {
	color: var(--muted);
}

.eyebrow {
	color: var(--brand);
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.auth-feedback {
	background: #fff1f1;
	border: 1px solid #f1bebe;
	border-radius: 16px;
	color: #8a2f2f;
	margin: 1rem 0;
	padding: 0.85rem 1rem;
}

.auth-feedback--success {
	background: #eefaf2;
	border-color: #b9dfc7;
	color: var(--brand-dark);
}

.btn-brand {
	background: var(--brand);
	border-color: var(--brand);
	color: #fff;
	transition: all var(--transition);
}

.btn-brand:hover,
.btn-brand:focus {
	background: var(--brand-dark);
	border-color: var(--brand-dark);
	color: #fff;
}

.btn-brand:active {
	transform: scale(0.97);
}

.btn-outline-dark {
	transition: all var(--transition);
}

.btn-outline-dark:active {
	transform: scale(0.97);
}

.stack-lg > * + *,
.stack-md > * + * {
	margin-top: 1rem;
}

.stack-lg > * + * {
	margin-top: 1.25rem;
}

.auth-link {
	color: var(--muted);
	margin-top: 1rem;
	text-align: center;
}

.auth-link a,
.back-link {
	color: var(--brand-dark);
	font-weight: 600;
	text-decoration: none;
	transition: color var(--transition);
}

.back-link:hover {
	color: var(--brand);
}

.app-body {
	padding: 1rem 1rem calc(6rem + env(safe-area-inset-bottom, 0px));
}

.page-header {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.page-header--compact h1 {
	font-size: clamp(1.8rem, 5vw, 2.4rem);
}

.card-panel {
	padding: 1.25rem;
}

.summary-strip,
.summary-grid {
	display: grid;
	gap: 0.85rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-bottom: 1rem;
}

.summary-strip > div:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}

.summary-strip > div,
.summary-box {
	background: rgba(240, 227, 203, 0.55);
	border-radius: 20px;
	padding: 1rem;
}

.summary-strip span,
.summary-box span,
.sticky-summary span,
.detail-row span {
	color: var(--muted);
	display: block;
	font-size: 0.85rem;
}

.summary-strip strong,
.summary-box strong,
.sticky-summary strong {
	font-size: 1.1rem;
}

.section-title,
.list-card__top,
.history-card__actions,
.list-card__actions,
.detail-row,
.history-item,
.item-card,
.checkout-item__meta {
	align-items: center;
	display: flex;
	justify-content: space-between;
	gap: 0.75rem;
}

.list-card,
.history-card,
.checkout-item {
	padding: 1rem;
}

.list-card h2,
.history-card h2,
.item-card h3,
.history-item h3 {
	font-size: 1.1rem;
	font-weight: 700;
	margin: 0;
}

.list-card p,
.history-card p,
.item-card p,
.history-item p {
	color: var(--muted);
	margin: 0.25rem 0 0;
}

.list-card__meta,
.history-card__meta {
	color: var(--muted);
	display: grid;
	gap: 0.5rem;
	margin: 1rem 0;
}

.status-pill,
.chip {
	background: rgba(23, 114, 69, 0.12);
	border-radius: 999px;
	color: var(--brand-dark);
	display: inline-flex;
	font-size: 0.82rem;
	font-weight: 700;
	padding: 0.4rem 0.8rem;
}

.status-pill--done {
	background: rgba(23, 114, 69, 0.18);
}

.item-card {
	align-items: flex-start;
	background: rgba(240, 227, 203, 0.3);
	border-radius: 20px;
	padding: 1rem;
}

.item-card__main {
	flex: 1;
}

.item-card__actions,
.item-card__chips,
.sticky-actions {
	display: flex;
	gap: 0.5rem;
}

.icon-button {
	align-items: center;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: var(--radius-xs);
	color: var(--text);
	cursor: pointer;
	display: inline-flex;
	height: 48px;
	justify-content: center;
	text-decoration: none;
	transition: all var(--transition);
	width: 48px;
}

.icon-button:hover {
	background: var(--surface-strong);
	border-color: var(--brand);
	color: var(--brand-dark);
}

.icon-button:active {
	transform: scale(0.9);
}

.icon-button--danger {
	color: var(--danger);
}

.icon-button--danger:hover {
	background: #fff1f1;
	border-color: var(--danger);
	color: var(--danger);
}

.sticky-actions {
	margin-top: 1rem;
}

.sticky-actions > * {
	flex: 1;
}

.checkout-item {
	display: grid;
	gap: 0.8rem;
}

.toggle-button {
	-webkit-appearance: none;
	appearance: none;
	align-items: center;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--text);
	cursor: pointer;
	display: flex;
	font-size: 1rem;
	font-weight: 700;
	gap: 0.75rem;
	justify-content: flex-start;
	padding: 0.95rem 1rem;
	text-align: left;
	transition: all var(--transition);
	width: 100%;
}

.toggle-button .bi {
	color: var(--muted);
	font-size: 1.2rem;
	line-height: 1;
}

.toggle-button span {
	color: inherit;
	flex: 1;
}

.toggle-button.is-checked {
	background: rgba(23, 114, 69, 0.12);
	border-color: rgba(23, 114, 69, 0.3);
	color: var(--brand-dark);
}

.toggle-button.is-checked .bi {
	color: var(--brand-dark);
}

.unit-toggle {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: 1fr 1fr;
}

.unit-toggle__btn {
	-webkit-appearance: none;
	appearance: none;
	align-items: center;
	background: #fff;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	color: var(--muted);
	cursor: pointer;
	display: flex;
	font-size: 1rem;
	font-weight: 700;
	gap: 0.4rem;
	justify-content: center;
	padding: 0.85rem 0.5rem;
	transition: all var(--transition);
}

.unit-toggle__btn:hover {
	border-color: var(--brand);
	color: var(--brand-dark);
}

.unit-toggle__btn.is-active {
	background: rgba(23, 114, 69, 0.12);
	border-color: rgba(23, 114, 69, 0.35);
	color: var(--brand-dark);
}

.unit-toggle__btn:active {
	transform: scale(0.97);
}

.quick-price-form .input-group-text {
	background: var(--surface-strong);
	border-color: var(--border);
}

.sticky-summary {
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	background: rgba(255, 253, 248, 0.92);
	border-top: 1px solid var(--border);
	bottom: 4.5rem;
	left: 0;
	padding: 1rem;
	position: sticky;
	z-index: 2;
}

.sticky-summary__grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-bottom: 1rem;
}

.is-syncing .bi-arrow-repeat {
	animation: spin 0.8s linear infinite;
	display: inline-block;
}

@keyframes spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.bottom-nav {
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	background: rgba(255, 253, 248, 0.88);
	border-top: 1px solid var(--border);
	bottom: 0;
	display: flex;
	flex-wrap: nowrap;
	gap: 0.25rem;
	justify-content: center;
	left: 0;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 0.5rem 0.75rem;
	padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
	position: fixed;
	right: 0;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-ms-overflow-style: none;
	z-index: 10;
}

.bottom-nav::-webkit-scrollbar {
	display: none;
}

.bottom-nav__item,
.bottom-nav__button {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: var(--radius-sm);
	color: var(--muted);
	cursor: pointer;
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	font-size: 0.78rem;
	gap: 0.2rem;
	justify-content: center;
	min-width: 5rem;
	padding: 0.6rem;
	scroll-snap-align: center;
	text-decoration: none;
	transition: color var(--transition), background var(--transition);
	width: auto;
}

.bottom-nav__item:hover,
.bottom-nav__button:hover {
	color: var(--brand-dark);
}

.bottom-nav__item.active {
	background: rgba(23, 114, 69, 0.12);
	color: var(--brand-dark);
	font-weight: 700;
}

.bottom-nav__logout {
	flex: 0 0 auto;
	margin: 0;
}

.empty-state {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: 0.8rem;
	padding: 2rem 1rem;
	text-align: center;
}

.empty-state--compact {
	padding: 1rem 0;
}

.empty-state__icon {
	align-items: center;
	background: rgba(255, 184, 77, 0.22);
	border-radius: 24px;
	display: inline-flex;
	font-size: 2rem;
	height: 72px;
	justify-content: center;
	width: 72px;
}

.detail-row {
	background: rgba(240, 227, 203, 0.35);
	border-radius: 16px;
	padding: 0.85rem 1rem;
}

.history-item {
	background: rgba(240, 227, 203, 0.3);
	border-radius: 18px;
	padding: 0.85rem 1rem;
}

.inline-form {
	margin: 0;
}

.sr-only {
	height: 1px;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 1px;
}

/* Focus & accessibility */

.icon-button:focus-visible,
.toggle-button:focus-visible,
.btn-brand:focus-visible,
.btn-outline-dark:focus-visible,
.bottom-nav__item:focus-visible,
.bottom-nav__button:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

.form-control:focus {
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(23, 114, 69, 0.15);
}

/* Card actions layout */

.list-card__actions,
.history-card__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
}

.list-card__actions .btn,
.history-card__actions .btn,
.history-card__actions form {
	width: 100%;
}

.history-card__actions form .btn {
	width: 100%;
}

/* Alert animation */

@keyframes slideDown {
	from { opacity: 0; transform: translateY(-0.5rem); }
	to { opacity: 1; transform: translateY(0); }
}

.alert {
	animation: slideDown 0.3s ease;
}

.alert-fade-out {
	opacity: 0;
	transform: translateY(-0.5rem);
	transition: all 0.4s ease;
}

/* Exceeded amount highlight */

.text-exceeded {
	color: var(--danger);
}

/* Responsive */

@media (min-width: 768px) {
	.page-header {
		align-items: center;
		flex-direction: row;
		justify-content: space-between;
	}

	.list-card__meta,
	.history-card__meta {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
