:root {
	--bg: #faf9f6;
	--fg: #1c1a17;
	--muted: #6b675f;
	--border: #ddd8cf;
	--accent: #6b4f2a;
	--accent-fg: #fff;
	--danger: #a3392b;
	--surface: #fff;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #17150f;
		--fg: #ece7dd;
		--muted: #a39d8f;
		--border: #38342a;
		--accent: #c9a86a;
		--accent-fg: #1c1a17;
		--danger: #e0685a;
		--surface: #221f18;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: var(--bg);
	color: var(--fg);
	padding-bottom: 5rem;
}

h1,
h2 {
	font-weight: 600;
}

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem;
	border-bottom: 1px solid var(--border);
}

.topbar h1 {
	margin: 0;
	font-size: 1.25rem;
}

.tabs {
	display: flex;
	border-bottom: 1px solid var(--border);
}

.tab {
	flex: 1;
	padding: 0.75rem;
	background: none;
	border: none;
	color: var(--muted);
	font-size: 0.95rem;
}

.tab.active {
	color: var(--fg);
	border-bottom: 2px solid var(--accent);
	font-weight: 600;
}

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

.toolbar {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

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

.warning {
	color: var(--danger);
	font-size: 0.85rem;
}

.error {
	color: var(--danger);
	font-size: 0.9rem;
}

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

.book-list li,
.shelf-list li {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.65rem 0;
	border-bottom: 1px solid var(--border);
}

.book-list button.row,
.shelf-list button.row {
	flex: 1;
	text-align: left;
	background: none;
	border: none;
	color: inherit;
	font-size: 0.95rem;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.book-list .call-number {
	font-family: ui-monospace, monospace;
	font-size: 0.8rem;
	color: var(--accent);
}

.book-list .book-authors {
	color: var(--muted);
	font-size: 0.85rem;
}

.shelf-list .row-buttons {
	display: flex;
	gap: 0.25rem;
}

button {
	font-size: 1rem;
	padding: 0.55rem 0.9rem;
	border-radius: 0.5rem;
	border: 1px solid var(--accent);
	background: var(--accent);
	color: var(--accent-fg);
}

button.ghost {
	background: none;
	color: var(--fg);
	border-color: var(--border);
}

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

button.icon {
	padding: 0.3rem 0.55rem;
	font-size: 0.9rem;
}

input,
select,
textarea {
	font-size: 1rem;
	padding: 0.5rem;
	border-radius: 0.4rem;
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--fg);
	width: 100%;
}

.inline-form {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

#edit-form label {
	display: block;
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 0.75rem;
}

#edit-form input,
#edit-form select,
#edit-form textarea {
	margin-top: 0.25rem;
	color: var(--fg);
	font-size: 1rem;
}

.fab {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	width: 3.25rem;
	height: 3.25rem;
	border-radius: 50%;
	font-size: 1.75rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.sheet-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	display: flex;
	align-items: flex-end;
	z-index: 10;
}

.sheet-backdrop[hidden] {
	display: none;
}

.sheet-backdrop .sheet {
	background: var(--surface);
	color: var(--fg);
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	border-radius: 1rem 1rem 0 0;
	padding: 1.25rem;
}

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

.sheet-actions.vertical {
	flex-direction: column;
}

#scan-video {
	width: 100%;
	border-radius: 0.5rem;
	background: #000;
}

.login-body {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
}

.login-card {
	width: 100%;
	max-width: 22rem;
	padding: 1.5rem;
}

.login-card label {
	display: block;
	margin-bottom: 1rem;
	color: var(--muted);
	font-size: 0.9rem;
}

.login-card button {
	width: 100%;
}
