:root {
  color-scheme: light;
  --paper: #f4f7f3;
  --surface: #fff;
  --ink: #192522;
  --muted: #465750;
  --line: #cddbd0;
  --accent: #155d3f;
  --accent-dark: #104b33;
  --danger: #9c2626;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
::selection { background: #c9e6d5; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 0.2em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2.25rem; line-height: 1.12; letter-spacing: -0.03em; }
h2 { font-size: 1.25rem; }
p { line-height: 1.5; }
button, input { font: inherit; }
button, .header-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
button {
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: .55rem .9rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: .65; cursor: wait; }
.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
.secondary:hover { background: #e9f1e9; }
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-content, main {
  width: min(100% - 2rem, 68rem);
  margin-inline: auto;
}
.header-content {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .25rem 1rem;
  flex-wrap: wrap;
  padding-block: .5rem;
}
.brand { font-weight: 750; font-size: 1.18rem; text-decoration: none; color: var(--ink); }
.header-actions { display: flex; gap: .25rem 1rem; align-items: center; flex-wrap: wrap; }
.header-actions a { font-weight: 600; }
main { padding: clamp(1.5rem, 6vw, 3.75rem) 0 3rem; }
main.narrow { max-width: 27rem; }
.muted { color: var(--muted); }
.edition { margin-top: .5rem; }
.stack { display: grid; gap: 1rem; }
form.panel { margin-top: 1.25rem; }
.admin-layout > form.panel { margin-top: 0; }
.panel { padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.field { display: grid; gap: .4rem; }
label, legend { font-weight: 650; }
input {
  width: 100%;
  min-height: 44px;
  padding: .55rem .7rem;
  border: 1px solid #839589;
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
}
.feedback { color: var(--muted); }
.feedback:empty { display: none; }
.feedback[data-error="true"] { color: var(--danger); }
.shelf {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.75rem;
}
.levels { display: grid; gap: .5rem; align-content: start; }
.levels h2 { margin-bottom: .35rem; }
.levels button { justify-content: flex-start; text-align: left; }
.levels button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: transparent; }
.book-list, .user-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.book-list { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.book-link {
  display: grid;
  gap: .85rem;
  justify-items: start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--accent);
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
}
.book-link:hover { border-color: var(--accent); text-decoration: underline; }
.book-link img { width: 115px; height: 152px; object-fit: contain; object-position: left bottom; }
.admin-layout {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: minmax(16rem, 21rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.user-list { margin-block: .75rem 0; }
.user-list li { padding-block: .85rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.user-row { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: .65rem; }
.user-buttons { display: flex; flex-wrap: wrap; gap: .45rem; }
.reset-form { margin-top: .75rem; }
@media (max-width: 700px) {
  .shelf, .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .levels { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
  .levels h2 { grid-column: 1 / -1; }
  h1 { font-size: 1.9rem; }
}
