:root {
  color-scheme: light;
  --ink: #15251d;
  --muted: #65746c;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --line: #d8d5cc;
  --accent: #246b4c;
  --accent-dark: #174b35;
  --danger: #a23d32;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, #dce8db 0, transparent 32rem),
    var(--paper);
  color: var(--ink);
}
main { width: min(760px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 64px; }
header, .brand, .section-heading, .copy-row, .item-main, .item-actions {
  display: flex;
  align-items: center;
}
header { justify-content: space-between; margin-bottom: 22px; }
.brand { gap: 12px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-family: Georgia, serif; font-size: 1.6rem; }
h2 { margin-bottom: 6px; font-family: Georgia, serif; }
p { color: var(--muted); line-height: 1.45; }
.brand p, .section-heading p { margin-bottom: 0; font-size: .9rem; }
.card {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 12px 40px rgb(25 44 34 / 7%);
}
.login-card { max-width: 480px; margin: 10vh auto 0; }
label { display: block; margin-bottom: 7px; font-size: .84rem; font-weight: 700; }
input, select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
}
#item-category { margin-bottom: 12px; }
button {
  padding: 11px 15px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: .55; cursor: wait; }
button.quiet { border: 1px solid var(--line); background: transparent; color: var(--ink); }
button.danger { background: transparent; color: var(--danger); padding: 8px; }
form button[type="submit"] { margin-top: 12px; width: 100%; }
.drop-zone {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 20px;
  border: 2px dashed #91a399;
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
}
.drop-zone.dragging { border-color: var(--accent); background: #edf6ef; }
.drop-title { font-weight: 800; }
.drop-subtitle { margin-top: 5px; color: var(--muted); font-size: .84rem; }
#book-files { position: absolute; width: 1px; height: 1px; opacity: 0; }
.section-heading { justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.item-main { min-width: 0; gap: 11px; }
.item-main > div { min-width: 0; }
.item-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--muted); font-size: .8rem; }
.badge { padding: 4px 7px; border-radius: 999px; background: #e2eee5; font-size: .72rem; white-space: nowrap; }
.badge.paper { background: #e4e9f6; color: #263b70; }
.inline-form { display: flex; align-items: center; gap: 10px; }
.inline-form button[type="submit"] { width: auto; margin: 0; white-space: nowrap; }
.secret-box { margin: 16px 0; padding: 16px; border-radius: 12px; background: #edf6ef; }
.secret-box p { margin-bottom: 12px; }
.copy-row { gap: 8px; margin-bottom: 10px; }
.copy-row code { flex: 1; overflow-wrap: anywhere; padding: 10px; border-radius: 8px; background: white; }
.copy-row button { padding: 9px; }
.progress { margin-top: 16px; }
.progress > div { display: flex; justify-content: space-between; font-size: .85rem; }
progress { width: 100%; accent-color: var(--accent); }
.empty { padding: 20px 0; color: var(--muted); text-align: center; }
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 36px));
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
#toast.visible { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

@media (max-width: 560px) {
  main { width: min(100% - 20px, 760px); padding-top: 14px; }
  .card { padding: 17px; border-radius: 14px; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form button[type="submit"] { width: 100%; }
  .item-list li { align-items: flex-start; }
}
