* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Roboto, "Segoe UI", Arial, sans-serif;
  background: #f4f3ef;
  color: #2a2a2a;
  padding-bottom: 80px; /* room for sticky bottom bar */
}
.container { max-width: 480px; margin: 0 auto; padding: 12px; }

/* Top bar */
.topbar {
  background: #2f5233;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar a { color: #fff; text-decoration: none; font-size: 14px; }
.topbar h1 { font-size: 18px; margin: 0; }

/* Big tappable inputs/buttons for mobile */
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  padding: 12px;
  margin: 6px 0 14px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
}
label { font-size: 13px; font-weight: 600; color: #555; display:block; }

button, .btn {
  display: inline-block;
  font-size: 16px;
  padding: 14px 18px;
  border-radius: 10px;
  border: none;
  background: #2f5233;
  color: #fff;
  text-align: center;
  text-decoration: none;
  width: 100%;
  margin: 6px 0;
  cursor: pointer;
}
.btn-secondary { background: #6b6b6b; }
.btn-danger { background: #a13a2e; }
.btn-outline { background: #fff; color: #2f5233; border: 2px solid #2f5233; }
.btn-row { display: flex; gap: 8px; }
.btn-row button, .btn-row .btn { flex: 1; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.thumb-row { display: flex; gap: 10px; margin-bottom: 10px; }
.thumb-box {
  flex: 1;
  border: 2px dashed #bbb;
  border-radius: 10px;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  color: #777;
  position: relative;
  overflow: hidden;
  min-height: 90px;
}
.thumb-box img { width: 100%; border-radius: 6px; display:block; }
.thumb-box input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-available { background: #e1f0e1; color: #2f5233; }
.status-loaned { background: #fff2cc; color: #8a6d00; }
.status-sold { background: #f0d9d6; color: #8a2e1f; }

.book-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  text-decoration: none;
  color: inherit;
}
.book-row img {
  width: 50px; height: 70px; object-fit: cover; border-radius: 4px; background: #ddd;
}
.book-row .meta { flex: 1; }
.book-row .title { font-weight: 600; font-size: 15px; }
.book-row .author { font-size: 13px; color: #666; }

.progress {
  font-size: 13px;
  color: #2f5233;
  margin: 6px 0;
  min-height: 18px;
}

.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  padding: 10px 16px;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
  z-index: 20;
}
.bottom-bar .container { padding: 0; max-width: 480px; }

.empty-state { text-align: center; color: #888; padding: 40px 20px; }
.small-note { font-size: 12px; color: #888; margin-top: 6px; margin-bottom: 12px; }
/* Pull tighter specifically when directly following a form field — the
   original intended use (e.g. a note right under a search box). Using a
   plain positive margin by default (above) prevents it from overlapping
   text when it follows something else, like a <label> with no input. */
input + .small-note, textarea + .small-note, select + .small-note {
  margin-top: -8px;
}

/* Show/hide password toggle */
.password-wrap { position: relative; margin: 6px 0 14px 0; }
.password-wrap input { margin: 0; padding-right: 44px; }
.eye-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  background: none;
  border: none;
  padding: 6px 8px;
  margin: 0;
  font-size: 18px;
  line-height: 1;
  color: #777;
  cursor: pointer;
}

/* Compact "Gallery" button under a cover thumbnail — replaces the old
   full-width Take Photo / Gallery button pair */
.btn-sm {
  display: block;
  width: auto;
  margin: 6px auto 0;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 20px;
}
.thumb-box { cursor: pointer; }

/* Click-to-enlarge cover photo */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #2a2a2a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  margin: 0;
  padding: 0;
}
