.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;
}


/* Chips input (Material-style editable input chips over a hidden text field;
   see chips_input.js). The frame mimics `.field input`; the inner text input
   and per-chip edit input must escape the global `.field input` box styles. */
.chips-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  cursor: text;
}

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

.chips-input .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.25;
}

.chips-input .chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: text;
}

.chips-input .chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.chips-input .chip-remove:hover,
.chips-input .chip-remove:focus-visible {
  background: var(--accent);
  color: #f8fbf9;
}

.field .chips-input input.chips-text,
.field .chips-input input.chip-edit {
  width: auto;
  min-height: 2.1rem;
  padding: 0.25rem 0.2rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font: inherit;
  color: var(--text);
}

.field .chips-input input.chips-text {
  flex: 1 1 8rem;
  min-width: 6rem;
}

.field .chips-input input.chip-edit {
  flex: 0 1 auto;
  min-height: 1.4rem;
  padding: 0;
}

.field .chips-input input.chips-text:focus,
.field .chips-input input.chip-edit:focus {
  outline: none;
  border-color: transparent;
}
