:root {
  --wood-darkest: #160e09;
  --wood-dark: #251710;
  --wood-mid: #3a2418;
  --wood-light: #543524;
  --wood-ledge: #69422c;
  --hunter-green: #162e26;
  --hunter-mid: #1f4035;
  --hunter-light: #2d594a;
  --gold: #d4af37;
  --gold-bright: #efd07b;
  --gold-dim: #9a7b2c;
  --parchment: #f5ebd6;
  --parchment-dark: #e6d7b8;
  --parchment-edge: #cfbda0;
  --ink-dark: #231912;
  --ink-muted: #5c4938;
  --crimson: #8c2d25;
  --crimson-light: #f9e5e3;
  --emerald-ok: #1f5c3f;
  --emerald-bg: #dfeee6;
  --amber-soon: #8a5311;
  --amber-bg: #fdf0d5;
  --gray-none: #5c5349;
  --gray-bg: #e8e0d2;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "PMingLiU", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--wood-darkest);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.12), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0px, rgba(255, 255, 255, 0.015) 2px, transparent 2px, transparent 9px),
    linear-gradient(180deg, #1b110b 0%, #120b07 100%);
  color: var(--parchment);
  font-family: var(--font-serif);
  min-height: 100vh;
  line-height: 1.6;
  padding-bottom: 64px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 12px;
}

/* ================= HEADER PLAQUE ================= */
.library-header {
  background: linear-gradient(135deg, var(--hunter-green) 0%, #10221c 100%);
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  padding: 16px 14px 14px;
  position: relative;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), inset 0 0 0 3px rgba(212, 175, 55, 0.18);
  text-align: center;
  margin-bottom: 16px;
}

.library-header::before,
.library-header::after {
  content: "❖";
  position: absolute;
  top: 8px;
  color: var(--gold);
  font-size: 13px;
  opacity: 0.8;
}
.library-header::before {
  left: 10px;
}
.library-header::after {
  right: 10px;
}

.brass-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 2px 10px;
  background: rgba(0, 0, 0, 0.25);
  margin-bottom: 6px;
  max-width: 100%;
}

.library-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  margin-bottom: 4px;
}

.library-subtitle {
  font-size: 12px;
  color: var(--parchment-dark);
  opacity: 0.88;
  font-family: var(--font-sans);
}

.header-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

/* ================= BUTTONS ================= */
.btn-gold {
  background: linear-gradient(135deg, #d8b23c 0%, #a37e1f 100%);
  color: #160e09;
  border: 1px solid var(--gold-bright);
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: filter 0.18s ease, transform 0.18s ease;
}
.btn-gold:hover:not(:disabled) {
  filter: brightness(1.08);
}
.btn-gold:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-hunter {
  background: linear-gradient(135deg, var(--hunter-light) 0%, var(--hunter-green) 100%);
  color: var(--gold-bright);
  border: 1.5px solid var(--gold);
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: filter 0.18s ease;
}
.btn-hunter:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-hunter:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-wood-ghost {
  background: rgba(22, 14, 9, 0.5);
  color: var(--parchment-dark);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 4px;
  padding: 7px 12px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-wood-ghost:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

.btn-ink-outline {
  background: #fffdf7;
  color: var(--ink-dark);
  border: 1.5px solid var(--gold-dim);
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn-ink-outline:hover {
  background: #f6ebd4;
  border-color: var(--hunter-green);
}

.btn-crimson {
  background: linear-gradient(135deg, #a1352c 0%, #78221b 100%);
  color: #fff5f5;
  border: 1.5px solid #d9827b;
  border-radius: 4px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn-crimson:hover {
  filter: brightness(1.08);
}

/* Floating Action Button */
.fab-add-btn {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 30;
  background: linear-gradient(135deg, #e0bb43 0%, #a8821f 100%);
  color: #160e09;
  border: 2px solid #fff1be;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.75);
}
.fab-add-btn:hover {
  filter: brightness(1.08);
}
/* 手机上缩成圆形「＋」，别挡住书架上的书 */
@media (max-width: 640px) {
  .fab-add-btn {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
  }
  .fab-add-btn .fab-label {
    display: none;
  }
}

/* ================= 1. LOGIN VIEW (LIBRARY CARD) ================= */
.login-card-wrap {
  max-width: 440px;
  margin: 18px auto 0;
}

.borrower-card {
  background: var(--parchment);
  color: var(--ink-dark);
  border: 3px solid var(--gold-dim);
  border-radius: 8px;
  padding: 22px 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8), inset 0 0 24px rgba(138, 104, 62, 0.2);
  position: relative;
}

.borrower-card-inner {
  border: 2px double var(--gold-dim);
  padding: 18px 14px;
  background: rgba(255, 252, 244, 0.65);
}

.borrower-stamp {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--hunter-green);
  border: 1.5px solid var(--hunter-green);
  padding: 2px 9px;
  font-weight: 700;
  margin-bottom: 8px;
}

.borrower-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-dark);
  margin-bottom: 4px;
}

.borrower-desc {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.login-error-box {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--crimson-light);
  color: var(--crimson);
  border: 1px solid #deb0ab;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
}

/* ================= 2. HOME VIEW: SEARCH & FILTER DESK ================= */
.catalog-desk {
  background: linear-gradient(180deg, var(--wood-mid) 0%, var(--wood-dark) 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.search-box-wrap {
  position: relative;
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  background: var(--parchment);
  color: var(--ink-dark);
  border: 2px solid var(--gold-dim);
  border-radius: 4px;
  padding: 9px 34px 9px 36px;
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  box-shadow: inset 0 2px 5px rgba(35, 25, 18, 0.2);
}
.search-input:focus {
  border-color: var(--gold-bright);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-muted);
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.category-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-plaque {
  background: rgba(22, 14, 9, 0.65);
  color: var(--parchment-dark);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font-serif);
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s;
}

.cat-plaque .cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.cat-plaque.active {
  background: linear-gradient(135deg, #c69f2e 0%, #9b781e 100%);
  color: #160e09;
  border-color: var(--gold-bright);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.3);
}

/* ================= WOODEN BOOKSHELF CASE ================= */
.bookcase-frame {
  background: #1a100a;
  border: 3px solid #482d1e;
  border-radius: 8px;
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.8),
    inset 0 0 0 2px rgba(212, 175, 55, 0.22);
  padding: 14px 10px 18px;
  position: relative;
}

.bookcase-top-crown {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  padding-bottom: 10px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--gold-bright);
}

.shelf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--parchment-dark);
}
.shelf-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.ok {
  background: #2f855a;
}
.legend-dot.soon {
  background: #d69e2e;
}
.legend-dot.expired {
  background: #a63a32;
}
.legend-dot.none {
  background: #78716c;
}

.shelf-tier {
  position: relative;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, rgba(28, 17, 11, 0.2) 30%, rgba(0, 0, 0, 0.5) 100%),
    repeating-linear-gradient(90deg, #24160e 0px, #24160e 40px, #1f130c 40px, #1f130c 80px);
  padding: 16px 6px 0;
  border-left: 4px solid #3a2317;
  border-right: 4px solid #3a2317;
  box-shadow: inset 0 12px 20px rgba(0, 0, 0, 0.7);
  margin-bottom: 20px;
}
.shelf-tier:last-child {
  margin-bottom: 4px;
}

.shelf-books-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  min-height: 222px;
  padding: 0 2px;
}

.shelf-plank {
  height: 22px;
  margin: 0 -6px;
  background: linear-gradient(180deg, #6e452e 0%, #4d2f1e 45%, #2f1b10 100%);
  border-top: 2px solid #8c5b3e;
  border-bottom: 3px solid #160c07;
  border-radius: 2px;
  position: relative;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.brass-nameplate {
  background: linear-gradient(90deg, #a68125 0%, #e7c96b 50%, #9e7920 100%);
  color: #1d1209;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-sans);
  padding: 1px 10px;
  border-radius: 2px;
  border: 1px solid #59410c;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Individual Hardcover Book Spine */
.book-spine {
  position: relative;
  min-width: 0;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px 4px 2px 2px;
  padding: 10px 3px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: var(--parchment);
  box-shadow:
    -3px 0 6px rgba(0, 0, 0, 0.65),
    3px 0 6px rgba(0, 0, 0, 0.5),
    inset 3px 0 5px rgba(255, 255, 255, 0.14),
    inset -4px 0 7px rgba(0, 0, 0, 0.45);
  border-top: 2px solid rgba(255, 235, 180, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.book-spine:hover,
.book-spine:focus {
  transform: translateY(-8px);
  box-shadow:
    0 12px 20px rgba(0, 0, 0, 0.8),
    inset 3px 0 6px rgba(255, 255, 255, 0.25),
    0 0 0 1.5px var(--gold-bright);
  z-index: 3;
}

.book-spine::before,
.book-spine::after {
  content: "";
  width: 86%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  display: block;
  opacity: 0.85;
  flex-shrink: 0;
}

/* Category Colors for Book Cloth */
.book-cat-厨房电器 {
  background: linear-gradient(90deg, #4f1816 0%, #6b221f 48%, #421311 100%);
  min-height: 214px;
}
.book-cat-个人护理 {
  background: linear-gradient(90deg, #163b30 0%, #205243 48%, #112e25 100%);
  min-height: 204px;
}
.book-cat-数码 {
  background: linear-gradient(90deg, #1a2a47 0%, #263d66 48%, #132038 100%);
  min-height: 218px;
}
.book-cat-家居清洁 {
  background: linear-gradient(90deg, #543717 0%, #704b21 48%, #3f2910 100%);
  min-height: 222px;
}
.book-cat-其他 {
  background: linear-gradient(90deg, #3c233d 0%, #543257 48%, #2d192e 100%);
  min-height: 208px;
}

/* Warranty Ribbon Bookmark at top of spine */
.warranty-ribbon {
  position: absolute;
  top: -4px;
  right: 5px;
  width: 11px;
  height: 16px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}
.warranty-ribbon.ok {
  background: linear-gradient(180deg, #3fb97a, #1f6b45);
}
.warranty-ribbon.soon {
  background: linear-gradient(180deg, #f3c65f, #b57c14);
}
.warranty-ribbon.expired {
  background: linear-gradient(180deg, #c2463c, #731d17);
}
.warranty-ribbon.none {
  background: linear-gradient(180deg, #8c8277, #575049);
}

.spine-cat-code {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--gold-bright);
  letter-spacing: 0.5px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
  margin-top: 3px;
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.spine-title-vertical {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1.2;
  color: #fff6df;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  margin: 6px 0;
  padding: 5px 2px;
  max-height: 112px;
  overflow: hidden;
  border-top: 1px dotted rgba(212, 175, 55, 0.4);
  border-bottom: 1px dotted rgba(212, 175, 55, 0.4);
}

.spine-title-vertical.spine-title-long {
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 4px 1px;
}

.spine-footer {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.spine-brand {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--parchment-dark);
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

.spine-warranty-tag {
  font-family: var(--font-sans);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 2px;
  margin-top: 3px;
  margin-bottom: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spine-warranty-tag.ok {
  background: rgba(45, 110, 78, 0.82);
  color: #d7f7e5;
  border: 1px solid rgba(154, 230, 180, 0.45);
}
.spine-warranty-tag.soon {
  background: rgba(168, 108, 20, 0.85);
  color: #fff3d1;
  border: 1px solid rgba(246, 201, 105, 0.5);
}
.spine-warranty-tag.expired {
  background: rgba(140, 45, 37, 0.82);
  color: #ffd7d5;
  border: 1px solid rgba(254, 178, 178, 0.45);
}
.spine-warranty-tag.none {
  background: rgba(75, 68, 60, 0.78);
  color: #dfd7cb;
  border: 1px solid rgba(180, 170, 158, 0.38);
}

/* Empty Shelf State */
.empty-shelf-box {
  text-align: center;
  padding: 28px 14px 22px;
  color: var(--parchment-dark);
}
.empty-shelf-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.empty-shelf-desc {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--parchment-dark);
  opacity: 0.88;
  margin-bottom: 16px;
}

/* ================= CATALOG LEDGER INDEX CARDS ================= */
.catalog-ledger-card {
  margin-top: 18px;
  background: var(--parchment);
  color: var(--ink-dark);
  border-radius: 6px;
  border: 2px solid var(--gold-dim);
  padding: 14px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.ledger-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-bottom: 2px double var(--ink-muted);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.ledger-header h3 {
  font-size: 15px;
  color: var(--ink-dark);
}

.ledger-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--parchment-edge);
  border-radius: 4px;
  cursor: pointer;
  gap: 8px;
  min-width: 0;
}
.ledger-row:hover {
  background: #fff9ec;
  border-color: var(--gold-dim);
}

.ledger-row-main {
  min-width: 0;
  flex: 1;
}
.ledger-row-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-dark);
  word-break: break-word;
}
.ledger-row-sub {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-muted);
  word-break: break-word;
}

/* Warranty Pills & Badges */
.warranty-pill,
.wax-seal-badge {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wax-seal-badge {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 4px;
}
.warranty-pill.ok,
.wax-seal-badge.ok {
  background: var(--emerald-bg);
  color: var(--emerald-ok);
  border: 1px solid #86bf9f;
}
.warranty-pill.soon,
.wax-seal-badge.soon {
  background: var(--amber-bg);
  color: var(--amber-soon);
  border: 1px solid #deb871;
}
.warranty-pill.expired,
.wax-seal-badge.expired {
  background: var(--crimson-light);
  color: var(--crimson);
  border: 1px solid #deb0ab;
}
.warranty-pill.none,
.wax-seal-badge.none {
  background: var(--gray-bg);
  color: var(--gray-none);
  border: 1px solid #bfb5a6;
}

/* ================= 3. DETAIL VIEW: OPEN HARDCOVER BOOK ================= */
.open-book-wrapper {
  background: linear-gradient(135deg, #2d1b11 0%, #1d110a 100%);
  border: 3px solid var(--gold-dim);
  border-radius: 8px;
  padding: 12px 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.85);
}

.view-topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.parchment-spread {
  background: var(--parchment);
  color: var(--ink-dark);
  border-radius: 4px;
  border: 1px solid #c5b08e;
  box-shadow:
    inset 0 0 28px rgba(138, 104, 62, 0.22),
    0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 16px 12px;
  position: relative;
}

.ex-libris-header {
  border: 2px double var(--gold-dim);
  padding: 12px;
  background: rgba(255, 251, 240, 0.65);
  margin-bottom: 16px;
}

.ex-libris-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.ex-libris-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold-dim);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.detail-item-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-dark);
  word-break: break-word;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--parchment-edge);
  padding-top: 10px;
}

.meta-cell {
  min-width: 0;
  background: rgba(230, 215, 184, 0.45);
  padding: 8px 10px;
  border-radius: 3px;
  border-left: 3px solid var(--gold-dim);
}
.meta-cell.full-span {
  grid-column: 1 / -1;
}

.meta-label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  display: block;
}

.meta-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-dark);
  word-break: break-word;
}

.section-divider-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--hunter-green);
  margin: 16px 0 10px;
  border-bottom: 1px solid var(--parchment-edge);
  padding-bottom: 6px;
}

.librarian-note-box {
  background:
    repeating-linear-gradient(180deg, transparent 0px, transparent 27px, rgba(154, 123, 44, 0.2) 28px);
  background-color: #fbf4e4;
  border: 1px solid #cbb795;
  border-left: 4px solid var(--hunter-green);
  padding: 10px 12px;
  border-radius: 3px;
  font-size: 14px;
  line-height: 28px;
  color: var(--ink-dark);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Detail Files Section: Image Grid & PDF Cards */
.files-section-group {
  margin-bottom: 14px;
}

.image-thumb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.image-thumb-card {
  background: #fffdf8;
  border: 1px solid #cbb899;
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(35, 25, 18, 0.08);
  transition: border-color 0.18s, transform 0.18s;
  min-width: 0;
}
.image-thumb-card:hover {
  border-color: var(--hunter-green);
  transform: translateY(-2px);
}

.image-thumb-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #efe5d0;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-thumb-caption {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.pdf-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fffdf8;
  border: 1.5px solid #c5b08e;
  border-left: 4px solid var(--crimson);
  border-radius: 4px;
  padding: 12px;
  text-decoration: none;
  color: var(--ink-dark);
  box-shadow: 0 2px 8px rgba(35, 25, 18, 0.08);
  min-width: 0;
}
.pdf-file-card:hover {
  background: #fdf6e6;
  border-color: var(--hunter-green);
}

.pdf-file-info {
  min-width: 0;
  flex: 1;
}
.pdf-file-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-dark);
  word-break: break-word;
}
.pdf-file-meta {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.pdf-open-tag {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--hunter-green);
  background: #e6f0eb;
  border: 1px solid #96c7ad;
  padding: 5px 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.detail-footer-actions {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px double var(--parchment-edge);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* ================= 4. ADD/EDIT FORM: ACQUISITION LEDGER ================= */
.acquisition-card {
  background: var(--parchment);
  color: var(--ink-dark);
  border: 3px solid var(--gold-dim);
  border-radius: 6px;
  padding: 16px 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-field {
  min-width: 0;
}

.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-dark);
  margin-bottom: 6px;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field textarea {
  width: 100%;
  background: #fffdf7;
  border: 1.5px solid #bfa987;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--ink-dark);
  outline: none;
}
.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--hunter-green);
  box-shadow: 0 0 0 2px rgba(22, 46, 38, 0.15);
}

/* Category Single-Select Chips in Form */
.form-cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.form-cat-chip {
  background: #fffdf7;
  color: var(--ink-dark);
  border: 1.5px solid #bfa987;
  border-radius: 4px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: var(--font-serif);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.form-cat-chip.active {
  background: var(--hunter-green);
  color: var(--gold-bright);
  border-color: var(--hunter-green);
  font-weight: 700;
}

/* Quick Warranty Buttons */
.warranty-quick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.warranty-quick-label {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-muted);
}

.warranty-quick-btn {
  background: #efe3c8;
  color: var(--ink-dark);
  border: 1px solid #bfa987;
  border-radius: 3px;
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.warranty-quick-btn:hover {
  background: var(--hunter-green);
  color: var(--gold-bright);
  border-color: var(--hunter-green);
}

/* Dual File Upload Entry */
.upload-dual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.brass-upload-slot {
  background: linear-gradient(180deg, #fffcf4 0%, #efe3c8 100%);
  border: 2px dashed var(--gold-dim);
  border-radius: 5px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.brass-upload-slot:hover {
  border-style: solid;
  border-color: var(--hunter-green);
  background: #e6f0eb;
}
.brass-upload-slot svg {
  width: 26px;
  height: 26px;
  color: var(--hunter-green);
  margin-bottom: 5px;
}
.upload-slot-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-dark);
}
.upload-slot-desc {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Uploaded & Uploading File Rows */
.upload-file-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.upload-file-item {
  background: #fffdf8;
  border: 1px solid #cbb899;
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.upload-file-name {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dark);
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-badge {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.upload-remove-btn {
  background: var(--crimson-light);
  color: var(--crimson);
  border: 1px solid #deb0ab;
  border-radius: 3px;
  padding: 2px 8px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #e6d7b8;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--hunter-green), var(--gold));
  width: 0%;
  transition: width 0.15s ease;
}

.submit-brass-btn {
  width: 100%;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--hunter-light) 0%, var(--hunter-green) 100%);
  color: var(--gold-bright);
  border: 2px solid var(--gold);
  border-radius: 5px;
  padding: 12px 16px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.submit-brass-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}
.submit-brass-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ================= LIGHTBOX (FULLSCREEN IMAGE VIEWER) ================= */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 6, 4, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--parchment);
  font-family: var(--font-sans);
  font-size: 13px;
  z-index: 2;
}

.lightbox-caption {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-close-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.lightbox-stage {
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border: 2px solid var(--gold-dim);
  border-radius: 4px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
}

.lightbox-nav-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 2;
}

.lightbox-nav-btn {
  background: rgba(37, 23, 16, 0.85);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.lightbox-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================= CONFIRM MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(12, 7, 4, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-dialog {
  width: 100%;
  max-width: 380px;
  background: var(--parchment);
  color: var(--ink-dark);
  border: 3px solid var(--gold-dim);
  border-radius: 6px;
  padding: 18px 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.85);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--crimson);
  margin-bottom: 8px;
}

.modal-desc {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink-dark);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================= GLOBAL LOADING & TOAST ================= */
.loading-banner {
  background: rgba(22, 46, 38, 0.92);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 14px;
  text-align: center;
  font-size: 13px;
  font-family: var(--font-sans);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: calc(100% - 24px);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 5px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.toast-item.info,
.toast-item.success {
  background: var(--emerald-bg);
  color: var(--emerald-ok);
  border: 1.5px solid var(--emerald-ok);
}
.toast-item.error {
  background: var(--crimson-light);
  color: var(--crimson);
  border: 1.5px solid var(--crimson);
}

/* ================= RESPONSIVE BREAKPOINTS ================= */
@media (min-width: 640px) {
  .shelf-books-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
  }
  .image-thumb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .app-shell {
    padding: 26px 24px;
  }
  .library-title {
    font-size: 28px;
  }
  .ledger-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .parchment-spread {
    padding: 26px 28px;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 28px;
  }
  .parchment-spread::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 51%;
    width: 14px;
    background: linear-gradient(90deg, rgba(80, 55, 30, 0.02), rgba(60, 40, 20, 0.15) 50%, rgba(80, 55, 30, 0.02));
    pointer-events: none;
  }
  .acquisition-card {
    padding: 24px 28px;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-field.full-span {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .shelf-books-row {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 12px;
    min-height: 246px;
  }
}
