:root {
	--bg: #f7f4ea;
	--bg-accent: #e6f3ee;
	--surface: rgba(255, 255, 255, 0.86);
	--surface-strong: rgba(255, 255, 255, 0.96);
	--text: #111827;
	--muted: #5b6475;
	--line: rgba(17, 24, 39, 0.12);
	--line-soft: rgba(17, 24, 39, 0.07);
	--focus: #0f766e;
	--danger: #b91c1c;
	--accent: #f97316;
	--shadow: 0 20px 46px rgba(17, 24, 39, 0.12);
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	font-family: "Space Grotesk", "Segoe UI", sans-serif;
	color: var(--text);
	background:
		radial-gradient(980px 520px at 0% -10%, rgba(249, 115, 22, 0.2), transparent 60%),
		radial-gradient(1040px 620px at 100% 0%, rgba(15, 118, 110, 0.2), transparent 60%),
		linear-gradient(180deg, var(--bg), var(--bg-accent));
}

.trip-app {
	max-width: 1220px;
	margin: 0 auto;
	padding: 24px 18px 46px;
	display: grid;
	gap: 18px;
}

.hero {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
	padding: 4px 2px;
}

.hero-kicker {
	margin: 0;
	font-size: 12px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--muted);
}

.hero h1 {
	margin: 2px 0 4px;
	font-family: "Fraunces", Georgia, serif;
	font-size: clamp(2rem, 6vw, 2.8rem);
	line-height: 1.05;
}

.hero-subtitle {
	margin: 0;
	max-width: 660px;
	font-size: 15px;
	color: var(--muted);
}

.hero-links {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.nav-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 14px;
	border-radius: 999px;
	border: 1px solid rgba(17, 24, 39, 0.14);
	background: var(--surface);
	text-decoration: none;
	color: var(--text);
	font-weight: 600;
	font-size: 14px;
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.nav-link:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 26px rgba(17, 24, 39, 0.16);
}

.card {
	background: var(--surface);
	border: 1px solid var(--line-soft);
	border-radius: 20px;
	padding: 16px;
	box-shadow: var(--shadow);
	backdrop-filter: blur(6px);
}

.meta-card {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
}

.field {
	display: grid;
	gap: 6px;
}

label {
	font-size: 12px;
	font-weight: 700;
	color: var(--muted);
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

input,
select,
button {
	font: inherit;
}

input,
select {
	width: 100%;
	padding: 10px 11px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: var(--surface-strong);
	outline: none;
}

input:focus,
select:focus,
.picker-summary:focus {
	border-color: rgba(15, 118, 110, 0.58);
	box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

input.input-error {
	border-color: rgba(185, 28, 28, 0.58);
	box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
}

.compose-card {
	display: grid;
	gap: 12px;
}

.compose-header {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: baseline;
	flex-wrap: wrap;
}

.compose-header h2,
.section-header h2 {
	margin: 0;
	font-size: 20px;
}

.compose-header p,
.section-header p {
	margin: 0;
	font-size: 13px;
	color: var(--muted);
}

.compose-grid {
	display: grid;
	grid-template-columns: 1.3fr 180px 1fr 150px;
	gap: 10px;
	align-items: end;
}

.primary-btn {
	height: 44px;
	border: 0;
	border-radius: 14px;
	cursor: pointer;
	font-weight: 700;
	background: linear-gradient(120deg, var(--focus), #1d9f8f);
	color: #fff;
	transition: transform 140ms ease, filter 140ms ease;
}

.primary-btn:hover {
	transform: translateY(-1px);
	filter: brightness(1.03);
}

.error-text {
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--danger);
	min-height: 18px;
}

.content-grid {
	display: grid;
	grid-template-columns: 1.8fr 1fr;
	gap: 16px;
	align-items: start;
}

.expenses-card,
.totals-card {
	display: grid;
	gap: 12px;
}

.section-header {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	align-items: baseline;
	flex-wrap: wrap;
}

.expense-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 10px;
}

.expense-row {
	border: 1px solid var(--line-soft);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.74);
	padding: 12px;
	display: grid;
	gap: 10px;
	position: relative;
	z-index: 0;
	animation: row-enter 220ms ease both;
}

.expense-row:has(.person-picker[open]) {
	z-index: 30;
}

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

.expense-top {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	align-items: flex-start;
}

.expense-title {
	font-weight: 700;
	font-size: 16px;
}

.expense-sub {
	font-size: 13px;
	color: var(--muted);
	margin-top: 3px;
}

.row-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.ghost-btn,
.danger-btn,
.inline-add-btn {
	border: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.88);
	border-radius: 10px;
	padding: 7px 10px;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
}

.inline-add-btn {
	border-radius: 9px;
	white-space: nowrap;
}

.danger-btn {
	color: var(--danger);
	border-color: rgba(185, 28, 28, 0.26);
}

.share-strip {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.share-chip {
	font-size: 12px;
	font-weight: 600;
	border-radius: 999px;
	padding: 5px 10px;
	background: rgba(15, 118, 110, 0.11);
	color: #0f3f3a;
}

.share-chip.empty {
	background: rgba(185, 28, 28, 0.1);
	color: #7f1d1d;
}

.grand-total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 10px 2px 6px;
	border-bottom: 1px solid var(--line-soft);
}

.grand-total span {
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
}

.grand-total strong {
	font-size: 30px;
	font-family: "Fraunces", Georgia, serif;
}

.person-total-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 8px;
}

.person-total-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px dashed var(--line-soft);
}

.person-name {
	font-weight: 700;
}

.person-total {
	font-weight: 700;
}

.person-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.empty-state {
	padding: 22px;
	text-align: center;
	font-size: 14px;
	color: var(--muted);
	border: 1px dashed var(--line);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.54);
}

.person-picker {
	position: relative;
}

.person-picker[open] .picker-summary {
	border-color: rgba(15, 118, 110, 0.58);
	box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.picker-summary {
	list-style: none;
	padding: 10px 11px;
	border-radius: 12px;
	border: 1px solid var(--line);
	background: var(--surface-strong);
	font-size: 14px;
	cursor: pointer;
	font-weight: 600;
}

.picker-summary::-webkit-details-marker {
	display: none;
}

.picker-summary::after {
	content: "▾";
	float: right;
	font-size: 12px;
	color: var(--muted);
}

.picker-menu {
	position: absolute;
	z-index: 15;
	left: 0;
	right: 0;
	margin-top: 6px;
	padding: 10px;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: var(--surface-strong);
	box-shadow: 0 20px 28px rgba(17, 24, 39, 0.18);
	display: grid;
	gap: 8px;
}

.picker-list {
	display: grid;
	gap: 6px;
	max-height: 180px;
	overflow: auto;
	padding-right: 2px;
}

.picker-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px;
	border-radius: 8px;
}

.picker-option:hover {
	background: rgba(15, 118, 110, 0.08);
}

.picker-option input {
	width: 16px;
	height: 16px;
	margin: 0;
}

.picker-empty {
	margin: 0;
	font-size: 13px;
	color: var(--muted);
}

.picker-add {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
}

.compact-picker {
	min-width: 210px;
}

.compact-picker .picker-summary {
	padding: 8px 10px;
	font-size: 13px;
}

.compact-picker .picker-menu {
	min-width: 240px;
	right: auto;
}

@media (max-width: 1020px) {
	.meta-card {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.compose-grid {
		grid-template-columns: 1fr 170px;
	}

	.picker-field {
		grid-column: 1 / -1;
	}

	.primary-btn {
		grid-column: 1 / -1;
	}

	.content-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.trip-app {
		padding: 18px 12px 34px;
	}

	.hero {
		flex-direction: column;
	}

	.hero-links {
		justify-content: flex-start;
	}

	.meta-card {
		grid-template-columns: 1fr;
	}

	.compose-grid {
		grid-template-columns: 1fr;
	}

	.row-controls {
		width: 100%;
		justify-content: space-between;
	}

	.compact-picker {
		min-width: 0;
		width: 100%;
	}

	.compact-picker .picker-menu {
		right: 0;
		left: 0;
		min-width: 0;
	}
}
