/* The [hidden] attribute must always win over layout rules like
   .admin-panel { display: flex } — otherwise JS panel toggling has no effect. */
[hidden] {
  display: none !important;
}

:root {
  color-scheme: light;
  --ink: #16201c;
  --muted: #5c6761;
  --line: #d8ded8;
  --paper: #f8f7f2;
  --surface: #ffffff;
  --accent: #2f6f5e;
  --accent-dark: #214d42;
  --clay: #a8543d;
  --ochre: #c49642;
  --blue: #356f91;
  --shadow: 0 20px 60px rgba(22, 32, 28, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

/* --- Public WIP page (scoped under .wip; does not touch admin) -------- */
.wip {
  --wip-ink: #2a2013;
  --wip-body: #45392a;
  --wip-muted: #7c6c53;
  --wip-green: #216257;
  --wip-green-dark: #184b42;
  --wip-gold: #b8863b;
  --wip-clay: #a8492f;
  --wip-line: rgba(120, 90, 40, 0.18);
  --wip-line-strong: rgba(120, 90, 40, 0.34);

  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  overflow: hidden;
  color: var(--wip-ink);
  background:
    radial-gradient(130% 90% at 50% -12%, rgba(33, 98, 87, 0.12), transparent 58%),
    linear-gradient(180deg, #f7f1e4 0%, #efe5d1 100%);
}

.wip-ornament {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%239a6b2f' stroke-opacity='0.12' stroke-width='1'%3E%3Crect x='20' y='20' width='32' height='32'/%3E%3Crect x='20' y='20' width='32' height='32' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(120% 95% at 50% 28%, #000 0%, transparent 72%);
  mask-image: radial-gradient(120% 95% at 50% 28%, #000 0%, transparent 72%);
}

.wip-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  text-align: center;
  padding: clamp(32px, 6vw, 66px);
  border: 1px solid var(--wip-line-strong);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(184, 134, 59, 0.22),
    0 30px 80px rgba(42, 30, 12, 0.16);
  animation: wip-rise 0.7s ease both;
}

.wip-seal {
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto 22px;
  color: var(--wip-gold);
}

.wip-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 26px;
  padding: 6px 14px;
  border: 1px solid rgba(168, 73, 47, 0.32);
  border-radius: 999px;
  color: var(--wip-clay);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.wip-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wip-clay);
  animation: wip-pulse 2.4s ease-in-out infinite;
}

.wip-eyebrow {
  margin: 0 0 12px;
  color: var(--wip-green);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
}

.wip-mark {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: clamp(3.4rem, 12vw, 6rem);
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--wip-ink);
}

.wip-gloss {
  margin: 18px 0 4px;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: clamp(1.05rem, 3.5vw, 1.4rem);
  color: var(--wip-green-dark);
}

.wip-arabic {
  font-style: normal;
  font-size: 1.3em;
  vertical-align: -0.06em;
}

.wip-dot {
  color: var(--wip-gold);
  margin: 0 8px;
}

.wip-gloss-sub {
  margin: 0;
  color: var(--wip-muted);
  font-size: 0.92rem;
  font-style: italic;
}

.wip-lede {
  max-width: 54ch;
  margin: 26px auto 0;
  color: var(--wip-body);
  font-size: 1.02rem;
  line-height: 1.72;
}

.wip-lede em {
  font-style: italic;
  color: var(--wip-green-dark);
}

.wip-lede-muted {
  margin-top: 14px;
  color: var(--wip-muted);
  font-size: 0.96rem;
}

.wip-form {
  max-width: 480px;
  margin: 34px auto 0;
  text-align: left;
}

.wip-label {
  display: block;
  margin-bottom: 10px;
  color: var(--wip-ink);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.wip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.wip-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--wip-line-strong);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--wip-ink);
  font: inherit;
}

.wip-form input:focus {
  outline: 3px solid rgba(33, 98, 87, 0.16);
  border-color: var(--wip-green);
}

.wip-form button {
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: var(--wip-green);
  color: #fdf9ee;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.wip-form button:hover {
  background: var(--wip-green-dark);
}

.wip-form button:active {
  transform: translateY(1px);
}

.wip-form .cf-turnstile {
  margin-top: 14px;
  min-height: 65px;
}

.wip-form .form-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--wip-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.wip-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 34px 0 0;
  padding: 24px 0 0;
  list-style: none;
  border-top: 1px solid var(--wip-line);
}

.wip-facts li {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wip-facts strong {
  color: var(--wip-ink);
  font-size: 0.96rem;
  font-weight: 600;
}

.wip-facts span {
  color: var(--wip-muted);
  font-size: 0.82rem;
}

.wip-admin {
  display: inline-block;
  margin-top: 30px;
  color: var(--wip-muted);
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.wip-admin:hover {
  color: var(--wip-green-dark);
  border-color: var(--wip-gold);
}

@keyframes wip-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes wip-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wip-card {
    animation: none;
  }
  .wip-badge::before {
    animation: none;
  }
}

@media (max-width: 560px) {
  .wip-row {
    grid-template-columns: 1fr;
  }
  .wip-form button {
    width: 100%;
  }
  .wip-facts {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .wip-mark {
    letter-spacing: 0.08em;
  }
  .wip-form .cf-turnstile {
    transform: scale(0.92);
    transform-origin: left top;
  }
}

/* ===================================================================== *
 * Admin area — login + catalog workspace. Shares the WIP parchment      *
 * design language (Playfair display, warm palette). Scoped under        *
 * .adm-auth / .adm-app so it never collides with the public page.       *
 * ===================================================================== */
.adm-auth,
.adm-app {
  --adm-ink: #2a2013;
  --adm-body: #45392a;
  --adm-muted: #7c6c53;
  --adm-green: #216257;
  --adm-green-dark: #184b42;
  --adm-gold: #b8863b;
  --adm-clay: #a8492f;
  --adm-surface: #fffdf8;
  --adm-line: rgba(120, 90, 40, 0.18);
  --adm-line-strong: rgba(120, 90, 40, 0.32);
  color: var(--adm-ink);
}

/* --- shared controls -------------------------------------------------- */
.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.1s ease;
}
.adm-btn:active {
  transform: translateY(1px);
}
.adm-btn-primary {
  background: var(--adm-green);
  color: #fdf9ee;
}
.adm-btn-primary:hover {
  background: var(--adm-green-dark);
}
.adm-btn-ghost {
  background: transparent;
  border-color: var(--adm-line-strong);
  color: var(--adm-body);
}
.adm-btn-ghost:hover {
  border-color: var(--adm-clay);
  color: var(--adm-clay);
}
.adm-btn-block {
  width: 100%;
}

.adm-textlink {
  color: var(--adm-green-dark);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.adm-textlink:hover {
  border-color: var(--adm-gold);
}
.adm-textlink-plain {
  color: var(--adm-muted);
}

.form-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--adm-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}
.form-status[data-state="error"] {
  color: #9b2d1f;
}
.form-status[data-state="success"] {
  color: #184b42;
}
.cf-turnstile {
  margin-top: 14px;
  min-height: 65px;
}

/* --- Login ------------------------------------------------------------ */
.adm-auth {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  overflow: hidden;
  background:
    radial-gradient(130% 90% at 50% -12%, rgba(33, 98, 87, 0.12), transparent 58%),
    linear-gradient(180deg, #f7f1e4 0%, #efe5d1 100%);
}
.adm-ornament {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%239a6b2f' stroke-opacity='0.12' stroke-width='1'%3E%3Crect x='20' y='20' width='32' height='32'/%3E%3Crect x='20' y='20' width='32' height='32' transform='rotate(45 36 36)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(120% 95% at 50% 28%, #000 0%, transparent 72%);
  mask-image: radial-gradient(120% 95% at 50% 28%, #000 0%, transparent 72%);
}
.adm-auth-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: clamp(28px, 5vw, 44px);
  text-align: center;
  border: 1px solid var(--adm-line-strong);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(184, 134, 59, 0.22),
    0 30px 80px rgba(42, 30, 12, 0.16);
}
.adm-seal {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  color: var(--adm-gold);
}
.adm-eyebrow {
  margin: 0 0 8px;
  color: var(--adm-green);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.adm-title {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.7rem, 5vw, 2.15rem);
  line-height: 1.1;
  color: var(--adm-ink);
}
.adm-auth-sub {
  margin: 14px auto 0;
  max-width: 34ch;
  color: var(--adm-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.adm-form {
  margin: 26px 0 0;
  text-align: left;
}
.adm-label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--adm-ink);
}
.adm-input {
  width: 100%;
  min-height: 48px;
  margin-bottom: 16px;
  padding: 0 15px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: var(--adm-surface);
  color: var(--adm-ink);
  font: inherit;
}
.adm-input:focus {
  outline: 3px solid rgba(33, 98, 87, 0.16);
  border-color: var(--adm-green);
}
.adm-form .adm-btn-block {
  margin-top: 2px;
}
.adm-auth-card .adm-textlink {
  display: inline-block;
  margin-top: 22px;
}

/* --- Catalog workspace ------------------------------------------------ */
.adm-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f7f1e4 0%, #f1e8d6 100%);
}
.adm-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(255, 253, 247, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--adm-line-strong);
}
.adm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--adm-ink);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.adm-brand-seal {
  width: 26px;
  height: 26px;
  color: var(--adm-gold);
}
.adm-brand-sep {
  color: var(--adm-gold);
  margin: 0 2px;
}
.adm-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.adm-whoami {
  color: var(--adm-muted);
  font-size: 0.88rem;
}
.adm-main {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 40px) 72px;
}
.adm-h1 {
  margin: 0 0 20px;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  color: var(--adm-ink);
}

/* stats */
.adm-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.adm-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--adm-line);
  border-radius: 14px;
  background: var(--adm-surface);
}
.adm-stat-num {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--adm-green-dark);
}
.adm-stat-label {
  color: var(--adm-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.adm-stat-warn .adm-stat-num {
  color: var(--adm-clay);
}

/* search */
.adm-search {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.adm-search input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 12px;
  background: var(--adm-surface);
  color: var(--adm-ink);
  font: inherit;
}
.adm-search input:focus {
  outline: 3px solid rgba(33, 98, 87, 0.16);
  border-color: var(--adm-green);
}

/* results table */
.adm-tablewrap {
  overflow-x: auto;
  border: 1px solid var(--adm-line);
  border-radius: 14px;
  background: var(--adm-surface);
}
.catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.catalog-table th,
.catalog-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--adm-line);
  vertical-align: middle;
}
.catalog-table thead th {
  color: var(--adm-muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(120, 90, 40, 0.05);
}
.catalog-table th.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.12s ease, background 0.12s ease;
}
.catalog-table th.th-sort:hover {
  color: var(--adm-ink);
  background: rgba(120, 90, 40, 0.1);
}
.catalog-table th.th-active {
  color: var(--adm-ink);
}
.th-arrow {
  display: inline-block;
  width: 0.9em;
  margin-left: 0.35em;
  font-size: 0.85em;
  color: var(--adm-gold);
}
.catalog-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}
.catalog-table tbody tr:hover {
  background: rgba(33, 98, 87, 0.07);
}
.catalog-table tbody tr:last-child td {
  border-bottom: 0;
}
.catalog-cell-title {
  font-weight: 600;
  color: var(--adm-ink);
}
.catalog-cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.catalog-muted {
  color: var(--adm-muted);
  padding: 8px 2px;
}

/* status pills */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.pill-available {
  background: rgba(33, 98, 87, 0.12);
  color: var(--adm-green-dark);
}
.pill-lost {
  background: rgba(168, 73, 47, 0.14);
  color: var(--adm-clay);
}
.pill-withdrawn {
  background: rgba(120, 90, 40, 0.12);
  color: var(--adm-muted);
}

/* pager */
.catalog-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 22px 0;
  color: var(--adm-muted);
  font-size: 0.9rem;
}
.catalog-pager button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: var(--adm-surface);
  color: var(--adm-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.catalog-pager button:hover:not(:disabled) {
  border-color: var(--adm-green);
  color: var(--adm-green-dark);
}
.catalog-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* detail */
.catalog-detail {
  margin-top: 24px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--adm-line);
  border-radius: 16px;
  background: var(--adm-surface);
  box-shadow: 0 18px 50px rgba(42, 30, 12, 0.08);
}
.catalog-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.catalog-detail-head h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  color: var(--adm-ink);
}
.catalog-detail h3 {
  margin: 26px 0 4px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--adm-muted);
}
.catalog-detail p {
  margin: 8px 0 0;
  color: var(--adm-body);
  line-height: 1.65;
}
.catalog-desc {
  white-space: pre-wrap;
}
.catalog-role {
  color: var(--adm-muted);
  font-size: 0.85em;
}
.catalog-edition {
  border-top: 1px solid var(--adm-line);
  padding-top: 14px;
  margin-top: 14px;
}
.catalog-edition-meta {
  font-weight: 600;
  color: var(--adm-ink);
}
.catalog-copies {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
}
.catalog-copies li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.catalog-copies code {
  background: rgba(22, 32, 28, 0.06);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85em;
}
.catalog-loc {
  color: var(--adm-muted);
  font-size: 0.88em;
}
.catalog-detail .secondary-button {
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--adm-body);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.catalog-detail .secondary-button:hover {
  border-color: var(--adm-clay);
  color: var(--adm-clay);
}

@media (max-width: 720px) {
  .adm-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .adm-whoami {
    display: none;
  }
}
@media (max-width: 480px) {
  .cf-turnstile {
    transform: scale(0.92);
    transform-origin: left top;
  }
}

/* --- copy editor (slice 2: status/location, journaled) --------------- */
.catalog-copies li.copy-row {
  display: block;
  padding: 12px 0;
  border-bottom: 1px dashed var(--adm-line);
}
.catalog-copies li.copy-row:last-child {
  border-bottom: 0;
}
.copy-main {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.copy-inv {
  align-self: center;
  background: rgba(22, 32, 28, 0.06);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.85em;
}
.copy-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--adm-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.copy-field select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 8px;
  background: var(--adm-surface);
  color: var(--adm-ink);
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}
.copy-newloc {
  display: inline-flex;
  gap: 8px;
  align-self: center;
}
.copy-newloc input {
  width: 140px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 8px;
  background: var(--adm-surface);
  color: var(--adm-ink);
  font: inherit;
}
.copy-save,
.copy-hist-toggle {
  align-self: center;
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.85rem;
}
.copy-msg {
  display: inline-block;
  min-height: 18px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--adm-muted);
}
.copy-msg[data-state="error"] {
  color: #9b2d1f;
}
.copy-msg[data-state="success"] {
  color: var(--adm-green-dark);
}
.copy-hist {
  margin-top: 8px;
}
.copy-hist-list {
  list-style: none;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--adm-line);
  border-radius: 10px;
  background: rgba(120, 90, 40, 0.04);
}
.copy-hist-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--adm-line);
}
.copy-hist-list li:last-child {
  border-bottom: 0;
}
.copy-hist-when {
  min-width: 132px;
  color: var(--adm-muted);
}
.copy-hist-what {
  color: var(--adm-body);
}
.copy-hist-who {
  margin-left: auto;
  color: var(--adm-muted);
}

/* --- editing & adding: forms (slice 2b/2c) --------------------------- */
.adm-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.adm-main-head .adm-h1 {
  margin: 0;
}
.adm-btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}
.catalog-detail-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.catalog-edition-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.catalog-edition-head .catalog-edition-meta {
  margin: 0;
}

.edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-top: 8px;
}
.edit-form h3 {
  grid-column: 1 / -1;
  margin: 14px 0 0;
}
.edit-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--adm-muted);
}
.edit-field.edit-wide {
  grid-column: 1 / -1;
}
.edit-field input,
.edit-field select,
.edit-field textarea {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: var(--adm-surface);
  color: var(--adm-ink);
  font: inherit;
  font-weight: 400;
}
.edit-field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  outline: 3px solid rgba(33, 98, 87, 0.16);
  border-color: var(--adm-green);
}
.edit-check {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--adm-body);
}
.edit-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--adm-green);
}
.edit-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
}
.edit-msg {
  font-size: 0.9rem;
  color: var(--adm-muted);
}
.edit-msg[data-state="error"] {
  color: #9b2d1f;
}
.edit-msg[data-state="success"] {
  color: var(--adm-green-dark);
}
#add-newloc {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .edit-form {
    grid-template-columns: 1fr;
  }
}

/* --- modal book card ------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 5vh 16px;
  background: rgba(30, 22, 10, 0.5);
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.modal {
  width: min(880px, 100%);
  height: max-content;
  margin: auto;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--adm-line-strong);
  border-radius: 16px;
  background: var(--adm-surface);
  box-shadow: 0 40px 100px rgba(20, 14, 6, 0.35);
  animation: modal-in 0.18s ease both;
}
.modal .catalog-detail {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.copy-read {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .modal {
    animation: none;
  }
}

/* --- infinite scroll list -------------------------------------------- */
.catalog-table {
  font-size: 0.98rem;
}
.catalog-table th,
.catalog-table td {
  padding: 14px 18px;
}
#catalog-sentinel {
  height: 1px;
}
.catalog-loadinfo {
  margin: 16px 0 4px;
  text-align: center;
  color: var(--adm-muted);
  font-size: 0.88rem;
}

/* ===== view tabs (Коллекция / Персоны) ===================================== */
.adm-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--adm-line);
  border-radius: 999px;
  background: rgba(120, 90, 40, 0.05);
}
.adm-tab {
  border: 0;
  background: transparent;
  padding: 6px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--adm-muted);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.adm-tab:hover {
  color: var(--adm-ink);
}
.adm-tab.is-active {
  background: var(--adm-surface);
  color: var(--adm-ink);
  box-shadow: 0 1px 3px rgba(80, 55, 15, 0.14);
}

/* ===== persons registry ==================================================== */
.person-formcount {
  margin-left: 8px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--adm-gold);
}
.person-forms {
  list-style: none;
  margin: 8px 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.person-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--adm-line);
  border-radius: 10px;
  background: var(--adm-surface);
}
.person-form-name {
  flex: 1;
  color: var(--adm-ink);
}
.person-form-books {
  font-size: 0.82rem;
  color: var(--adm-muted);
  font-variant-numeric: tabular-nums;
}
.person-addform {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.person-addform .adm-input {
  flex: 1;
  min-width: 200px;
}
.person-merge {
  position: relative;
  max-width: 460px;
}
.person-merge-drop {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  margin-top: 4px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: var(--adm-surface);
  box-shadow: 0 8px 24px rgba(60, 40, 10, 0.16);
  overflow: hidden;
}
.person-merge-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  font: inherit;
  text-align: left;
  color: var(--adm-ink);
  cursor: pointer;
}
.person-merge-opt:hover {
  background: rgba(184, 134, 59, 0.12);
}
.person-merge-forms {
  font-size: 0.8rem;
  color: var(--adm-muted);
}
.person-merge-empty {
  padding: 9px 12px;
  color: var(--adm-muted);
  font-size: 0.88rem;
}
.person-works {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.person-works a {
  color: var(--adm-ink);
  text-decoration: none;
  border-bottom: 1px dotted var(--adm-line-strong);
}
.person-works a:hover {
  color: var(--adm-gold);
}
.catalog-person-hint {
  color: var(--adm-gold);
  font-size: 0.86em;
}

/* ===== chips input (author picker) ======================================== */
.chips-mount {
  position: relative;
}
.chips-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: var(--adm-surface);
  min-height: 42px;
}
.chips-box:focus-within {
  border-color: var(--adm-gold);
}
.chips-list {
  display: contents;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: rgba(184, 134, 59, 0.14);
  color: var(--adm-ink);
  font-size: 0.88rem;
  white-space: nowrap;
}
.chip-new {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--adm-gold);
}
.chip-x {
  border: 0;
  background: transparent;
  color: var(--adm-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px;
}
.chip-x:hover {
  color: #a3401f;
}
.chips-input {
  flex: 1;
  min-width: 140px;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--adm-ink);
  padding: 4px 2px;
}
.chips-drop {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--adm-line-strong);
  border-radius: 10px;
  background: var(--adm-surface);
  box-shadow: 0 8px 24px rgba(60, 40, 10, 0.16);
}
.chips-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  font: inherit;
  text-align: left;
  color: var(--adm-ink);
  cursor: pointer;
  border-bottom: 1px solid var(--adm-line);
}
.chips-opt:last-child {
  border-bottom: 0;
}
.chips-opt:hover {
  background: rgba(184, 134, 59, 0.12);
}
.chips-opt-name {
  flex: 1;
}
.chips-opt-person {
  font-size: 0.82rem;
  color: var(--adm-gold);
}
.chips-opt-books {
  font-size: 0.78rem;
  color: var(--adm-muted);
  font-variant-numeric: tabular-nums;
}
.chips-opt-new {
  color: var(--adm-gold);
  font-weight: 500;
}
