:root {
	--background: #17171b;
	--text: #ececf0;
	--muted: #9a9aa5;
	--line: #2c2c33;
	--chip: #26262d;
	--accent: #6d9cf0;
	--accent-text: #0d0d10;
	--done: #5cc08a;
	font-family: system-ui, sans-serif;
	font-size: 17px;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--background);
	color: var(--text);
	-webkit-tap-highlight-color: transparent;
}

header {
	position: sticky;
	top: 0;
	z-index: 1;
	padding: 0.6rem 1rem;
	background: var(--background);
	border-bottom: 1px solid var(--line);
}

header > * {
	max-width: 38rem;
	margin: 0 auto;
}

header .top {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

h1 {
	flex: 1;
	margin: 0;
	font-size: 1.2rem;
}

#actions {
	display: flex;
	gap: 0.4rem;
}

#actions button {
	border-radius: 2rem;
	padding: 0.3rem 0.8rem;
}

#actions button[aria-pressed="true"] {
	background: var(--accent);
	color: var(--accent-text);
}

#bar .chips {
	margin: 0.5rem auto 0;
}

#status {
	color: var(--muted);
	font-size: 0.85rem;
}

main {
	max-width: 40rem;
	margin: 0 auto;
	padding: 0.5rem 1rem 6rem;
}

h2 {
	margin: 1.2rem 0 0.3rem;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--muted);
}

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

button {
	font: inherit;
	color: inherit;
	background: var(--chip);
	border: 0;
	border-radius: 0.5rem;
	padding: 0.5rem 0.8rem;
	cursor: pointer;
}

button:disabled {
	opacity: 0.4;
}

button.primary {
	background: var(--accent);
	color: var(--accent-text);
	font-weight: 600;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.5rem 0;
}

.chips button {
	border-radius: 2rem;
	padding: 0.35rem 0.8rem;
}

.chips button[aria-pressed="true"] {
	background: var(--accent);
	color: var(--accent-text);
}

.chips small {
	opacity: 0.75;
}

.line {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: 0.3rem 0;
	border-bottom: 1px solid var(--line);
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
}

.line.sub {
	padding-left: 1.2rem;
}

/* On a wide screen, the lists flow into columns, a section never split across two. */
@media (min-width: 52rem) {
	body:is([data-screen="pack"], [data-screen="departure"]) :is(main, header > *) {
		max-width: 80rem;
	}

	body[data-screen="pack"] main,
	body[data-screen="departure"] main > ul {
		columns: 18rem;
		column-gap: 2.5rem;
	}

	section,
	.line {
		break-inside: avoid;
	}
}

.line .box {
	flex: none;
	display: grid;
	place-items: center;
	width: 1.4rem;
	height: 1.4rem;
	border: 2px solid var(--muted);
	border-radius: 0.35rem;
	font-size: 0.9rem;
	font-weight: 700;
}

.line .name {
	flex: 1;
}

.line .quantity {
	font-weight: 600;
}

.line .bag {
	color: var(--muted);
	font-size: 0.85rem;
}

.line.ticked .box {
	background: var(--done);
	border-color: var(--done);
	color: var(--background);
}

.line.ticked .name {
	color: var(--muted);
	text-decoration: line-through;
}

.line.out {
	opacity: 0.45;
	font-style: italic;
}

.empty,
.note {
	color: var(--muted);
}

.errors li {
	padding: 0.3rem 0;
	font-family: ui-monospace, monospace;
	font-size: 0.85rem;
}

.nights {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	margin: 0.5rem 0;
}

.nights button {
	width: 2.5rem;
}

nav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	background: var(--background);
	border-top: 1px solid var(--line);
}

nav button {
	flex: 1;
	padding: 0.9rem 0;
	border-radius: 0;
	background: none;
	color: var(--muted);
}

nav button[aria-current="page"] {
	color: var(--accent);
	font-weight: 600;
}

#notice {
	position: fixed;
	left: 1rem;
	right: 1rem;
	bottom: 4.2rem;
	max-width: 38rem;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 0.8rem;
	padding: 0.7rem 1rem;
	border-radius: 0.6rem;
	background: var(--text);
	color: var(--background);
}

#notice span {
	flex: 1;
}

#notice button {
	background: none;
	color: var(--accent);
	font-weight: 600;
	padding: 0.2rem 0.4rem;
}

#notice[hidden] {
	display: none;
}

dialog {
	width: min(26rem, calc(100% - 2rem));
	border: 0;
	border-radius: 0.8rem;
	background: var(--background);
	color: var(--text);
}

dialog::backdrop {
	background: rgb(0 0 0 / 0.4);
}

dialog h2 {
	margin-top: 0;
}

dialog label {
	display: grid;
	gap: 0.2rem;
	margin: 0.7rem 0;
	color: var(--muted);
	font-size: 0.85rem;
}

dialog input,
dialog select {
	font: inherit;
	font-size: 1rem;
	padding: 0.5rem;
	color: var(--text);
	background: var(--chip);
	border: 1px solid var(--line);
	border-radius: 0.4rem;
}

dialog .actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-top: 1rem;
}
