:root {
  --bg: #f5f1ea;
  --surface: #fbf8f2;
  --surface-strong: #fffdf9;
  --surface-muted: #efe8dc;
  --border: rgba(30, 35, 41, 0.12);
  --border-strong: rgba(30, 35, 41, 0.22);
  --text: #1e2329;
  --muted: #66707b;
  --accent: #1d4d45;
  --accent-soft: #e3efe9;
  --shadow: none;
  --shadow-soft: none;
  --radius-lg: 1rem;
  --radius-md: 0.85rem;
  --radius-sm: 0.7rem;
  --catalogue-topbar-height: 0px;
  --catalogue-controls-height: 0px;
  --mobile-bottom-bar-height: 0px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #fcf9f4 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(252, 249, 244, 0.98), rgba(245, 241, 234, 0.94));
  backdrop-filter: blur(14px);
  transition:
    padding 160ms ease,
    gap 160ms ease,
    margin-bottom 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.brand-block,
.stack {
  display: grid;
  gap: 1rem;
}

.stack.compact {
  gap: 0.35rem;
}

.eyebrow,
.meta-line,
.section-subtitle,
.tagline,
.field label,
.meta-label {
  color: var(--muted);
}

.eyebrow.strong {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow.strong {
  font-size: 0.76rem;
  font-weight: 700;
  transition: opacity 140ms ease, transform 140ms ease, max-height 140ms ease;
}

.brand-block {
  display: grid;
  gap: 0.35rem;
}

.brand {
  color: var(--text);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand:hover {
  opacity: 0.9;
}

.tagline {
  margin: 0;
  max-width: 36rem;
  font-size: 0.95rem;
}

.topbar-actions,
.topbar-nav,
.topbar-utility,
.toolbar,
.inline-form,
.result-actions,
.form-actions,
.hero-header,
.hero-actions,
.toolbar-end,
.card-actions,
.filter-strip,
.detail-actions,
.detail-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 1rem;
}

.topbar-nav,
.topbar-utility {
  align-items: center;
}

.topbar-utility {
  margin-left: auto;
}

.topbar-icon-button {
  min-width: 2.9rem;
  padding: 0.75rem;
}

.topbar-icon-button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.nav-link,
.nav-button,
.button,
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    min-height 160ms ease,
    padding 160ms ease;
}

.nav-link:hover,
.nav-button:hover,
.button:hover,
.filter-chip:hover {
  background: rgba(29, 77, 69, 0.06);
}

.button:disabled,
.nav-button:disabled,
.filter-chip:disabled,
button[disabled].button,
button[disabled].nav-button,
button[disabled].filter-chip,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  background: color-mix(in srgb, var(--surface) 88%, #e7dfd1 12%);
  border-color: color-mix(in srgb, var(--border) 92%, transparent);
  color: color-mix(in srgb, var(--text) 62%, transparent);
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}

.button:disabled:hover,
.nav-button:disabled:hover,
.filter-chip:disabled:hover,
button[disabled].button:hover,
button[disabled].nav-button:hover,
button[disabled].filter-chip:hover,
input[type="submit"]:disabled:hover,
input[type="button"]:disabled:hover,
input[type="reset"]:disabled:hover {
  background: color-mix(in srgb, var(--surface) 88%, #e7dfd1 12%);
}

.nav-link.active,
.filter-chip.active,
.button.primary,
.nav-button,
.pill.strong {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8fbf9;
}

.button.subtle,
.button.ghost {
  background: var(--surface-muted);
  box-shadow: none;
}

.button.danger {
  background: rgba(141, 49, 41, 0.12);
  border-color: #8d3129;
  color: #8d3129;
}

.button.danger:hover {
  background: rgba(141, 49, 41, 0.18);
  border-color: #8d3129;
  color: #74231a;
}

.nav-button {
  box-shadow: none;
}

.flash,
.card,
.hero,
.auth-card,
.form-panel,
.meta-card,
.cover-card,
.empty-state {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.hero,
.card,
.auth-card,
.form-panel {
  padding: 0;
}

.hero {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.flash {
  margin-bottom: 1rem;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--border-strong);
}

.flash.alert {
  color: #8d3129;
}

.page,
.stats,
.catalogue-controls,
.search-panel,
.form-grid,
.detail-layout,
.metadata-grid,
.lookup-results,
.shelf-grid,
.cover-grid,
.editor-layout,
.integration-list {
  display: grid;
  gap: 1rem;
}

.page {
  gap: 2rem;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.topbar-library-size {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.82);
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.page-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.75rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.section-title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  letter-spacing: -0.03em;
  font-family: 'Lora', Georgia, serif;
}

.section-subtitle {
  margin: 0;
  max-width: 48rem;
  font-size: 1rem;
  font-family: 'Lora', Georgia, serif;
}

.hero-header {
  justify-content: space-between;
  align-items: end;
}

.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-meta {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.profile-stats {
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.profile-password-modal {
  width: min(32rem, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  border: 1px solid var(--border-strong);
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.profile-password-modal::backdrop {
  background: rgba(30, 35, 41, 0.45);
}

.profile-password-sheet {
  padding: 1rem;
}

.profile-password-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-password-close {
  width: 2.8rem;
  min-width: 2.8rem;
  min-height: 2.8rem;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.82);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text);
}

.stat {
  padding: 1rem 0 0;
  border-top: 1px solid var(--border);
}

.stat-value {
  display: block;
  margin-bottom: 0.25rem;
  font-size: clamp(2rem, 3vw, 2.5rem);
  line-height: 1;
  font-weight: 700;
}

.catalogue-controls {
  gap: 1rem;
  position: sticky;
  top: calc(var(--catalogue-topbar-height) - 1px);
  z-index: 30;
  padding-top: 0.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(252, 249, 244, 0.97), rgba(245, 241, 234, 0.94));
  backdrop-filter: blur(14px);
  transition:
    top 0ms ease,
    gap 10ms ease,
    padding-top 10ms ease,
    padding-bottom 100ms ease,
    border-color 100ms ease,
    background-color 100ms ease;
}

.search-panel {
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  transition: grid-template-columns 160ms ease, gap 160ms ease;
}

.search-bar-shell {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 3.55rem;
  padding: 0.3rem 0.4rem 0.3rem 0.65rem;
  border: 1px solid rgba(29, 77, 69, 0.08);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--surface-strong) 88%, #f1ece3 12%);
  box-shadow:
    0 1px 2px rgba(30, 35, 41, 0.06),
    0 4px 12px rgba(73, 62, 43, 0.05);
}

.search-bar-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.search-bar-action:hover,
.search-bar-action:focus-visible {
  background: rgba(29, 77, 69, 0.08);
  color: var(--text);
}

.search-bar-action:focus,
.search-bar-action:focus-visible {
  outline: none;
  box-shadow: none;
}

.search-bar-action svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.search-bar-action-trailing,
.search-reset-button {
  background: color-mix(in srgb, var(--surface-strong) 92%, white 8%);
  color: color-mix(in srgb, var(--accent) 76%, var(--text) 24%);
  border: 1px solid rgba(29, 77, 69, 0.16);
  box-shadow:
    0 1px 2px rgba(30, 35, 41, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.search-bar-action-trailing:hover,
.search-bar-action-trailing:focus-visible,
.search-reset-button:hover,
.search-reset-button:focus-visible {
  background: color-mix(in srgb, var(--surface-strong) 84%, white 16%);
  color: var(--accent);
}

.search-bar-shell input {
  appearance: none;
  width: 100%;
  min-height: 0;
  padding: 0 0.2rem;
  outline: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

#query {
  outline: none;
  border: none;
}

.search-bar-shell input:focus,
.search-bar-shell input:focus-visible {
  outline: none;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.search-bar-shell:focus-within {
  border-color: rgba(29, 77, 69, 0.18);
  background: color-mix(in srgb, var(--surface-strong) 92%, white 8%);
  box-shadow:
    0 2px 6px rgba(30, 35, 41, 0.08),
    0 12px 24px rgba(73, 62, 43, 0.07);
}

.search-bar-shell .search-bar-clear.hidden {
  display: none !important;
}

.mobile-status-filter {
  display: none;
}

.mobile-catalogue-tabs,
.mobile-advanced-filters {
  display: none;
}

#scan-frame {
  position: absolute;
  width: 80%;
  height: 20%;
  top: 40%;
  left: 10%;
  border: 2px solid white;
  border-radius: 8px;
  pointer-events: none;
}

.mobile-scan-trigger {
  display: none;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label,
.meta-label {
  font-size: 0.88rem;
  font-weight: 600;
  transition: font-size 160ms ease, letter-spacing 160ms ease, opacity 160ms ease;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: none;
  transition:
    min-height 160ms ease,
    padding 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(29, 77, 69, 0.18);
  outline-offset: 2px;
  border-color: rgba(29, 77, 69, 0.4);
}

.field input:disabled,
.field textarea:disabled,
.field select:disabled,
.field input[readonly],
.field textarea[readonly] {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 82%, #efe7d7 18%);
  color: color-mix(in srgb, var(--text) 72%, transparent);
  cursor: not-allowed;
  opacity: 1;
}

.field input:disabled::placeholder,
.field textarea:disabled::placeholder,
.field input[readonly]::placeholder,
.field textarea[readonly]::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.field.full {
  grid-column: 1 / -1;
}

.filter-strip {
  gap: 0.6rem;
}

.filter-chip {
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.94rem;
  border-width: 0 0 1px;
  padding-left: 0;
  padding-right: 0;
}

.settings-tabs {
  display: flex;
  gap: 0.25rem;
  align-items: end;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 3rem;
  padding: 0.75rem 1rem 0.9rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--text) 78%, transparent);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.settings-tab:hover {
  background: rgba(29, 77, 69, 0.06);
  color: var(--text);
}

.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.catalogue-heading-summary {
  min-width: 0;
  flex: 1 1 auto;
}

.catalogue-heading-empty {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.catalogue-heading-copy {
  align-self: center;
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.catalogue-heading-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.catalogue-heading-action {
  flex: 0 0 auto;
  align-self: end;
}

.catalogue-heading-title-desktop {
  margin: 0;
}

.catalogue-filters-toggle {
  display: none;
  align-items: center;
  gap: 0.42rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  text-align: left;
}

.catalogue-filters-toggle .section-title {
  margin: 0;
}

.catalogue-filters-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--muted);
  flex: 0 0 auto;
}

.catalogue-view-switch {
  border-left: 1px solid var(--border);
  margin-left: auto;
  padding-left: 1rem;
  align-self: end;
  gap: 1rem;
  flex-shrink: 0;
}

.catalogue-layout-switch {
  display: grid;
  gap: 0.35rem;
  align-items: end;
}

.catalogue-layout-switch .result-actions {
  gap: 0.45rem;
}

.catalogue-layout-button {
  min-width: 2.9rem;
  min-height: 2.9rem;
  padding: 0.55rem;
}

.catalogue-layout-button svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.inline-filter-group {
  display: flex;
  gap: 0.85rem;
  align-items: end;
  flex-wrap: wrap;
  align-items: stretch;
}

.inline-filter-compact {
  min-width: auto;
}

.catalogue-view-form {
  margin: 0;
}

.mobile-catalogue-tab-form {
  margin: 0;
}

.catalogue-page .topbar::after,
.catalogue-page .catalogue-controls::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  opacity: 0;
  transition: opacity 160ms ease;
}

.catalogue-page .topbar {
  position: sticky;
}

.catalogue-page .catalogue-controls {
  position: sticky;
}

.catalogue-page.catalogue-condensed .topbar {
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
}

.catalogue-page.catalogue-condensed .topbar::after,
.catalogue-page.catalogue-condensed .catalogue-controls::after {
  opacity: 1;
}

.catalogue-page.catalogue-condensed .brand-kicker {
  opacity: 0;
  transform: translateY(-0.25rem);
  max-height: 0;
  overflow: hidden;
}

.catalogue-page.catalogue-condensed .brand {
  font-size: clamp(1.1rem, 1.4vw, 1.35rem);
  letter-spacing: 0.06em;
}

.catalogue-page.catalogue-condensed .topbar-actions {
  gap: 0.75rem;
}

.catalogue-page.catalogue-condensed .nav-link,
.catalogue-page.catalogue-condensed .nav-button,
.catalogue-page.catalogue-condensed .topbar-utility .button {
  min-height: 2.45rem;
  padding: 0.55rem 0.8rem;
}

.catalogue-page.catalogue-condensed .catalogue-controls {
  gap: 0.65rem;
  padding-top: 0;
  padding-bottom: 0.8rem;
}

.catalogue-page.catalogue-condensed .search-panel {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
}

.catalogue-page.catalogue-condensed .field label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.catalogue-page.catalogue-condensed .search-panel .field input,
.catalogue-page.catalogue-condensed .search-panel .field select,
.catalogue-page.catalogue-condensed .search-panel .toolbar-end .button {
  min-height: 2.65rem;
}

.catalogue-page.catalogue-condensed .search-panel .field input,
.catalogue-page.catalogue-condensed .search-panel .field select {
  padding: 0.6rem 0.8rem;
}

.catalogue-page.catalogue-condensed .toolbar-end {
  gap: 0.5rem;
}

.catalogue-page.catalogue-condensed .catalogue-heading-summary .section-subtitle {
  display: none;
}

.sort-direction-button {
  min-width: 2.9rem;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
  font-size: 1.05rem;
  line-height: 1;
}

.detail-header {
  justify-content: space-between;
  align-items: end;
}

.detail-actions {
  justify-content: flex-end;
}

.cover-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
}

.catalog-pages {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.catalog-page {
  display: block;
}

.catalog-page-skeleton {
  opacity: 0.94;
}

.card.stack[data-search-pending="true"] [data-catalog-grid] .catalog-page:not(.catalog-page-skeleton) {
  display: none;
}

.card.stack[data-search-pending="true"] .empty-state {
  display: none;
}

.card.stack[data-search-pending="true"] [data-online-results-panel] {
  display: none;
}

.card.stack[data-search-pending="true"][data-search-pending-mode="query"] [data-catalog-skeleton] .cover-grid-skeleton > .skeleton-card:not(:first-child) {
  display: none;
}

/* always show only one row of skeleton cards */
.cover-grid-skeleton {
  pointer-events: none;
  grid-template-rows: 1fr;
  grid-auto-rows: 0;
  padding-bottom: 0;
  row-gap: 0;
  overflow: hidden;
}

.cover-grid-online {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.1rem;
}

.cover-grid-online.cover-grid-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

.online-series-grid > .online-series-item[data-series-expanded="true"] {
  grid-column: 1 / -1;
  min-width: 0;
}

.online-result-card {
  padding-top: 0.85rem;
}

.online-result-card .cover-card-link {
  gap: 0.8rem;
}

.online-result-card .cover-copy {
  gap: 0.3rem;
}

.online-result-card .card-title {
  font-size: 1rem;
  line-height: 1.2;
}

.online-result-card .result-actions {
  margin-top: 0.2rem;
  gap: 0.35rem;
}

.online-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.online-result-card .pill {
  min-height: 1.8rem;
  padding: 0.32rem 0.55rem;
  font-size: 0.75rem;
}

.online-result-skeleton-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.skeleton-pill {
  display: inline-flex;
  width: 5.8rem;
  height: 1.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(221, 209, 191, 0.42), rgba(247, 240, 229, 0.95), rgba(221, 209, 191, 0.42));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-pill-short {
  width: 4.2rem;
}

.skeleton-card {
  border-top-color: rgba(127, 109, 89, 0.16);
}

.skeleton-card .cover-frame {
  background:
    linear-gradient(135deg, rgba(246, 239, 228, 0.96), rgba(224, 210, 188, 0.92));
}

.skeleton-card .cover-frame::before {
  border-color: rgba(255, 255, 255, 0.52);
  box-shadow: 0 18px 42px rgba(73, 50, 29, 0.1);
}

.cover-grid-row-skeleton {
  gap: 0.85rem;
}

.skeleton-card-row .cover-card-link {
  display: grid;
  grid-template-columns: clamp(4.4rem, 8vw, 5.5rem) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.skeleton-card-row .cover-frame {
  width: clamp(4.4rem, 8vw, 5.5rem);
  min-width: clamp(4.4rem, 8vw, 5.5rem);
}

.skeleton-card-row .cover-copy {
  min-width: 0;
}

.skeleton-line {
  display: block;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(222, 209, 193, 0.7), rgba(247, 243, 236, 0.95), rgba(222, 209, 193, 0.7));
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-line-short {
  width: 44%;
  min-height: 0.8rem;
}

.skeleton-line-medium {
  width: 72%;
  min-height: 0.88rem;
}

.skeleton-line-title {
  width: 88%;
  min-height: 1.15rem;
}

.skeleton-star {
  color: rgba(88, 91, 95, 0.18);
  pointer-events: none;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.catalog-spacer {
  width: 100%;
  height: 0;
}

.cover-card {
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.cover-card-link {
  display: grid;
  gap: 1rem;
  height: 100%;
  align-content: start;
}

.cover-image-link {
  display: block;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.cover-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.36), transparent 32%),
    linear-gradient(160deg, #fbf8f2, #cabca5);
}

.catalogue-cover-frame {
  background:
    radial-gradient(circle at 18% 18%, var(--catalog-cover-glow, rgba(255, 255, 255, 0.36)), transparent 32%),
    linear-gradient(160deg, var(--catalog-cover-top, #fbf8f2), var(--catalog-cover-bottom, #cabca5));
}

.cover-frame::before {
  content: "";
  position: absolute;
  inset: 0%;
  border-radius: inherit;
  border: 10px solid rgba(252, 252, 252, 0.39);
  box-shadow: 0 18px 42px rgba(73, 50, 29, 0.16);
  pointer-events: none;
  z-index: 6;
}

.cover-frame::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: inherit;
  background:
    linear-gradient(
      135deg,
      rgba(68, 54, 34, 0.16) 0%,
      rgba(125, 107, 82, 0.09) 22%,
      rgba(244, 237, 221, 0.18) 52%,
      rgba(221, 210, 189, 0.14) 78%,
      rgba(255, 249, 238, 0.2) 100%
    );
  background-size: 260% 260%;
  background-position: 6% 8%;
  opacity: 0.24;
  pointer-events: none;
  transform: translate3d(-5%, 5%, 0) scale(1.04);
  transition:
    opacity 360ms ease,
    background-position 920ms ease,
    transform 920ms ease;
  z-index: 5;
}

.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-frame img.cover {
  position: absolute;
  left: 50%;
  top: 0;
  width: 112%;
  height: 112%;
  object-fit: cover;
  transform: translateX(-50%) rotate(-5deg) scale(1);
  transform-origin: center center;
  filter: saturate(0.92) contrast(0.98) brightness(0.98);
  transition: transform 360ms ease, box-shadow 360ms ease, filter 320ms ease;
  z-index: 1;
}

.series-cover-stack {
  position: absolute;
  inset: 0;
  perspective: 1400px;
  transform-style: preserve-3d;
}

.series-cover-stack .series-stack-cover {
  left: 50%;
  top: 8%;
  width: 68%;
  height: 84%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 34px rgba(45, 30, 18, 0.2);
  transform: translateX(-50%) rotate(-6deg) translate3d(0, 0, 0);
  transform-origin: center center;
  transition: transform 460ms ease, opacity 460ms ease, box-shadow 460ms ease;
}

.series-cover-stack .series-stack-cover:nth-child(1) {
  opacity: 1;
  z-index: 4;
}

.series-cover-stack .series-stack-cover:nth-child(2) {
  opacity: 0.94;
  z-index: 3;
}

.series-cover-stack .series-stack-cover:nth-child(3) {
  opacity: 0.88;
  z-index: 2;
}

.series-cover-stack .series-stack-cover:nth-child(4) {
  opacity: 0.82;
  z-index: 1;
}

.cover-large {
  min-height: 20rem;
}

.placeholder.cover-large {
  font-weight: bold;
  opacity: 0.4;
  min-height: 0;
  color: #42382a;
  text-transform: uppercase;
}

.cover-grid-row .placeholder.cover-large {
  font-size: 80%;
  padding: 0px;
}
.cover-grid-row .select-toggle-box.selected:after {
  border-radius: 12px;
}

.detail-cover {
  max-width: 21rem;
  aspect-ratio: 2 / 3;
  border-radius: 0;
  box-shadow: none;
}

.cover-upload-trigger {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.cover-upload-trigger .detail-cover {
  transition: opacity 140ms ease;
}

.cover-upload-trigger:hover .detail-cover {
  opacity: 0.9;
}

.cover.placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, #ece3d4, #d9c4a7);
}

.cover-frame .cover.placeholder {
  position: absolute;
  inset: 8% 10% 10%;
  width: auto;
  height: auto;
  background: transparent;
  box-shadow: none;
}

.book-placeholder {
  background: linear-gradient(180deg, #ece3d4, #d9c4a7);
}

.series-placeholder {
  background: linear-gradient(180deg, #d9e6e1, #b9cec6);
}

@media (hover: hover) and (pointer: fine) {
  .cover-frame:hover img.cover,
  .cover-frame:focus-within img.cover {
    transform: translateX(-50%) rotate(-3deg) scale(1.05);
    box-shadow: 0 24px 44px rgba(31, 23, 14, 0.34);
    filter: saturate(1) contrast(1) brightness(1);
  }

  .cover-frame:hover::after,
  .cover-frame:focus-within::after {
    opacity: 0.42;
    background-position: 100% 100%;
    transform: translate3d(5%, -5%, 0) scale(1.08);
  }

  .cover-frame:hover .series-stack-cover:nth-child(1),
  .cover-frame:focus-within .series-stack-cover:nth-child(1) {
    transform: translateX(-50%) rotate(-8deg) translate3d(40px, -40px, 20px);
    opacity: 0.4;
  }

  .cover-frame:hover .series-stack-cover:nth-child(2),
  .cover-frame:focus-within .series-stack-cover:nth-child(2) {
    transform: translateX(-50%) rotate(-6deg) translate3d(80px, -80px, 40px);
    opacity: 0.6;
  }

  .cover-frame:hover .series-stack-cover:nth-child(3),
  .cover-frame:focus-within .series-stack-cover:nth-child(3) {
    transform: translateX(-50%) rotate(-4deg) translate3d(120px, -120px, 60px);
    opacity: 0.8;
  }

  .cover-frame:hover .series-stack-cover:nth-child(4),
  .cover-frame:focus-within .series-stack-cover:nth-child(4) {
    transform: translateX(-50%) rotate(-2deg) translate3d(160px, -160px, 80px);
    opacity: 1;
  }
}

.status-badge {
  position: absolute;
  left: 3.8rem;
  top: 0.8rem;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0;
  background: rgba(25, 31, 35, 0.72);
  color: white;
  font-size: 0.82rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  z-index: 3;
}

.catalogue-cover-rating {
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
  z-index: 3;
}

.status-badge.action-badge {
  appearance: none;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.inline-quick-add-form {
  display: contents;
}

.status-badge.action-badge:hover,
.status-badge.action-badge:focus-visible {
  background: rgba(29, 77, 69, 0.92);
  color: #f8fbf9;
}

.select-toggle-overlay {
  position: absolute;
  left: 0.8rem;
  top: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.2rem;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(25, 31, 35, 0.72);
  backdrop-filter: blur(12px);
  cursor: pointer;
  z-index: 3;
}

.select-toggle-overlay .selection-input {
  position: absolute;
  inset: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.select-toggle-box.selected:after {
  content: "✘";
  visibility: visible;
  height: 100%;
  width: 100%;
  display: block;
  color: #fff;
  font-size: 17px;
  text-align: center;
  background-color: #1d4d45;
  align-content: center;
}

.select-toggle-box {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: transparent;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
  box-shadow: 0px 0px 1px 1px #aca9a9;
}

.select-toggle-overlay.selected {
  background: #fff;
  border-color: #fff;
  transform: scale(1.02);
}

.cover-upscale-badge {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.55rem;
  border: 0;
  background: rgba(29, 77, 69, 0.92);
  color: #f8fbf9;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.cover-upscale-badge:disabled {
  opacity: 0.55;
  cursor: progress;
}

.cover-copy,
.card-actions {
  padding: 0 0 0.25rem;
}

.cover-copy {
  display: grid;
  align-content: start;
  gap: 0.35rem;
}

.cover-grid-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

.cover-grid-row .cover-card {
  padding-top: 0.8rem;
}

.cover-card-row {
  grid-column: 1 / -1;
}

.cover-grid-row .cover-card-link,
.cover-card-row .cover-card-link {
  grid-template-columns: 4.65rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.cover-grid-row .cover-frame,
.cover-card-row .cover-frame {
  width: 4.65rem;
  min-width: 4.65rem;
  aspect-ratio: 1;
}

.cover-grid-row .cover-frame::before {
  border-width: 6px;
}

.cover-grid-row .cover-large {
  min-height: 0;
}

.cover-grid-row .cover-frame img.cover {
  width: 112%;
  height: 112%;
  transform: translateX(-50%) rotate(-3deg) scale(1);
}

.cover-grid-row .series-cover-stack .series-stack-cover {
  top: 7%;
  width: 74%;
  height: 86%;
}

.cover-grid-row .select-toggle-overlay {
  left: 0.35rem;
  top: 0.35rem;
  min-width: 1.8rem;
  min-height: 1.8rem;
}

.cover-card-row .select-toggle-box {
  width: 100%;
  height: 100%;
  left: 0px;
  top: 0px;
  backdrop-filter: none;
  border: 2px solid #00000024;
  border-radius: 12px;
}



.cover-grid-row .status-badge {
  left: 2.25rem;
  top: 0.35rem;
  min-height: 1.45rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.66rem;
}

.cover-card-row .status-badge {
  display: none;
}

.cover-grid-row .cover-upscale-badge {
  right: 0.35rem;
  top: 0.35rem;
  min-width: 1.8rem;
  min-height: 1.8rem;
  font-size: 0.64rem;
}

.cover-grid-row .cover-copy {
  gap: 0.22rem;
  padding-bottom: 0;
}

.catalogue-series-line {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: wrap;
}

.catalogue-inline-label {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  padding: 0.12rem 0.38rem;
  background: rgba(29, 77, 69, 0.08);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalogue-primary-link {
  display: grid;
  gap: 0.22rem;
  color: inherit;
  text-decoration: none;
}

.catalogue-primary-link:hover .card-title,
.catalogue-primary-link:focus-visible .card-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

.catalogue-row-details {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(12rem, 1fr) auto auto;
  gap: 0.9rem;
  align-items: start;
}

.catalogue-row-column {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.catalogue-row-column-title {
  min-width: 0;
}

.catalogue-row-column-meta {
  justify-self: end;
  padding-right: 0.35rem;
  text-align: right;
  white-space: nowrap;
}

.catalogue-row-column-action {
  justify-self: end;
  align-self: end;
}

.catalogue-row-column-group {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.catalogue-row-column-group-secondary {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.catalogue-row-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cover-grid-row .card-title {
  font-size: 0.99rem;
  line-height: 1.18;
}

.cover-grid-row .meta-line {
  font-size: 0.84rem;
  line-height: 1.28;
}

.cover-grid-row .result-actions {
  gap: 0.35rem;
}

.cover-grid-row .platform-pill {
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.76rem;
}

.online-result-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.25rem;
  text-align: center;
  white-space: nowrap;
}

.skeleton-button.online-result-action-button {
  min-height: 2.3rem;
  border-color: transparent;
  background: linear-gradient(90deg, rgba(214, 220, 228, 0.46) 0%, rgba(255, 255, 255, 0.9) 48%, rgba(214, 220, 228, 0.46) 100%);
  background-size: 200% 100%;
  color: transparent;
  pointer-events: none;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.catalogue-rating-control {
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
  flex-wrap: wrap;
}

.catalogue-rating-star {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(88, 91, 95, 0.12);
  font-size: 1.62rem;
  line-height: 1;
  cursor: pointer;
  transition: color 140ms ease, transform 140ms ease;
}

.catalogue-cover-rating .catalogue-rating-star {
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.24);
}

.catalogue-rating-star.community-active {
  color: rgba(51, 54, 58, 0.92);
}

.catalogue-cover-rating .catalogue-rating-star.community-active {
  color: rgba(232, 235, 238, 0.72);
}

.catalogue-rating-star.active {
  color: #bb8b2a;
}

.catalogue-rating-star:hover,
.catalogue-rating-star:focus-visible {
  color: #cf9831;
  transform: translateY(-0.04rem);
}

.catalogue-rating-star:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}

.catalogue-rating-value {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 2.3rem;
}

.catalogue-cover-rating .catalogue-rating-value {
  color: rgba(247, 247, 245, 0.84);
  font-size: 0.72rem;
  min-width: 2rem;
  margin-left: 0.22rem;
}

.catalogue-rating-value.static {
  margin-left: 0;
}

.detail-rating-control .catalogue-rating-star {
  font-size: 1.88rem;
}

@media (max-width: 1100px) {
  .catalogue-row-details {
    grid-template-columns: minmax(0, 1.6fr) minmax(10rem, 1fr) auto auto;
  }

  .catalogue-row-column-meta {
    grid-column: 1 / 4;
    padding-right: 0;
    justify-self: start;
    text-align: left;
    white-space: normal;
  }

  .catalogue-row-column-action {
    grid-column: 4;
    grid-row: 1 / span 2;
    align-self: start;
  }
}

@media (max-width: 760px) {
  .cover-grid-row .cover-card-link,
  .cover-card-row .cover-card-link {
    grid-template-columns: 3.7rem minmax(0, 1fr);
    gap: 0.65rem;
  }

  .cover-grid-row .cover-frame,
  .cover-card-row .cover-frame {
    width: 3.7rem;
    min-width: 3.7rem;
  }

  .catalogue-row-details {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: start;
  }

  .catalogue-row-column-meta {
    grid-column: 1 / -1;
    padding-right: 0;
    justify-self: start;
    text-align: left;
    white-space: normal;
  }

  .catalogue-row-column-group-secondary {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.28rem;
  }

  .catalogue-row-column-action {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
  }

  .catalogue-row-label {
    font-size: 0.6rem;
    letter-spacing: 0.07em;
  }

  .cover-grid-row .card-title,
  .cover-card-row .card-title {
    font-size: 0.92rem;
    line-height: 1.12;
  }

  .cover-grid-row .meta-line,
  .cover-card-row .meta-line {
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .cover-grid-row .platform-pill,
  .cover-card-row .platform-pill {
    min-height: 1.7rem;
    padding: 0.2rem 0.42rem;
    font-size: 0.68rem;
  }

  .online-result-action-button {
    min-width: 7rem;
  }

  .cover-card-row .catalogue-rating-star,
  .cover-grid-row .catalogue-rating-star {
    font-size: 1.18rem;
  }

  .cover-card-row .catalogue-rating-value,
  .cover-grid-row .catalogue-rating-value {
    margin-left: 0.18rem;
    font-size: 0.68rem;
    min-width: 1.7rem;
  }
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.meta-line {
  margin: 0;
  font-size: 0.94rem;
}

.meta-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease, color 120ms ease;
}

.meta-link:hover,
.meta-link:focus-visible {
  color: var(--text);
  border-color: currentColor;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
  border-radius: 0;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.detail-layout,
.editor-layout {
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  align-items: start;
}

.metadata-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-card {
  padding: 1rem 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
}

.meta-card p {
  margin: 0;
}

.preview-panel {
  align-content: start;
}

.ownership-form .form-actions {
  padding-top: 0.25rem;
}

.ownership-toggle-list {
  display: grid;
  gap: 0.5rem;
}

.batch-toolbar {
  display: grid;
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(calc(100% + 1rem));
  width: min(1240px, calc(100vw - 2rem));
  z-index: 20;
  grid-template-columns: minmax(14rem, 1.2fr) minmax(14rem, 1.2fr) minmax(11rem, 1fr) minmax(22rem, 2fr) auto;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(251, 248, 242, 0.96), rgba(245, 241, 234, 0.96));
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    max-height 180ms ease,
    border-color 180ms ease;
}

.batch-toolbar.selection-active,
.batch-toolbar[data-selection-visible="true"] {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  max-height: 18rem;
}

.online-results-toolbar {
  display: grid;
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(calc(100% + 1rem));
  width: min(1240px, calc(100vw - 2rem));
  z-index: 22;
  grid-template-columns: minmax(14rem, 1.2fr) auto minmax(14rem, 1fr) minmax(12rem, 1fr) auto;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(251, 248, 242, 0.96), rgba(245, 241, 234, 0.96));
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    max-height 180ms ease,
    border-color 180ms ease;
}

.online-results-toolbar.selection-active,
.online-results-toolbar[data-selection-visible="true"] {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  max-height: 14rem;
}

.online-results-toolbar.selection-active {
  border-color: var(--border-strong);
}

/* Wrapper that groups Clear + Add Selected. On desktop it's transparent to
   the parent grid (display:contents); on mobile it becomes a flex row so
   both buttons sit side by side instead of stacking into separate rows. */
.online-results-button-row {
  display: contents;
}

.batch-toolbar.selection-active {
  border-color: var(--border-strong);
}

.batch-selection-meta,
.batch-field-group {
  display: grid;
  gap: 0.5rem;
}

.batch-conditional-field-group {
  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}

.batch-selector-row {
  display: contents;
}

.batch-conditional-slot {
  display: grid;
  align-self: end;
}

.batch-conditional-slot .batch-field-group {
  grid-column: 1;
  grid-row: 1;
}

.batch-field-group-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.batch-apply-wrap {
  align-self: end;
}

.batch-toolbar .toolbar-end.batch-apply-wrap {
  display: inline-flex;
  align-items: end;
  gap: 0.55rem;
  width: auto;
}

.batch-toolbar .toolbar-end.batch-apply-wrap .button {
  width: auto;
  min-width: 7rem;
}

.selection-clear-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  min-width: 2.2rem;
  min-height: 2.2rem;
  border: 1px solid rgba(91, 94, 96, 0.2);
  border-radius: 0.75rem;
  background: rgba(255, 253, 249, 0.84);
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.selectable-card {
  position: relative;
}

.selectable-card.selected {
  border-color: var(--accent);
}

.selectable-card .cover-card-link {
  transition: opacity 140ms ease;
}

.selectable-card.selected .cover-card-link {
  opacity: 0.92;
}

.select-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.bulk-select-toggle {
  min-height: 3.2rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
}

.quick-batch-actions {
  align-items: stretch;
}

.cover-search-modal {
  width: min(1080px, calc(100vw - 2rem));
  border: 1px solid var(--border-strong);
  padding: 1.5rem;
  background: var(--surface);
  color: var(--text);
}

.field-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.turnstile-wrap {
  display: flex;
  justify-content: flex-start;
}

.cover-search-modal::backdrop {
  background: rgba(30, 35, 41, 0.45);
}

.modal-search-panel {
  grid-template-columns: minmax(0, 1fr) auto;
}

.cover-modal-results[aria-busy="true"] {
  opacity: 0.86;
  pointer-events: none;
}

.modal-cover-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.cover-choice-grid {
  display: grid;
  gap: 0.75rem;
}

.cover-choice {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.cover-search-results-skeleton .cover-choice {
  border-top: 0;
  padding-top: 0;
}

.choice-cover {
  aspect-ratio: 2 / 3;
  width: 100%;
  max-width: 10rem;
}

.hidden {
  display: none !important;
}

.catalog-load-sentinel {
  width: 100%;
  height: 1px;
}

.lookup-results-skeleton {
  padding-top: 0.75rem;
}

.catalog-search-status {
  align-self: center;
  color: var(--muted);
  white-space: nowrap;
}
.mobile-bottom-bar {
  display: none;
}

.mobile-topbar-menu {
  display: none;
}

.mobile-menu-form {
  margin: 0;
}

.mobile-menu-trigger,
.mobile-menu-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-menu-link {
  min-height: 2.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.9);
  color: var(--text);
  justify-content: flex-start;
}

.mobile-menu-link.danger {
  color: #8d3129;
}

.mobile-nav-icon {
  font-size: 1rem;
  line-height: 1;
}

.mobile-nav-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.barcode-scanner-modal {
  width: min(30rem, calc(100vw));
  max-width: calc(100vw);
  border: 1px solid var(--border-strong);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  overflow-x: hidden;
}

.barcode-scanner-modal::backdrop {
  background: rgba(30, 35, 41, 0.45);
}

.barcode-scanner-sheet {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  min-width: 0;
  border-radius: 1rem;
}

.barcode-scanner-topbar,
.barcode-scanner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.barcode-scanner-close {
  width: 2.8rem;
  min-width: 2.8rem;
  min-height: 2.8rem;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.82);
  font-size: 1.25rem;
  cursor: pointer;
}

.barcode-scanner-stage {
  display: grid;
  gap: 0.9rem;
}

.barcode-scanner-frame {
  position: relative;
  min-height: 22rem;
  overflow: hidden;
  background: #0f1418;
}

.barcode-scanner-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.barcode-scanner-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0f1418;
}

.barcode-scan-reticle {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.barcode-scan-reticle::before {
  content: "";
  width: min(72vw, 18rem);
  height: min(34vw, 11rem);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 999px rgba(15, 20, 24, 0.34);
}

.barcode-scan-reticle-cover::before {
  content: none;
}

.barcode-scan-window {
  width: min(60vw, 15rem);
  height: min(86vw, 22rem);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 999px rgba(15, 20, 24, 0.34);
}

.barcode-scan-window-cover {
  width: min(60vw, 15rem);
  height: min(86vw, 22rem);
}

.barcode-corner {
  position: absolute;
  width: 1.6rem;
  height: 1.6rem;
  border-color: #ffffff;
  border-style: solid;
  border-width: 0;
}

.barcode-corner-tl {
  top: calc(50% - min(17vw, 5.5rem));
  left: calc(50% - min(36vw, 9rem));
  border-top-width: 3px;
  border-left-width: 3px;
}

.barcode-corner-tr {
  top: calc(50% - min(17vw, 5.5rem));
  right: calc(50% - min(36vw, 9rem));
  border-top-width: 3px;
  border-right-width: 3px;
}

.barcode-corner-bl {
  bottom: calc(50% - min(17vw, 5.5rem));
  left: calc(50% - min(36vw, 9rem));
  border-bottom-width: 3px;
  border-left-width: 3px;
}

.barcode-corner-br {
  bottom: calc(50% - min(17vw, 5.5rem));
  right: calc(50% - min(36vw, 9rem));
  border-bottom-width: 3px;
  border-right-width: 3px;
}

.barcode-scanner-status-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.84);
}

.barcode-scanner-batch-toggle {
  margin-top: 0.25rem;
}

.barcode-scanner-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.barcode-scanner-debug {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.barcode-upload-trigger {
  flex: 1 1 auto;
}

.cover-ocr-review {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(91, 94, 96, 0.14);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.58);
}

.cover-ocr-review textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.cover-ocr-progress {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(91, 94, 96, 0.14);
}

.cover-ocr-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(52, 84, 118, 0.86), rgba(92, 124, 158, 0.94));
  transition: width 180ms ease;
}

.camera-modal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.barcode-action-card {
  cursor: pointer;
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.4rem;
  min-height: 4.35rem;
  padding: 0.65rem 0.45rem 0.55rem;
  border: 1px solid rgba(91, 94, 96, 0.16);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(255, 254, 251, 0.9), rgba(244, 239, 231, 0.88));
  color: rgba(30, 35, 41, 0.82);
  text-align: center;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 6px 18px rgba(73, 62, 43, 0.08);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    background-color 160ms ease;
}

.barcode-action-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(29, 77, 69, 0), rgba(29, 77, 69, 0));
  transform: scale(0.92);
  opacity: 0;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background-color 180ms ease;
}

.barcode-action-card .mobile-nav-icon-wrap,
.barcode-action-card .mobile-bottom-label {
  position: relative;
  z-index: 1;
}

.barcode-action-card .mobile-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transform: translateY(0);
  transition:
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    color 180ms ease;
}

.barcode-action-card .mobile-bottom-label {
  max-width: 6.5rem;
  line-height: 1.12;
  white-space: normal;
}

.camera-modal-action-request {
  grid-column: 1;
}

.camera-modal-action-capture {
  grid-column: 2;
}

.camera-modal-action-upload {
  grid-column: 3;
}

.barcode-action-card:hover,
.barcode-action-card:focus-visible,
.barcode-action-card-primary {
  color: var(--accent);
  border-color: rgba(29, 77, 69, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 10px 24px rgba(29, 77, 69, 0.14);
}

.barcode-action-card:hover::before,
.barcode-action-card:focus-visible::before,
.barcode-action-card-primary::before {
  background: linear-gradient(180deg, rgba(29, 77, 69, 0.08), rgba(29, 77, 69, 0.14));
  transform: scale(1);
  opacity: 1;
}

.barcode-action-card:hover .mobile-nav-icon,
.barcode-action-card:focus-visible .mobile-nav-icon,
.barcode-action-card-primary .mobile-nav-icon {
  transform: translateY(-0.08rem) scale(1.04);
  background: rgba(255, 252, 247, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 4px 14px rgba(29, 77, 69, 0.12);
}

.barcode-action-card:focus-visible {
  outline: 2px solid rgba(29, 77, 69, 0.22);
  outline-offset: 2px;
}

.batch-delete-confirm-modal {
  width: min(28rem, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  border: 1px solid var(--border-strong);
  padding: 0;
  background: var(--surface);
  color: var(--text);
}

.batch-delete-confirm-modal::backdrop {
  background: rgba(30, 35, 41, 0.45);
}

.batch-delete-confirm-sheet {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.batch-delete-confirm-input {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.batch-delete-confirm-actions {
  justify-content: flex-end;
}

.batch-undo-toast {
  position: fixed;
  top: calc(var(--catalogue-topbar-height) + 1rem);
  right: 1rem;
  z-index: 72;
  display: grid;
  gap: 0.85rem;
  width: min(24rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(251, 248, 242, 0.98), rgba(245, 241, 234, 0.98));
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(30, 35, 41, 0.12);
}

.series-details-modal {
  width: min(40rem, calc(100vw - 1rem));
}

.series-details-shell {
  max-height: min(80vh, 42rem);
  overflow-y: auto;
}

.series-details-sheet {
  display: grid;
  gap: 1rem;
}

.series-details-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.series-coverage-card {
  display: grid;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  background: var(--surface-raised, rgba(255, 255, 255, 0.72));
}

.catalogue-series-details-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  cursor: pointer;
}

.catalogue-series-details-trigger:hover,
.catalogue-series-details-trigger:focus-visible {
  color: var(--accent-strong);
}

.error-text {
  color: var(--danger-strong, #8c2f39);
}
/* ─── Base integration list layout ─────────────────────────────────────────── */

.integration-list {
  gap: 0;
}

/* ─── Category blocks ───────────────────────────────────────────────────────── */

.settings-category {
  margin-top: 1.75rem;
}

.settings-category:first-child {
  margin-top: 0;
}

.settings-category-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.settings-category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-strong));
  color: var(--accent);
  font-size: 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
}

.settings-category-copy {
  min-width: 0;
}

.settings-category-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 0.12rem;
}

.settings-category-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

/* ─── Integration cards ─────────────────────────────────────────────────────── */

.integration-card {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface-strong);
  overflow: hidden;
  margin-bottom: 0.6rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.integration-card:last-child {
  margin-bottom: 0;
}

.integration-card:has(.integration-summary:hover),
.integration-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
  box-shadow: 0 2px 8px rgba(29, 77, 69, 0.07);
}

.integration-card[open] {
  border-color: color-mix(in srgb, var(--accent) 18%, var(--border));
}

/* Remove old flat border style when using cards */
.integration-list .integration-card {
  border-top: 1px solid var(--border);
}

/* ─── Summary row ───────────────────────────────────────────────────────────── */

.integration-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.integration-summary::-webkit-details-marker {
  display: none;
}

.integration-summary-lead {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1 1 auto;
}

.integration-provider-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--surface-strong) 78%, var(--border) 22%);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
  overflow: hidden;
}

.integration-provider-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.integration-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-width: 0;
}

.integration-item-title {
  font-size: 0.93rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.integration-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.4rem;
  height: 1.4rem;
  color: var(--muted);
  transition: transform 200ms ease, color 160ms ease;
}

.integration-chevron svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

details[open] .integration-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.integration-summary-trail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

/* ─── Status pill variants ──────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill-enabled,
.pill[data-status="enabled"] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.pill-disabled,
.pill[data-status="disabled"] {
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  color: var(--muted);
  border-color: color-mix(in srgb, var(--muted) 18%, transparent);
}

.pill-warning,
.pill[data-status="warning"] {
  background: rgba(180, 100, 20, 0.1);
  color: #8a5a10;
  border-color: rgba(180, 100, 20, 0.2);
}

/* ─── Body / expanded content ───────────────────────────────────────────────── */

.integration-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.integration-body .section-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.65rem;
}

/* ─── Connection health ─────────────────────────────────────────────────────── */

.integration-health {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.integration-health::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--muted);
}

.integration-health-ok::before   { background: #2e9e6b; }
.integration-health-error::before { background: #c0392b; }
.integration-health-warning::before { background: #c07a20; }
.integration-health-unchecked::before { background: var(--muted); }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */

.integration-inline-toast {
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ─── Actions ───────────────────────────────────────────────────────────────── */

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.75rem;
}

/* ─── Switch field ──────────────────────────────────────────────────────────── */

.toggle-field,
.switch-field {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  min-height: 2.8rem;
  padding: 0.2rem 0;
}

.switch-field-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.switch-field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* ─── M3 Switch ─────────────────────────────────────────────────────────────── */

.m3-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 3.25rem;
  height: 2rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.m3-switch input[type="checkbox"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}

.m3-switch input[type="hidden"] {
  display: none;
}

.m3-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d6d0c6;
  border: 2px solid #8f8b83;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.m3-switch-handle {
  position: absolute;
  top: 50%;
  left: 0.3rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #5b5a57;
  transform: translateY(-50%);
  transition: transform 180ms ease, width 160ms ease, height 160ms ease, background-color 160ms ease;
  z-index: 2;
}

.m3-switch input[type="checkbox"]:checked + .m3-switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.m3-switch input[type="checkbox"]:checked ~ .m3-switch-handle {
  background: #f8fbf9;
  transform: translate(1.25rem, -50%);
}

.m3-switch input[type="checkbox"]:focus-visible + .m3-switch-track {
  outline: 2px solid rgba(29, 77, 69, 0.22);
  outline-offset: 3px;
}

.m3-switch input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.m3-switch input[type="checkbox"]:disabled + .m3-switch-track {
  background: rgba(214, 208, 198, 0.55);
  border-color: rgba(143, 139, 131, 0.5);
}

.m3-switch input[type="checkbox"]:disabled ~ .m3-switch-handle {
  background: rgba(91, 90, 87, 0.55);
}

.m3-switch input[type="checkbox"]:checked:disabled + .m3-switch-track {
  background: color-mix(in srgb, var(--accent) 60%, white);
  border-color: color-mix(in srgb, var(--accent) 65%, #9aa89f);
}

.m3-switch input[type="checkbox"]:checked:disabled ~ .m3-switch-handle {
  background: rgba(248, 251, 249, 0.82);
}

.switch-field:has(input[type="checkbox"]:disabled) {
  opacity: 0.82;
  cursor: default;
}

.integration-form.is-saving .m3-switch {
  opacity: 0.65;
}

/* ─── Admin users table ─────────────────────────────────────────────────────── */

.admin-users-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  margin-top: 0.5rem;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-users-table thead th {
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-strong) 60%, var(--border) 40%);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-users-table thead th:first-child {
  border-radius: 0.75rem 0 0 0;
}

.admin-users-table thead th:last-child {
  border-radius: 0 0.75rem 0 0;
}

.admin-users-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 120ms ease;
}

.admin-users-table tbody tr:last-child {
  border-bottom: 0;
}

.admin-users-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-strong));
}

.admin-users-table tbody td {
  padding: 0.7rem 0.9rem;
  vertical-align: middle;
}

.admin-users-table .user-username {
  font-weight: 600;
  color: var(--text);
}

.admin-users-table .user-email {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-users-table .user-date {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-users-table .user-book-count {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 0.85rem;
}

.admin-users-table .user-actions {
  text-align: right;
}

/* Pending badge */
.user-status-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(180, 100, 20, 0.1);
  color: #7a4a05;
  border: 1px solid rgba(180, 100, 20, 0.2);
}

.user-status-approved {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ─── Empty admin state ─────────────────────────────────────────────────────── */

.admin-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────  */

@media (max-width: 760px) {
  .settings-category-heading {
    gap: 0.6rem;
  }

  .settings-category-icon {
    width: 1.85rem;
    height: 1.85rem;
    font-size: 0.9rem;
  }

  .integration-summary {
    padding: 0.75rem 0.85rem;
    gap: 0.55rem;
  }

  .integration-body {
    padding: 0 0.85rem 0.85rem;
  }

  /* Stack the summary on very narrow screens */
  .integration-summary-lead {
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .integration-item-title {
    font-size: 0.88rem;
  }

  /* Make table scroll horizontally */
  .admin-users-table-wrap {
    border-radius: 0.6rem;
  }

  .admin-users-table thead th,
  .admin-users-table tbody td {
    padding: 0.55rem 0.65rem;
  }

  /* Hide less critical columns on small screens */
  .admin-users-table .col-last-active {
    display: none;
  }

  .integration-actions {
    flex-direction: column;
  }

  .integration-actions .button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .admin-users-table .col-requested,
  .admin-users-table .col-approved {
    display: none;
  }
}

.auth-wrap {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(30rem, 100%);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.empty-state {
  padding: 1.2rem 0 0;
  border-top: 1px solid var(--border);
}

.shelf-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.shelf-card {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

@media (max-width: 980px) {
  .modal-search-panel,
  .batch-toolbar,
  .editor-layout,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-cover,
  .preview-panel .detail-cover {
    max-width: 16rem;
  }

  .metadata-grid {
    grid-template-columns: 1fr;
  }

  .catalogue-page.catalogue-condensed .search-panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 1.5rem, 100%);
    padding-top: 0.55rem;
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }

  .page > .card,
  .page > .hero,
  .page > .form-panel,
  .page > .empty-state {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .topbar,
  .topbar-actions,
  .topbar-nav,
  .topbar-utility,
  .toolbar,
  .result-actions,
  .form-actions,
  .hero-header,
  .hero-actions,
  .toolbar-end,
  .section-heading,
  .integration-summary,
  .detail-actions,
  .detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
    padding: 0.1rem 0 0.55rem;
  }

  .brand-block {
    min-width: 0;
    padding-left: 1rem;
    flex: 1 1 auto;
  }

  .catalogue-controls {
    top: calc(var(--catalogue-topbar-height) - 1px);
    gap: 0.6rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    padding-top: 0;
    padding-bottom: 0.65rem;
  }

  .page-title {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .stats,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .cover-grid,
  .shelf-grid {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  }

  .brand-kicker,
  .tagline,
  .section-subtitle {
    display: none;
  }

  .topbar-library-size {
    font-size: 0.74rem;
    padding: 0.3rem 0.58rem;
  }

  .brand {
    font-size: 1.1rem;
    letter-spacing: 0.06em;
  }

  .topbar-actions {
    display: none;
  }

  .mobile-topbar-menu {
    position: relative;
    display: block;
    width: auto;
    margin-left: auto;
    flex: 0 0 auto;
  }

  body.selection-mode-active .mobile-topbar-menu {
    display: none;
  }

  .mobile-menu-trigger {
    width: auto;
    min-height: 2.75rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    background: rgba(255, 253, 249, 0.78);
    justify-content: center;
    gap: 0.45rem;
    list-style: none;
    cursor: pointer;
  }

  .mobile-topbar-menu > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-menu-sheet {
    position: absolute;
    right: 0;
    min-width: 13rem;
    margin-top: 0.45rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: rgba(251, 248, 242, 0.98);
  }

  .hero-header {
    gap: 0.5rem;
  }

  .section-heading {
    display: flex;
    flex-direction: row;
    align-items: end;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.6rem;
  }

  .section-heading > :first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .section-title {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
    align-items: stretch;
  }

  .search-field {
    grid-column: auto;
  }

  .search-panel .field label,
  .catalogue-view-switch .field label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
  }

  .search-panel .field input,
  .search-panel .field select,
  .search-panel .button,
  .catalogue-view-switch .field select,
  .filter-chip {
    min-height: 2.75rem;
    padding: 0.68rem 0.8rem;
  }

  .search-bar-shell {
    min-height: 3.1rem;
    padding-left: 0.5rem;
    padding-right: 0.32rem;
    background: rgba(255, 253, 249, 0.92);
  }

  .search-bar-action {
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
  }

  .catalogue-view-switch {
    display: grid;
    grid-template-columns: minmax(6.8rem, 8.2rem) auto;
    align-items: end;
    gap: 0.65rem;
    width: auto;
    margin-left: auto;
    flex: 0 0 auto;
    flex-direction: row;
  }

  .catalogue-heading-action {
    align-self: end;
  }

  .catalogue-view-switch {
    border-left: 0;
    padding-left: 0;
  }

  .catalogue-mobile-hide {
    display: none !important;
  }

  .catalogue-filters-toggle {
    display: inline-flex;
  }

  .catalogue-filters-toggle .section-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  .catalogue-heading-title-desktop {
    display: none;
  }

  .catalogue-mobile-shelf-filter {
    min-width: 0;
    width: auto;
  }

  .catalogue-mobile-shelf-filter label {
    display: none;
  }

  .catalogue-mobile-shelf-filter select {
    width: 100%;
  }

  .catalogue-layout-switch {
    display: flex;
    flex-direction: row;
    align-items: end;
    gap: 0.45rem;
    min-width: auto;
    justify-self: end;
  }

  .catalogue-layout-switch .meta-label {
    display: none;
  }

  .catalogue-layout-switch .result-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
  }

  .catalogue-layout-button {
    flex: 0 0 2.6rem;
    width: 2.6rem;
    min-width: 2.6rem;
    min-height: 2.75rem;
    padding: 0.45rem;
  }

  .catalogue-view-form,
  .catalogue-view-switch .field,
  .inline-filter-group {
    flex: 0 0 auto;
    min-width: 8.5rem;
  }

  .search-sort-field {
    display: none;
  }

  .mobile-status-filter {
    display: grid;
  }

  .filter-strip {
    display: none;
  }

  .settings-tabs {
    display: flex;
    margin-left: 0.4rem;
    margin-right: 0.4rem;
    padding-bottom: 0.1rem;
  }

  .settings-tab {
    width: auto;
    min-width: max-content;
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }

  .mobile-catalogue-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .mobile-catalogue-tab-form .filter-chip {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .mobile-advanced-filters {
    display: block;
    border-top: 1px solid var(--border);
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    padding-top: 0.2rem;
  }

  .mobile-advanced-filters > summary {
    display: none;
  }

  .mobile-advanced-filters > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-advanced-filters-body {
    display: grid;
    gap: 0.75rem;
    padding-top: 0.7rem;
  }

  .mobile-advanced-actions {
    justify-content: stretch;
  }

  .mobile-advanced-actions .button {
    width: 100%;
  }

  .mobile-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    padding: 0.75rem 0.85rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(30, 35, 41, 0.07);
    background:
      linear-gradient(180deg, rgba(255, 252, 246, 0.88), rgba(247, 242, 233, 0.96));
    backdrop-filter: blur(20px);
    box-shadow: 0 -12px 34px rgba(30, 35, 41, 0.1);
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .mobile-bottom-bar.mobile-bottom-bar-hidden {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    opacity: 0.92;
  }

  .mobile-bottom-link {
    cursor: pointer;
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.3rem;
    min-height: 4.15rem;
    padding: 0.55rem 0.4rem 0.48rem;
    border: 1px solid rgba(91, 94, 96, 0.16);
    background: linear-gradient(180deg, rgba(255, 254, 251, 0.9), rgba(244, 239, 231, 0.88));
    color: rgba(30, 35, 41, 0.8);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 1rem;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.75),
      0 6px 18px rgba(73, 62, 43, 0.08);
    transition:
      border-color 160ms ease,
      background-color 160ms ease,
      box-shadow 160ms ease,
      color 160ms ease,
      transform 160ms ease;
  }

  .mobile-bottom-link.active,
  .mobile-bottom-link-primary {
    color: var(--accent);
    border-color: rgba(29, 77, 69, 0.24);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.75),
      0 10px 24px rgba(29, 77, 69, 0.14);
  }

  .mobile-bottom-link:focus-visible {
    outline: 2px solid rgba(29, 77, 69, 0.22);
    outline-offset: 2px;
  }

  .mobile-bottom-link::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(29, 77, 69, 0), rgba(29, 77, 69, 0));
    transform: scale(0.9);
    opacity: 0;
    transition:
      opacity 180ms ease,
      transform 180ms ease,
      background-color 180ms ease;
  }

  .mobile-bottom-link.active::before,
  .mobile-bottom-link-primary::before {
    background: linear-gradient(180deg, rgba(29, 77, 69, 0.08), rgba(29, 77, 69, 0.14));
    transform: scale(1);
    opacity: 1;
  }

  .mobile-bottom-link .mobile-nav-icon-wrap,
  .mobile-bottom-link .mobile-bottom-label {
    position: relative;
    z-index: 1;
  }

  .mobile-bottom-link .mobile-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.56);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    transform: translateY(0);
    transition:
      background-color 180ms ease,
      box-shadow 180ms ease,
      transform 180ms ease,
      color 180ms ease;
  }

  .mobile-bottom-link.active .mobile-nav-icon,
  .mobile-bottom-link-primary .mobile-nav-icon {
    transform: translateY(-0.08rem) scale(1.04);
    background: rgba(255, 252, 247, 0.9);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.82),
      0 4px 14px rgba(29, 77, 69, 0.12);
  }

  .mobile-bottom-label {
    display: block;
    white-space: normal;
    line-height: 1.12;
    max-width: 6.5rem;
    transition:
      color 180ms ease,
      transform 180ms ease,
      opacity 180ms ease;
  }

  .mobile-bottom-link.active .mobile-bottom-label,
  .mobile-bottom-link-primary .mobile-bottom-label {
    transform: translateY(-0.04rem);
  }

  .barcode-scanner-modal {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    border: 0;
    background: rgba(11, 16, 18, 0.98);
    color: #f5f5f3;
    overflow-x: hidden;
  }

  .barcode-scanner-sheet {
    min-height: 100vh;
    padding: calc(0.8rem + env(safe-area-inset-top, 0px)) 0.9rem calc(1rem + env(safe-area-inset-bottom, 0px));
    grid-template-rows: auto 1fr;
    width: 100%;
    min-width: 0;
  }

  .barcode-scanner-topbar {
    align-items: start;
    flex-wrap: wrap;
  }

  .barcode-scanner-topbar .section-title,
  .barcode-scanner-topbar .eyebrow {
    color: #f5f5f3;
  }

  .barcode-scanner-close,
  .barcode-scanner-rescan.button.ghost {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f3;
  }

  .barcode-scanner-stage {
    align-content: space-between;
  }

  .barcode-scanner-frame {
    min-height: min(58vh, 30rem);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .barcode-scanner-status-card {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(16, 24, 27, 0.92);
  }

  .barcode-scanner-status-card .meta-line,
  .barcode-scanner-hint {
    color: rgba(245, 245, 243, 0.82);
  }

  .barcode-scanner-debug {
    color: rgba(245, 245, 243, 0.72);
  }

  .barcode-scanner-actions {
    flex-wrap: wrap;
  }

  .barcode-upload-trigger,
  .barcode-scanner-actions .button {
    width: 100%;
  }

  .camera-modal-actions {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .barcode-action-card {
    min-height: 4.15rem;
    padding: 0.55rem 0.4rem 0.48rem;
  }

  .batch-toolbar {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    transform: translateY(calc(100% + 1rem + env(safe-area-inset-bottom, 0px)));
    grid-template-columns: 1fr;
    gap: 0.85rem;
    z-index: 61;
    padding: 0.8rem 0.8rem 0.9rem;
    max-height: min(68vh, 34rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .batch-toolbar.selection-active,
  .batch-toolbar[data-selection-visible="true"] {
    transform: translateY(0);
    max-height: min(68vh, 34rem);
  }

  .batch-toolbar.batch-toolbar-with-bottom-nav {
    bottom: calc(var(--mobile-bottom-bar-height) + 1rem + env(safe-area-inset-bottom, 0px));
  }

  .batch-action-group,
  .batch-target-slot {
    min-width: 0;
  }

  .batch-target-slot .batch-field-group {
    min-width: 0;
  }

  .online-results-toolbar.online-results-toolbar-with-bottom-nav {
    bottom: calc(var(--mobile-bottom-bar-height) + 1rem + env(safe-area-inset-bottom, 0px));
  }

  .batch-selection-meta .result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
  }

  .batch-selection-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 0.75rem;
    align-items: center;
  }

  .batch-selection-meta > .eyebrow {
    margin: 0;
  }

  .selection-clear-icon {
    width: 2.2rem;
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0;
    border-radius: 0.7rem;
    font-size: 0.95rem;
  }

  .bulk-select-toggle {
    justify-self: end;
    align-self: start;
    min-height: auto;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  .batch-field-group {
    gap: 0.4rem;
  }

  .batch-toolbar .batch-selector-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
    grid-column: 1 / -1;
  }

  .batch-toolbar .field.batch-action-group,
  .batch-toolbar .batch-target-slot,
  .batch-toolbar .batch-target-slot .batch-field-group {
    min-width: 0;
  }

  .batch-toolbar .field.batch-action-group,
  .batch-toolbar .batch-target-slot .batch-field-group {
    display: grid;
    gap: 0.4rem;
  }

  .batch-toolbar .batch-apply-wrap {
    grid-column: 3;
    align-self: end;
  }

  .batch-toolbar .field.batch-action-group > select,
  .batch-toolbar .batch-target-slot .batch-field-group > select {
    width: 100%;
    min-width: 0;
  }

  .batch-field-group-hidden {
    display: none;
  }

  .batch-field-group > label,
  .batch-field-group > .eyebrow {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
  }

  .batch-toolbar .field select,
  .batch-toolbar .button {
    min-height: 2.65rem;
  }

  .batch-toolbar .toolbar-end.batch-apply-wrap {
    width: auto;
    justify-content: flex-end;
    padding-top: 0;
    padding-bottom: 0.45rem;
    background: none;
    position: static;
    z-index: auto;
  }

  .batch-toolbar .toolbar-end.batch-apply-wrap .button {
    width: auto;
    min-width: 5.5rem;
    flex: 0 0 auto;
  }

  .batch-delete-confirm-modal {
    width: calc(100vw - 1rem);
    max-width: calc(100vw - 1rem);
  }

  .batch-undo-toast {
    left: 0.75rem;
    right: 0.75rem;
    top: auto;
    bottom: calc(var(--mobile-bottom-bar-height) + 1rem + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .profile-password-modal {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    border: 0;
    background: rgba(11, 16, 18, 0.98);
    color: #f5f5f3;
  }

  .profile-password-sheet {
    min-height: 100vh;
    padding: calc(0.8rem + env(safe-area-inset-top, 0px)) 0.9rem calc(1rem + env(safe-area-inset-bottom, 0px));
    width: 100%;
  }

  .profile-password-topbar {
    align-items: flex-start;
    gap: 0.9rem;
  }

  .profile-password-topbar .section-title,
  .profile-password-topbar .eyebrow,
  .profile-password-topbar .section-subtitle {
    color: #f5f5f3;
  }

  .profile-password-close {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #f5f5f3;
  }

  .quick-batch-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 0.65rem;
    align-items: end;
  }

  .quick-batch-actions .button {
    width: 100%;
    min-width: 0;
  }

  .quick-batch-actions .selection-clear-icon {
    align-self: center;
    justify-self: end;
    margin-bottom: 0.05rem;
  }
}

@media (max-width: 1120px) {
  .cover-grid:not(.cover-grid-row) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .cover-grid:not(.cover-grid-row) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cover-grid.cover-grid-online:not(.online-series-grid):has([data-deferred-cover-root]) {
  grid-template-columns: auto;
}

@media (prefers-reduced-motion: reduce) {
  .batch-toolbar {
    transition: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 1.25rem, 100%);
  }

  .page > .card,
  .page > .hero,
  .page > .form-panel,
  .page > .empty-state {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .catalogue-controls,
  .mobile-catalogue-tabs,
  .mobile-advanced-filters,
  .catalog-pages,
  .lookup-results,
  .detail-layout,
  .editor-layout,
  .shelf-grid,
  .cover-grid {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .cover-grid,
  .shelf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cover-grid.cover-grid-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .cover-card-row {
    grid-column: 1 / -1;
  }

  .button,
  .nav-link,
  .nav-button,
  .filter-chip {
    width: 100%;
  }

  .filter-chip {
    padding-left: 0;
    padding-right: 0;
  }

  .search-primary-actions,
  .search-secondary-actions,
  .catalogue-view-switch {
    width: 100%;
  }

  .catalogue-view-switch {
    width: auto;
    flex: 0 0 auto;
  }

  .search-primary-actions .button,
  .search-secondary-actions .button,
  .catalogue-view-switch .filter-chip {
    width: auto;
  }

  .search-bar-shell {
    min-height: 3.1rem;
  }

  /* Stack the batch toolbar row controls vertically so each dropdown gets
     full width. The ≤760px breakpoint puts them in a 3-column row that
     leaves ~140px per dropdown on a 390px phone — too narrow to read shelf
     names. Stacking also makes the Apply button a clear, full-width tap
     target at the bottom of the sheet. */
  .batch-toolbar .batch-selector-row {
    grid-template-columns: 1fr;
  }

  .batch-toolbar .batch-apply-wrap {
    grid-column: 1;
    align-self: stretch;
  }

  .batch-toolbar .toolbar-end.batch-apply-wrap {
    justify-content: stretch;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
  }

  .batch-toolbar .toolbar-end.batch-apply-wrap .button {
    width: 100%;
    min-width: unset;
  }

  .batch-toolbar .field.batch-action-group > select,
  .batch-toolbar .batch-target-slot .batch-field-group > select {
    font-size: 1rem; /* prevents iOS auto-zoom on focus */
  }
}

@media (max-width: 420px) {
  .cover-grid:not(.cover-grid-row),
  .shelf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-panel {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Mobile M3-style scan FAB. Replaces the old mobile bottom bar. */
.mobile-scan-fab {
  display: none;
}

@media (max-width: 760px) {
  .mobile-bottom-bar {
    display: none !important;
  }

  .mobile-scan-fab {
    appearance: none;
    position: fixed;
    left: 50%;
    right: auto;
    bottom: calc(1.3rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 70;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 5.5rem;
    height: 5.5rem;
    min-width: 4rem;
    min-height: 4rem;
    padding: 0;

    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #f8fbf9;
    cursor: pointer;

    box-shadow:
      0 6px 16px rgba(30, 35, 41, 0.18),
      0 10px 28px rgba(29, 77, 69, 0.22);

    -webkit-tap-highlight-color: transparent;

    transition:
      transform 180ms ease,
      opacity 180ms ease,
      box-shadow 180ms ease,
      background-color 180ms ease;
  }

  .mobile-scan-fab:hover,
  .mobile-scan-fab:focus-visible {
    background: color-mix(in srgb, var(--accent) 88%, white 12%);
    box-shadow:
      0 8px 18px rgba(30, 35, 41, 0.2),
      0 14px 34px rgba(29, 77, 69, 0.26);
  }

  .mobile-scan-fab:focus-visible {
    outline: 3px solid rgba(29, 77, 69, 0.24);
    outline-offset: 3px;
  }

  .mobile-scan-fab:active {
    transform: translateX(-50%) scale(0.96);
  }

  .mobile-scan-fab svg {
    width: 2rem;
    height: 2rem;
    min-width: 1.65rem;
    min-height: 1.65rem;
    fill: currentColor;
  }

  .mobile-scan-fab-hidden {
    transform: translateX(-50%) translateY(calc(100% + 1.5rem + env(safe-area-inset-bottom, 0px)));
    opacity: 0;
    pointer-events: none;
  }

  body.selection-mode-active .mobile-scan-fab,
  body:has(.online-results-toolbar.selection-active) .mobile-scan-fab,
  body:has(.online-results-toolbar[data-selection-visible="true"]) .mobile-scan-fab {
    transform: translateX(-50%) translateY(calc(100% + 1.5rem + env(safe-area-inset-bottom, 0px)));
    opacity: 0;
    pointer-events: none;
  }

  /* Online-results toolbar: stack columns vertically on mobile, matching the
     batch-toolbar treatment. Desktop uses a 5-column grid that is far too
     wide for phone viewports. */
  .online-results-toolbar {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    transform: translateX(0) translateY(calc(100% + 1rem + env(safe-area-inset-bottom, 0px)));
    grid-template-columns: 1fr;
    gap: 0.85rem;
    z-index: 61;
    padding: 0.8rem 0.8rem 0.9rem;
    max-height: min(68vh, 34rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .online-results-toolbar.selection-active,
  .online-results-toolbar[data-selection-visible="true"] {
    transform: translateX(0) translateY(0);
  }

  .online-results-toolbar .batch-selection-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 0.75rem;
    align-items: center;
  }

  .online-results-toolbar .batch-field-group {
    gap: 0.4rem;
  }

  .online-results-toolbar .batch-field-group select {
    width: 100%;
    min-height: 2.65rem;
    font-size: 1rem; /* prevent iOS auto-zoom */
  }

  /* Show Clear + Add Selected side by side as a full-width pair. */
  .online-results-button-row {
    display: flex;
    gap: 0.6rem;
  }

  .online-results-button-row .quick-batch-actions {
    flex: 1 1 0;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .online-results-button-row .button {
    width: 100%;
    min-height: 2.65rem;
  }

  /* The save-mode note adds no interactivity — hide it on mobile to keep
     the sheet compact. */
  .online-results-save-mode-note {
    display: none;
  }

  .barcode-scanner-modal[data-isbn-scanner-modal] {
    width: min(34rem, calc(100vw));
    max-width: calc(100vw);
    margin: 0px auto;
    padding-top: 5vh;
  }

  .barcode-scanner-modal[data-isbn-scanner-modal] .barcode-scanner-frame {
    min-height: min(76vh, 760px);
    height: min(76vh, 760px);
    max-height: 82vh;
  }

  .barcode-scanner-modal[data-isbn-scanner-modal] .barcode-scanner-frame video {
    min-height: 100%;
  }
}

@media (min-width: 761px) {
  .mobile-scan-fab {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .barcode-scanner-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #0b1012;
    overflow: hidden;
  }

  .barcode-scanner-modal::backdrop {
    background: #0b1012;
  }

  .barcode-scanner-sheet {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    display: block;
    overflow: hidden;
    position: relative;
  }

  .barcode-scanner-stage {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    display: block;
    position: relative;
    overflow: hidden;
  }

  .barcode-scanner-frame {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #0f1418;
    position: relative;
  }

  .barcode-scanner-frame video,
  .barcode-scanner-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .barcode-scanner-status-card {
    display: none !important;
  }

  .barcode-scanner-topbar {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
  }

  .barcode-scanner-topbar > *:not([data-close-isbn-scanner]) {
    display: none !important;
  }

  [data-close-isbn-scanner] {
    position: fixed;
    left: 50%;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 30;

    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    min-height: 4rem;
    padding: 0;
    margin: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 999px;
    background: #d32f2f;
    color: transparent;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;

    box-shadow:
      0 6px 16px rgba(0, 0, 0, 0.28),
      0 12px 28px rgba(211, 47, 47, 0.25);

    transition:
      transform 180ms ease,
      box-shadow 180ms ease,
      background-color 180ms ease;
  }

  [data-close-isbn-scanner]::before {
    content: "✕";
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
  }

  [data-close-isbn-scanner]:active {
    transform: translateX(-50%) scale(0.96);
  }

  [data-close-isbn-scanner]:focus-visible {
    outline: 3px solid rgba(211, 47, 47, 0.28);
    outline-offset: 3px;
  }

  .barcode-scanner-frame::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(6.25rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 12;

    width: 0.9rem;
    height: 0.9rem;
    border-radius: 999px;
    background: #42d392;
    box-shadow: 0 0 0 0 rgba(66, 211, 146, 0.65);
    animation: isbn-scan-pulse 1.6s infinite ease-out;
    pointer-events: none;
  }

  .barcode-scanner-frame::before {
    content: "Scanning...";
    position: absolute;
    left: 50%;
    bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 12;

    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8rem;
    line-height: 1;
    letter-spacing: 0.02em;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  }

  @keyframes isbn-scan-pulse {
    0% {
      transform: translateX(-50%) scale(1);
      box-shadow: 0 0 0 0 rgba(66, 211, 146, 0.65);
      opacity: 1;
    }

    70% {
      transform: translateX(-50%) scale(1.15);
      box-shadow: 0 0 0 16px rgba(66, 211, 146, 0);
      opacity: 0.95;
    }

    100% {
      transform: translateX(-50%) scale(1);
      box-shadow: 0 0 0 0 rgba(66, 211, 146, 0);
      opacity: 1;
    }
  }
}

@media (max-width: 760px) {
  dialog[data-cover-identify-modal][open] {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    min-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #0b1012;
    overflow: hidden;
  }

  dialog[data-cover-identify-modal][open]::backdrop {
    background: #0b1012;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-sheet,
  dialog[data-cover-identify-modal][open] .cover-camera-stage,
  dialog[data-cover-identify-modal][open] .cover-camera-frame {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    min-width: 100vw;
    min-height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #0b1012;
    overflow: hidden;
  }

  dialog[data-cover-identify-modal][open] [data-cover-camera-video],
  dialog[data-cover-identify-modal][open] [data-cover-camera-preview] {
    position: absolute;
    inset: 0;
    display: block;
    width: 100vw;
    height: 100dvh;
    object-fit: cover;
    background: #0b1012;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-topbar,
  dialog[data-cover-identify-modal][open] .cover-camera-status-card {
    display: none !important;
  }

  dialog[data-cover-identify-modal][open] .barcode-scan-reticle-cover {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-book-frame,
  dialog[data-cover-identify-modal][open] [data-cover-camera-crop-guide] {
    position: absolute;
    left: 50%;
    top: 44%;

    width: 20rem;
    max-width: calc(100vw - 3rem);
    aspect-ratio: 2 / 3;
    height: auto;

    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, 0.96);
    border-radius: 1rem;
    box-sizing: border-box;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    background: transparent;
    pointer-events: none;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-bar {
    position: fixed;
    left: 50%;
    bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: auto;
    padding: 0;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    min-height: 4rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
    transition: transform 160ms ease, opacity 160ms ease, background-color 160ms ease;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab:active {
    transform: scale(0.96);
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: currentColor;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-cancel,
  dialog[data-cover-identify-modal][open] .cover-camera-fab-retake {
    background: rgba(18, 24, 28, 0.88);
    backdrop-filter: blur(10px);
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-capture {
    background: #ffffff;
    color: #111;
    width: 4.5rem;
    height: 4.5rem;
    min-width: 4.5rem;
    min-height: 4.5rem;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-retake.hidden {
    display: none !important;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-icon-confirm {
    display: none;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-capture[data-cover-capture-mode="confirm"] {
    background: #1f9d55;
    color: #fff;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-capture[data-cover-capture-mode="confirm"] .cover-camera-fab-icon-camera {
    display: none;
  }

  dialog[data-cover-identify-modal][open] .cover-camera-fab-capture[data-cover-capture-mode="confirm"] .cover-camera-fab-icon-confirm {
    display: inline-flex;
  }
}
/*








 */
