:root {
  color-scheme: light dark;
  --accent: #c62828;
  --ink: CanvasText;
  --paper: Canvas;
  --muted: color-mix(in srgb, CanvasText 65%, transparent);
  --line: color-mix(in srgb, CanvasText 20%, transparent);
  --ok: #2e7d32;
  /* Text that reports a problem: readable on both the light and the dark background. */
  --error-ink: light-dark(#b71c1c, #ff8a80);
  --ok-ink: light-dark(#1b5e20, #81c784);
}
* {
  box-sizing: border-box;
}
/* Nothing in our own CSS may un-hide an element the page has marked hidden. */
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  font:
    16px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
/* The brand takes the row to itself on narrow screens; the account links drop below it. */
.brand {
  display: flex;
  flex: 1 1 16rem;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-logo {
  height: 3rem;
  width: auto;
  max-width: min(22rem, 60vw);
  object-fit: contain;
  flex: none;
}
.brand-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.75rem;
  min-width: 0;
}
.brand-title {
  font-weight: 700;
}
.brand-tagline {
  color: var(--muted);
  font-size: 0.875rem;
}
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}
nav a {
  color: inherit;
}
form.inline {
  display: inline;
  margin: 0;
}
main {
  max-width: 40rem;
  margin: 2rem auto;
  padding: 0 1.25rem;
}
main.wide {
  max-width: 96rem;
}
h1 {
  font-size: 2rem;
  margin: 0 0 1rem;
}
.admin-nav {
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.admin-nav a {
  text-decoration: none;
  padding: 0.25rem 0;
}
.admin-nav a:hover {
  text-decoration: underline;
}
.admin-nav a[aria-current="page"] {
  font-weight: 700;
  box-shadow: 0 2px 0 var(--accent);
}
.button,
button {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.button:hover,
button:hover {
  filter: brightness(1.1);
}
.form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  max-width: 22rem;
}
.form-wide {
  max-width: 32rem;
}
.form-wide button[type="submit"] {
  justify-self: start;
}
.form label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
  font-weight: 600;
}
.form label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
.form input:not([type="checkbox"], [type="file"]) {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.form input[type="file"] {
  font: inherit;
  max-width: 100%;
}
.form select {
  font: inherit;
  font-weight: 400;
  padding: 0.5rem;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.form select[aria-invalid="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}
.form input[aria-invalid="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}
.form fieldset {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.form legend {
  font-weight: 600;
  padding: 0 0.35rem;
}
.hint {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
  margin: 0;
}
.field-error {
  color: var(--error-ink);
  font-size: 0.875rem;
  font-weight: 600;
}
.current-image {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
}
.preview {
  display: block;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: repeating-conic-gradient(#8882 0 25%, #0000 0 50%) 0 0 / 12px 12px;
}
.preview-logo {
  max-height: 4rem;
  max-width: 14rem;
  width: auto;
  height: auto;
}
.preview-favicon {
  width: 2rem;
  height: 2rem;
}
.error,
.notice {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.35rem;
}
.form > .error {
  margin: 0;
}
.error {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}
.notice {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
}

/* --- audit log --- */
.muted {
  color: var(--muted);
}
.audit-filters {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.audit-search {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  max-width: 36rem;
}
.audit-search input {
  font: inherit;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.audit-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.75rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.audit-types legend {
  font-weight: 600;
  padding: 0 0.35rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}
.chip:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.chip {
  min-width: 0;
  overflow-wrap: anywhere;
}
.chip .count {
  color: var(--muted);
  font-size: 0.8rem;
}
.chip .count::before {
  content: "(";
}
.chip .count::after {
  content: ")";
}
.audit-filters .actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.result-summary {
  margin: 0 0 0.75rem;
}
.table-wrap {
  overflow-x: auto;
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.audit-table th,
.audit-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.audit-table th {
  font-weight: 700;
  white-space: nowrap;
}
.audit-table td {
  overflow-wrap: break-word;
}
.audit-table td.num,
.audit-table time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.audit-table td.details {
  min-width: 16rem;
}
.audit-table code {
  font-size: 0.8rem;
  color: var(--muted);
}
.audit-table tbody tr:target {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.kv {
  display: grid;
  grid-template-columns: fit-content(40%) minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  margin: 0;
}
.kv dt {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.audit-table code.raw {
  color: inherit;
  overflow-wrap: anywhere;
}
.long-text summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
}
.long-text textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font:
    0.8rem/1.4 ui-monospace,
    monospace;
  resize: vertical;
}
.kv dd {
  margin: 0;
  min-width: 0;
}
.kv-list {
  margin: 0;
  padding-left: 1.25rem;
}
.change del {
  text-decoration: line-through;
  color: var(--muted);
}
.change ins {
  text-decoration: none;
  font-weight: 600;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 1rem 0;
}
.pagination ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination ol a {
  display: inline-block;
  min-width: 2.25rem;
  padding: 0.25rem 0.5rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  text-decoration: none;
  color: inherit;
}
.pagination ol a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.pagination .gap {
  padding: 0.25rem;
  color: var(--muted);
}
.pagination .page-of {
  color: var(--muted);
}

/* On narrow screens each entry becomes a card, with the column names beside the values. */
@media (max-width: 56rem) {
  .audit-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .audit-table,
  .audit-table tbody,
  .audit-table tr,
  .audit-table td {
    display: block;
  }
  .audit-table tr {
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0;
  }
  .audit-table td {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.75rem;
    border-bottom: 0;
    padding: 0.3rem 0.75rem;
  }
  .audit-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
  }
  .audit-table td.details {
    min-width: 0;
  }
  .kv {
    display: block;
  }
  .audit-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(9rem, 40%), 1fr));
    padding-inline: 0.5rem;
  }
  .chip {
    border-radius: 0.75rem;
    font-size: 0.85rem;
  }
  .kv dd {
    padding-left: 0.75rem;
    margin-bottom: 0.25rem;
  }
}

/* --- appearance: custom stylesheet editor --- */
h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.5rem;
}
.form-code {
  max-width: none;
  margin-top: 0.75rem;
}
.form-code textarea,
.code-editor {
  width: 100%;
  min-height: 24rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font:
    0.9rem/1.5 ui-monospace,
    "SFMono-Regular",
    Menlo,
    Consolas,
    monospace;
}
.form-code textarea {
  padding: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
.code-editor {
  background: #fff;
  color: #1f1f1f;
}
.code-editor.cm-focused {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.code-editor .cm-scroller {
  font: inherit;
  min-height: 24rem;
  max-height: 70vh;
}
.form-code button[type="submit"] {
  justify-self: start;
}
button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
}
.css-media-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.css-media-list li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  align-items: center;
}
.css-media-list img,
.css-media-open {
  grid-row: 1 / 3;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
}
.css-media-open {
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-decoration: none;
}
.css-media-list .css-media-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.css-media-list code {
  grid-column: 2;
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.css-media-list button {
  grid-column: 3;
  grid-row: 1 / 3;
}

/* --- media library --- */
.media-upload {
  max-width: 32rem;
  margin-bottom: 1.5rem;
}
.media-upload button[type="submit"] {
  justify-self: start;
}
.media-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
}
.media-item {
  display: grid;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  min-width: 0;
}
.media-thumb {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 0.25rem;
  overflow: hidden;
  background: repeating-conic-gradient(#8882 0 25%, #0000 0 50%) 0 0 / 12px 12px;
}
.media-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: scale-down;
}
.font-badge {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--ink);
  font-family: Georgia, serif;
}
.media-no-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.media-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-url {
  display: grid;
  gap: 0.15rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.media-url input {
  font:
    0.8rem ui-monospace,
    monospace;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
.error ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}
.error p {
  margin: 0;
}

/* --- stylesheet revisions --- */
.revision-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.revision-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.revision-stats {
  font-size: 0.9rem;
}
.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.added {
  color: #2e7d32;
  font-weight: 600;
}
.removed {
  color: var(--accent);
  font-weight: 600;
}
.restore-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}
.diff {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  overflow-x: auto;
  font-size: 0.85rem;
}
.diff-row {
  display: grid;
  grid-template-columns: 3.5rem 3.5rem 1.5rem minmax(0, 1fr);
}
.diff-row .ln {
  color: var(--muted);
  text-align: right;
  padding: 0 0.5rem;
  user-select: none;
  font:
    0.8rem/1.6 ui-monospace,
    monospace;
}
.diff-row .mark {
  text-align: center;
  font:
    0.85rem/1.6 ui-monospace,
    monospace;
  user-select: none;
}
.diff-row code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    0.85rem/1.6 ui-monospace,
    monospace;
  padding-right: 0.5rem;
}
.diff-ins {
  background: color-mix(in srgb, #2e7d32 14%, transparent);
}
.diff-del {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.diff-gap {
  color: var(--muted);
  text-align: center;
  border-block: 1px dashed var(--line);
  padding: 0.1rem;
}
.revision-text {
  width: 100%;
  font:
    0.85rem/1.5 ui-monospace,
    monospace;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.css-media-list code.snippet {
  white-space: pre;
  overflow-x: auto;
  display: block;
}
.revision-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 1rem;
}
@media (max-width: 40rem) {
  .diff-row {
    grid-template-columns: 2.25rem 2.25rem 1rem minmax(0, 1fr);
  }
  .diff-row .ln {
    padding: 0 0.25rem;
    font-size: 0.7rem;
  }
}

/* --- contracts --- */
h2.first {
  margin-top: 0.5rem;
}
h3 {
  font-size: 1.1rem;
  margin: 1.25rem 0 0.5rem;
}
.tabs {
  margin: 0 0 1.25rem;
  gap: 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
@media (max-width: 30rem) {
  .tabs a {
    padding: 0.45rem 0.6rem;
  }
}
.tabs a {
  padding: 0.5rem 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 0.35rem 0.35rem 0 0;
  margin-bottom: -1px;
}
.tabs a[aria-current="page"] {
  border-color: var(--line);
  background: var(--paper);
  font-weight: 700;
  box-shadow: inset 0 2px 0 var(--accent);
}
.item-list {
  list-style: none;
  margin: 0.5rem 0 1.25rem;
  padding: 0;
}
.item-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.item-title {
  font-weight: 600;
}
.badge-quiet {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
}
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.two-column aside h3 {
  margin-top: 0;
}
@media (max-width: 70rem) {
  .two-column {
    grid-template-columns: minmax(0, 1fr);
  }
}
.form-code input[type="text"],
.form-code select {
  max-width: 28rem;
}
.form textarea {
  width: 100%;
  font: inherit;
  font-weight: 400;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
.form-code textarea {
  font:
    0.9rem/1.5 ui-monospace,
    "SFMono-Regular",
    Menlo,
    Consolas,
    monospace;
}
.form textarea[aria-invalid="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}
.form > label[for] {
  font-weight: 600;
  margin-bottom: -0.75rem;
}
.hint p {
  margin: 0 0 0.5rem;
}
.contract-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
/* A sheet of paper: the contract as it will print. Always dark-on-white, whatever the theme. */
.paper {
  background: #fff;
  color: #111;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  box-shadow: 0 1px 4px #0002;
  padding: clamp(1rem, 4vw, 3rem);
  max-width: 50rem;
  font:
    1rem/1.5 "Liberation Serif",
    "Times New Roman",
    Times,
    serif;
}
.contract-text h2.contract-title {
  text-align: center;
  font-size: 1.4rem;
  margin: 0 0 1rem;
}
.contract-text h3,
.contract-text h4 {
  font-size: 1.05rem;
  margin: 1.1rem 0 0.35rem;
}
.contract-text p {
  margin: 0 0 0.75rem;
  overflow-wrap: anywhere;
}
.contract-text p.contract-lines {
  white-space: pre-wrap;
}
.contract-text ul,
.contract-text ol {
  margin: 0 0 0.75rem;
  padding-left: 1.5rem;
}
.contract-text li {
  margin-bottom: 0.25rem;
}
.contract-text hr {
  border: 0;
  border-top: 1px solid #777;
  margin: 1rem 0;
}
.contract-text mark.blank {
  background: #fff3b0;
  color: #111;
  padding: 0 0.15em;
  border-radius: 0.15em;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
}

/* --- inventory --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.button-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.button.small {
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 400;
  vertical-align: middle;
  margin-left: 0.5rem;
}
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.status {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}
.status-draft {
  color: var(--muted);
  border-color: var(--line);
}
.status-available {
  color: #1b5e20;
  border-color: #2e7d3266;
  background: #2e7d3214;
}
.status-reserved {
  color: #8a5300;
  border-color: #e0a00066;
  background: #e0a00018;
}
.status-sold {
  color: #fff;
  border-color: #555;
  background: #555;
}
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.stat {
  display: grid;
  justify-items: start;
  gap: 0.2rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  min-width: 7rem;
}
.stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.find-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  margin: 1rem 0;
}
.find-form label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
}
.find-form input {
  font: inherit;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  width: 12rem;
}
.task-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.task {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0.35rem;
}
.task-relist {
  border-left-color: #2e7d32;
}
.task-pause {
  border-left-color: #e0a000;
}
.task form {
  margin: 0;
  flex: none;
}
.item-head .sku {
  font:
    700 1.1rem ui-monospace,
    monospace;
  margin: 0;
  color: var(--muted);
}
.item-head h2 {
  margin-bottom: 0.25rem;
}
.workflow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.workflow .current {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.panel {
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}
.panel h3 {
  display: flex;
  align-items: center;
}
.action-forms {
  display: grid;
  gap: 0.75rem;
}
.action-forms form,
.inline-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
  margin: 0;
}
.inline-fields label {
  display: grid;
  gap: 0.2rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.inline-fields label.check {
  display: flex;
  font-weight: 400;
}
.inline-fields input[type="text"],
.inline-fields select {
  font: inherit;
  font-weight: 400;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.action-forms .hint {
  flex-basis: 100%;
}
.money-input {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.money-input input {
  width: 8rem;
}
.form .money-input input {
  width: 10rem;
}
.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.simple-table th,
.simple-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.simple-table td.wrap {
  overflow-wrap: anywhere;
  max-width: 16rem;
}
.simple-table form {
  margin: 0;
}
.add-listing {
  margin-top: 0.75rem;
}
.detail-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 0.5rem 2rem;
}
.detail-group h4 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.95rem;
}
.hidden-fields {
  background: color-mix(in srgb, CanvasText 4%, transparent);
  border-radius: 0.35rem;
  padding: 0 0.75rem 0.5rem;
}
fieldset.hidden-fields {
  padding: 0.75rem 1rem 1rem;
}
.pre-wrap {
  white-space: pre-wrap;
}
.history {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}
.history li {
  margin-bottom: 0.2rem;
}
.comic-form fieldset {
  display: grid;
  gap: 0.75rem;
}
.comic-form input[type="text"],
.comic-form input[type="date"],
.comic-form select {
  width: 100%;
  max-width: 28rem;
}
.comic-form .money-input input {
  width: 10rem;
}
.table-wrap {
  position: relative;
}
.item-list .inline-fields {
  align-items: center;
}
.task > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --- inventory import --- */
.import-upload aside h3 {
  margin-top: 0;
}
.import-columns {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.import-columns dt {
  color: var(--ink);
  font-weight: 600;
}
.import-summary {
  list-style: none;
  padding: 0;
}
.stat-warn {
  border-color: #e0a00099;
  background: #e0a00014;
}
.stat-skip {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.import-actions form {
  margin: 0;
}
.import-mapping {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  gap: 0.5rem 2rem;
  margin-bottom: 0.5rem;
}
.import-mapping h3 {
  margin-bottom: 0.5rem;
}
.import-mapping .kv {
  font-size: 0.9rem;
}
.import-missing {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}
.badge-ok {
  background: var(--ok);
}
.badge-warn {
  background: #e0a000;
  color: #1f1f1f;
}
.import-notes {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}
.import-table td.num {
  font-variant-numeric: tabular-nums;
}
.import-table tr.import-skip {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.import-all {
  margin: 1.25rem 0;
}
.import-all summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.import-created {
  columns: 3 18rem;
  padding-left: 1.25rem;
  margin: 0.5rem 0 1.25rem;
}
.import-created li {
  break-inside: avoid;
  margin-bottom: 0.2rem;
}
.import-created a {
  font:
    600 0.95rem ui-monospace,
    monospace;
  margin-right: 0.35rem;
}

/* --- inventory list --- */
.list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 1rem;
  margin: 0.75rem 0;
}
.list-controls p {
  margin: 0;
}
.list-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.list-buttons label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.list-buttons select,
.list-search input {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.list-search {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1 1 22rem;
  max-width: 36rem;
}
.list-search input {
  font-weight: 400;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
}
.list-summary {
  flex-basis: 100%;
  color: var(--muted);
}
.list-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.inventory-list {
  font-size: 0.85rem;
}
.inventory-list th,
.inventory-list td {
  padding: 0.35rem 0.35rem;
}
.inventory-list thead th {
  vertical-align: bottom;
  line-height: 1.2;
}
.inventory-list tbody th,
.inventory-list tbody td {
  vertical-align: top;
}
.inventory-list .sort {
  display: inline-block;
}
.inventory-list td.wrap.title {
  min-width: 8.5rem;
}
.inventory-list tbody th {
  font-family: ui-monospace, monospace;
  font-weight: 600;
  white-space: nowrap;
}
.inventory-list .sort {
  color: inherit;
  text-decoration: none;
}
.inventory-list .sort:hover,
.inventory-list .sort:focus-visible {
  text-decoration: underline;
}
.inventory-list .sort-mark {
  margin-left: 0.25rem;
  font-size: 0.7em;
  color: var(--muted);
}
.inventory-list .sort-on .sort-mark {
  color: var(--accent);
}
.inventory-list td.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.inventory-list td.wrap {
  min-width: 4.5rem;
  max-width: 14rem;
}
.inventory-list .button.small {
  margin-left: 0;
  white-space: nowrap;
}
.inventory-list tbody tr:hover {
  background: color-mix(in srgb, CanvasText 4%, transparent);
}
.inventory-list th:first-child,
.inventory-list td:first-child {
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 1;
}

/* --- item pictures --- */
.item-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.item-thumb {
  flex: none;
  display: block;
}
.item-thumb img {
  display: block;
  width: auto;
  height: auto;
  max-width: 5.5rem;
  max-height: 7.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.image-grid {
  list-style: none;
  margin: 0.75rem 0 1rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}
.image-card {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  min-width: 0;
}
.image-default {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.image-frame {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  aspect-ratio: 1;
  background: color-mix(in srgb, CanvasText 5%, transparent);
  border-radius: 0.25rem;
  overflow: hidden;
}
.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.image-meta {
  margin: 0;
  font-size: 0.85rem;
  display: grid;
  gap: 0.15rem;
  justify-items: start;
}
.image-name {
  overflow-wrap: anywhere;
}
.image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: flex-start;
  align-self: end;
}
.image-actions form {
  margin: 0;
}
.image-actions .button.small,
.image-actions button.small {
  margin-left: 0;
}
button.small {
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
}
details.confirm > summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
}
details.confirm > summary::-webkit-details-marker {
  display: none;
}
details.confirm[open] {
  flex-basis: 100%;
}
details.confirm form {
  margin-top: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  font-size: 0.85rem;
}
details.confirm form p {
  margin: 0 0 0.4rem;
}
.image-upload {
  border: 2px dashed var(--line);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 0;
}
.image-upload > label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}
.image-upload.enhanced > label::after {
  content: " — choose files, or drop them here";
  font-weight: 400;
  color: var(--muted);
}
.image-upload.dragging {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.image-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.image-upload input[type="file"] {
  font: inherit;
  max-width: 100%;
}
.upload-progress {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
}
.upload-progress li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8rem minmax(0, 1.4fr);
  gap: 0.5rem;
  align-items: center;
}
.upload-progress progress {
  width: 100%;
  accent-color: var(--accent);
}
.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-ok .upload-note {
  color: var(--ok-ink);
  font-weight: 600;
}
.upload-progress li.upload-ok,
.upload-progress li.upload-failed {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: start;
}
.upload-failed .upload-name,
.upload-ok .upload-name {
  white-space: normal;
  overflow-wrap: anywhere;
}
.upload-failed .upload-note {
  color: var(--error-ink);
}
.upload-status {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  min-height: 0;
}
.upload-kept .upload-progress {
  margin-top: 0.25rem;
}
.upload-kept .upload-note {
  color: inherit;
}
.image-actions .button.small {
  white-space: nowrap;
}
.upload-status:focus {
  outline: none;
}
button:disabled,
button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
@media (pointer: coarse) {
  .image-actions .button.small,
  .image-actions button.small,
  details.confirm > summary {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
  }
}
.image-frame-wrap {
  position: relative;
}
.image-edit {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: color-mix(in srgb, Canvas 88%, transparent);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
}
.image-edit:hover,
.image-edit:focus-visible {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.image-edited {
  position: absolute;
  left: 0.35rem;
  bottom: 0.35rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: color-mix(in srgb, Canvas 85%, transparent);
  color: var(--muted);
  border: 1px solid var(--line);
}
@media (pointer: coarse) {
  .image-edit {
    padding: 0.55rem 0.8rem;
  }
}

/* --- picture studio --- */
/* The edit form: picture first, controls beside it on wide screens and below it on narrow ones.
   Without script it is a plain form with a preview made by the server; with script
   (client/image-studio.ts, class "enhanced") the preview is a canvas with a crop frame. */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem 1.5rem;
  align-items: start;
}
.studio-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 1.2rem;
}
.studio-title:focus {
  outline: none;
}
.studio-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0.75rem;
  border-radius: 0.35rem;
  background: color-mix(in srgb, CanvasText 6%, Canvas);
}
.studio-preview {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
}
/* A very small picture is still shown at a size that can be judged. */
.studio-preview {
  min-width: min(16rem, 100%);
  min-height: 10rem;
  object-fit: contain;
}
.studio-controls {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  align-content: start;
}
.studio fieldset {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
  padding: 0.5rem 0.75rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.studio legend {
  font-weight: 600;
  padding: 0 0.35rem;
}
.studio-field {
  display: grid;
  gap: 0.25rem;
}
.studio-field > label,
.studio-pct,
.studio-shape {
  font-weight: 600;
}
.studio label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
.studio-pcts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.studio-pct {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}
.studio input[type="number"],
.studio select {
  font: inherit;
  font-weight: 400;
  padding: 0.4rem 0.5rem;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.studio input[type="number"] {
  width: 8rem;
}
.studio-pct input[type="number"] {
  width: 100%;
}
.studio-note {
  font-size: 0.85rem;
}
.studio-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.studio-actions .button,
.studio-actions button {
  margin: 0;
}
.studio-actions button.secondary {
  padding: 0.45rem 1rem;
  font-size: 1rem;
}
.studio .error {
  margin: 0;
}
.studio .error:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (min-width: 48rem) {
  .studio {
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem);
  }
}

/* The editor. */
.studio.enhanced .studio-stage {
  height: min(66vh, 46rem);
  padding: 1rem;
  overflow: hidden;
}
.studio-canvas {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
.studio-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.studio-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.studio-shade > div {
  position: absolute;
  background: rgb(0 0 0 / 0.55);
}
.studio-frame {
  position: absolute;
  cursor: move;
  touch-action: none;
  border: 1px solid #fff;
  outline: 1px solid rgb(0 0 0 / 0.6);
}
.studio-frame:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* Thirds, while the frame is being dragged: a help for placing the subject. */
.studio-frame.dragging {
  background:
    linear-gradient(
      to right,
      transparent calc(100% / 3 - 0.5px),
      rgb(255 255 255 / 0.6) 0 calc(100% / 3 + 0.5px),
      transparent 0 calc(200% / 3 - 0.5px),
      rgb(255 255 255 / 0.6) 0 calc(200% / 3 + 0.5px),
      transparent 0
    ),
    linear-gradient(
      to bottom,
      transparent calc(100% / 3 - 0.5px),
      rgb(255 255 255 / 0.6) 0 calc(100% / 3 + 0.5px),
      transparent 0 calc(200% / 3 - 0.5px),
      rgb(255 255 255 / 0.6) 0 calc(200% / 3 + 0.5px),
      transparent 0
    );
}
.studio-handle {
  position: absolute;
  width: 0.9rem;
  height: 0.9rem;
  margin: -0.45rem 0 0 -0.45rem;
  background: #fff;
  border: 1px solid rgb(0 0 0 / 0.65);
  border-radius: 2px;
  touch-action: none;
}
/* A larger target than the visible square, more so for fingers. */
.studio-handle::before {
  content: "";
  position: absolute;
  inset: -0.6rem;
}
@media (pointer: coarse) {
  .studio-handle {
    width: 1.2rem;
    height: 1.2rem;
    margin: -0.6rem 0 0 -0.6rem;
  }
  .studio-handle::before {
    inset: -0.9rem;
  }
}
.studio-handle-nw {
  left: 0;
  top: 0;
  cursor: nwse-resize;
}
.studio-handle-n {
  left: 50%;
  top: 0;
  cursor: ns-resize;
}
.studio-handle-ne {
  left: 100%;
  top: 0;
  cursor: nesw-resize;
}
.studio-handle-e {
  left: 100%;
  top: 50%;
  cursor: ew-resize;
}
.studio-handle-se {
  left: 100%;
  top: 100%;
  cursor: nwse-resize;
}
.studio-handle-s {
  left: 50%;
  top: 100%;
  cursor: ns-resize;
}
.studio-handle-sw {
  left: 0;
  top: 100%;
  cursor: nesw-resize;
}
.studio-handle-w {
  left: 0;
  top: 50%;
  cursor: ew-resize;
}
/* A small frame keeps room to be grabbed: no edge handles, and no bigger-than-seen targets… */
.studio-frame-small .studio-handle-n,
.studio-frame-small .studio-handle-e,
.studio-frame-small .studio-handle-s,
.studio-frame-small .studio-handle-w {
  display: none;
}
.studio-frame-small .studio-handle::before {
  inset: 0;
}
/* …and a tiny one only its bottom right corner, sitting outside it. */
.studio-frame-tiny .studio-handle:not(.studio-handle-se) {
  display: none;
}
.studio-frame-tiny .studio-handle-se {
  margin: 0;
}
/* A light grid while straightening, to line the picture up against. */
.studio-canvas.levelling::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to right, rgb(255 255 255 / 0.35) 0 1px, transparent 1px 10%),
    repeating-linear-gradient(to bottom, rgb(255 255 255 / 0.35) 0 1px, transparent 1px 10%);
  outline: 1px solid rgb(0 0 0 / 0.2);
  outline-offset: -1px;
}
.studio-too-small {
  color: var(--error-ink);
  font-weight: 600;
}
.studio-undo {
  justify-self: start;
  margin: 0;
}
.studio-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.studio-buttons button {
  margin: 0;
}
.studio-slider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.75rem auto;
  align-items: center;
  gap: 0.5rem;
}
.studio-slider input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  min-height: 1.75rem;
}
.studio-slider output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.studio-slider button.small {
  margin: 0;
}
.studio-crop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.studio-crop-row button.small {
  margin: 0;
}
.studio-size {
  font-variant-numeric: tabular-nums;
}
/* The sliders' ranges are plain to see; their written hints stay for screen readers. */
.studio.enhanced .studio-colour .hint {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (pointer: coarse) {
  .studio-slider button.small,
  .studio-crop-row button.small,
  .studio-buttons button {
    min-height: 2.75rem;
  }
  .studio-slider input[type="range"] {
    min-height: 2.75rem;
  }
}

/* The editor in a window over the item's page. */
.studio-dialog {
  width: min(76rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 0.35);
}
.studio-dialog::backdrop {
  background: rgb(0 0 0 / 0.6);
}
html:has(.studio-dialog[open]) {
  overflow: hidden;
}
.studio-loading {
  display: grid;
  justify-items: center;
  gap: 1rem;
  margin: 2rem;
  color: var(--muted);
}
.studio-loading p {
  margin: 0;
}
@media (min-width: 48rem) {
  /* Picture left, controls right; the controls scroll on their own with the buttons kept in view. */
  .studio-dialog .studio.enhanced .studio-stage {
    height: min(calc(100dvh - 7.5rem), 48rem);
  }
  .studio-dialog .studio.enhanced .studio-controls {
    max-height: min(calc(100dvh - 7.5rem), 48rem);
    overflow: auto;
    padding-right: 0.25rem;
  }
  .studio-dialog .studio.enhanced .studio-actions {
    position: sticky;
    bottom: 0;
    background: var(--paper);
    padding: 0.5rem 0;
  }
}
@media (max-width: 47.99rem) {
  /* Small screens: the whole screen, picture on top, buttons kept at the bottom. */
  .studio-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0.75rem;
    border: 0;
    border-radius: 0;
  }
  /* The picture stays in view while the controls scroll beneath it. */
  .studio.enhanced .studio-stage {
    position: sticky;
    top: 0;
    z-index: 2;
    height: auto;
    max-height: min(42vh, 24rem);
    padding: 0.75rem;
    box-shadow: 0 0.4rem 0.6rem -0.4rem rgb(0 0 0 / 0.35);
  }
  .studio-dialog .studio.enhanced .studio-stage {
    top: -0.75rem;
  }
  .studio-dialog .studio.enhanced .studio-actions {
    position: sticky;
    bottom: -0.75rem;
    z-index: 2;
    margin: 0 -0.75rem;
    padding: 0.45rem 0.75rem 0.6rem;
    background: var(--paper);
    border-top: 1px solid var(--line);
    flex-wrap: nowrap;
    gap: 0.4rem;
  }
  .studio-dialog .studio.enhanced .studio-actions > * {
    padding: 0.4rem 0.7rem;
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .studio-dialog .studio.enhanced .studio-actions [data-studio-revert] {
    margin-left: auto;
    font-size: 0.85rem;
    padding-inline: 0.5rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .studio-dialog[open] {
    animation: studio-open 0.15s ease-out;
  }
  @keyframes studio-open {
    from {
      opacity: 0;
      transform: translateY(0.5rem);
    }
  }
}

/* --- public catalogue --- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: center;
}
.site-nav a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a:focus-visible {
  border-bottom-color: var(--line);
}
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}
.catalog-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}
.catalog-count {
  margin: 0;
  color: var(--muted);
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  overflow: hidden;
}
.view-toggle a {
  padding: 0.3rem 0.9rem;
  text-decoration: none;
  color: inherit;
  font-size: 0.95rem;
}
.view-toggle a + a {
  border-left: 1px solid var(--line);
}
.view-toggle a[aria-current="true"] {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}
.catalog {
  list-style: none;
  margin: 0;
  padding: 0;
}
.catalog-link {
  color: inherit;
  text-decoration: none;
}
.catalog-link:hover .catalog-title,
.catalog-link:focus-visible .catalog-title {
  text-decoration: underline;
}
.catalog-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.catalog-issue {
  font-weight: 700;
}
.catalog-grade {
  color: var(--muted);
}
.catalog-picture {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  background: color-mix(in srgb, CanvasText 5%, transparent);
  border-radius: 0.35rem;
  overflow: hidden;
}
.catalog-picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.catalog-no-picture {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.25rem;
}
/* Grid: three across (two on a phone). */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.5rem 1.25rem;
}
@media (max-width: 64rem) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.catalog-grid .catalog-link {
  display: grid;
  gap: 0.5rem;
}
.catalog-grid .catalog-picture {
  aspect-ratio: 3 / 4;
}
.catalog-grid .catalog-text {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.4rem;
  align-items: baseline;
}
.catalog-grid .catalog-grade {
  flex-basis: 100%;
}
@media (max-width: 40rem) {
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 0.75rem;
  }
}
/* List: one per row, small picture. */
.catalog-list {
  display: grid;
  border-top: 1px solid var(--line);
}
.catalog-list .catalog-item {
  border-bottom: 1px solid var(--line);
}
.catalog-list .catalog-link {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: center;
  padding: 0.5rem 0.25rem;
}
.catalog-list .catalog-picture {
  width: 3.5rem;
  height: 4.6rem;
}
.catalog-list .catalog-no-picture {
  font-size: 0.65rem;
}
.catalog-list .catalog-text {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5rem 7rem;
  gap: 0.75rem;
  align-items: baseline;
}
@media (max-width: 40rem) {
  .catalog-list .catalog-text {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
.catalog-link:hover {
  background: color-mix(in srgb, CanvasText 3%, transparent);
}

.crumbs {
  margin: 0 0 1rem;
}
.item {
  display: grid;
  grid-template-columns: minmax(0, 34rem) minmax(0, 1fr);
  gap: 2rem 2.5rem;
  align-items: start;
}
@media (max-width: 60rem) {
  .item {
    grid-template-columns: minmax(0, 1fr);
  }
}
.item-info h1 {
  margin: 0 0 0.25rem;
  overflow-wrap: anywhere;
}
.item-grade {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
}
.item-price {
  margin: 0 0 1rem;
  font-size: 1.6rem;
  font-weight: 700;
}
.item-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin: 1rem 0;
}
.item-facts dt {
  color: var(--muted);
}
.item-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.item-description p {
  margin: 0 0 0.75rem;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.item-cgc .hint {
  display: block;
}
.gallery-main {
  background: color-mix(in srgb, CanvasText 5%, transparent);
  border-radius: 0.5rem;
  overflow: hidden;
}
.gallery-figure {
  margin: 0;
}
.gallery-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
}
/* Several pictures: a hidden radio button each; the one chosen decides which picture shows.
   (Up to 12, the most an item can have.) The thumbnails are the buttons' labels. */
.gallery {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.gallery .gallery-figure {
  display: none;
}
.gallery-pick:nth-of-type(1):checked ~ .gallery-main .gallery-figure:nth-child(1),
.gallery-pick:nth-of-type(2):checked ~ .gallery-main .gallery-figure:nth-child(2),
.gallery-pick:nth-of-type(3):checked ~ .gallery-main .gallery-figure:nth-child(3),
.gallery-pick:nth-of-type(4):checked ~ .gallery-main .gallery-figure:nth-child(4),
.gallery-pick:nth-of-type(5):checked ~ .gallery-main .gallery-figure:nth-child(5),
.gallery-pick:nth-of-type(6):checked ~ .gallery-main .gallery-figure:nth-child(6),
.gallery-pick:nth-of-type(7):checked ~ .gallery-main .gallery-figure:nth-child(7),
.gallery-pick:nth-of-type(8):checked ~ .gallery-main .gallery-figure:nth-child(8),
.gallery-pick:nth-of-type(9):checked ~ .gallery-main .gallery-figure:nth-child(9),
.gallery-pick:nth-of-type(10):checked ~ .gallery-main .gallery-figure:nth-child(10),
.gallery-pick:nth-of-type(11):checked ~ .gallery-main .gallery-figure:nth-child(11),
.gallery-pick:nth-of-type(12):checked ~ .gallery-main .gallery-figure:nth-child(12) {
  display: block;
}
.gallery-pick:nth-of-type(1):checked ~ .gallery-strip label:nth-child(1),
.gallery-pick:nth-of-type(2):checked ~ .gallery-strip label:nth-child(2),
.gallery-pick:nth-of-type(3):checked ~ .gallery-strip label:nth-child(3),
.gallery-pick:nth-of-type(4):checked ~ .gallery-strip label:nth-child(4),
.gallery-pick:nth-of-type(5):checked ~ .gallery-strip label:nth-child(5),
.gallery-pick:nth-of-type(6):checked ~ .gallery-strip label:nth-child(6),
.gallery-pick:nth-of-type(7):checked ~ .gallery-strip label:nth-child(7),
.gallery-pick:nth-of-type(8):checked ~ .gallery-strip label:nth-child(8),
.gallery-pick:nth-of-type(9):checked ~ .gallery-strip label:nth-child(9),
.gallery-pick:nth-of-type(10):checked ~ .gallery-strip label:nth-child(10),
.gallery-pick:nth-of-type(11):checked ~ .gallery-strip label:nth-child(11),
.gallery-pick:nth-of-type(12):checked ~ .gallery-strip label:nth-child(12) {
  border-color: var(--ink);
}
.gallery-pick:nth-of-type(1):focus-visible ~ .gallery-strip label:nth-child(1),
.gallery-pick:nth-of-type(2):focus-visible ~ .gallery-strip label:nth-child(2),
.gallery-pick:nth-of-type(3):focus-visible ~ .gallery-strip label:nth-child(3),
.gallery-pick:nth-of-type(4):focus-visible ~ .gallery-strip label:nth-child(4),
.gallery-pick:nth-of-type(5):focus-visible ~ .gallery-strip label:nth-child(5),
.gallery-pick:nth-of-type(6):focus-visible ~ .gallery-strip label:nth-child(6),
.gallery-pick:nth-of-type(7):focus-visible ~ .gallery-strip label:nth-child(7),
.gallery-pick:nth-of-type(8):focus-visible ~ .gallery-strip label:nth-child(8),
.gallery-pick:nth-of-type(9):focus-visible ~ .gallery-strip label:nth-child(9),
.gallery-pick:nth-of-type(10):focus-visible ~ .gallery-strip label:nth-child(10),
.gallery-pick:nth-of-type(11):focus-visible ~ .gallery-strip label:nth-child(11),
.gallery-pick:nth-of-type(12):focus-visible ~ .gallery-strip label:nth-child(12) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.gallery-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  max-height: min(24rem, 40vh);
  width: 100%;
  color: var(--muted);
  background: color-mix(in srgb, CanvasText 5%, transparent);
  border-radius: 0.5rem;
}
.gallery-strip {
  margin: 0.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.gallery-strip label {
  display: block;
  border: 2px solid transparent;
  border-radius: 0.3rem;
  overflow: hidden;
  cursor: pointer;
}
.gallery-strip label:hover {
  border-color: var(--accent);
}
.gallery-strip img {
  display: block;
  width: 4rem;
  height: 5.25rem;
  object-fit: cover;
}
.inquiry {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1rem;
}
.inquiry h2 {
  margin-top: 0;
}
.inquiry-form {
  max-width: 32rem;
}
.inquiry-form textarea {
  font: inherit;
  font-weight: 400;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}
.inquiry-form button {
  justify-self: start;
}
/* The box that real visitors never see (automated form-fillers fill it in). */
.trap {
  position: absolute;
  left: -200vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- inquiries and description (admin) --- */
.public-line {
  margin: 0.35rem 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.description-form {
  max-width: none;
}
.description-form textarea {
  min-height: 9rem;
  line-height: 1.5;
}
.description-form button[type="submit"] {
  justify-self: start;
}
.description-saved {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.5rem 0.75rem;
}
.description-saved p {
  margin: 0 0 0.35rem;
  overflow-wrap: anywhere;
}
.description-saved p:last-child {
  margin-bottom: 0;
}
.dashboard-inquiries {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid #e0a000;
  border-radius: 0.35rem;
}
.dashboard-inquiries a {
  font-weight: 700;
}
.admin-inquiries {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
.admin-inquiry {
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 0.35rem;
  scroll-margin-top: 1rem;
}
/* A request to pay over time is a bigger conversation than a question: it is marked so it is not missed. */
.admin-inquiry-time_payments {
  border-left-color: #e0a000;
}
.admin-inquiry:target {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.admin-inquiry-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin: 0;
  font-size: 0.9rem;
}
.admin-inquiry-top time {
  font-variant-numeric: tabular-nums;
}
h2.admin-inquiry-item {
  font-size: 1.05rem;
  margin: 0.4rem 0 0.5rem;
  overflow-wrap: anywhere;
}
.admin-inquiry-now {
  font-size: 0.85rem;
  font-weight: 400;
  white-space: nowrap;
  margin-left: 0.35rem;
}
.admin-inquiry-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  margin: 0;
}
.admin-inquiry-facts dt {
  color: var(--muted);
}
.admin-inquiry-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.admin-inquiry-message {
  margin: 0.6rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.35rem;
  background: color-mix(in srgb, CanvasText 5%, transparent);
  overflow-wrap: anywhere;
}
.admin-inquiry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.admin-inquiry-actions form {
  margin: 0;
}
/* Kept narrow enough that a tile is no wider than the smallest picture file (about 300 px). */
.catalog-page {
  max-width: 58rem;
  margin: 0 auto;
}
.item-id {
  margin: 0.5rem 0;
}

/* --- inquiries and description (admin), continued --- */
.admin-inquiries-intro {
  margin: 0 0 1rem;
}
/* On a phone the labels sit above their values, so long addresses get the full width. */
@media (max-width: 30rem) {
  .admin-inquiry-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .admin-inquiry-facts dt {
    font-size: 0.85rem;
  }
  .admin-inquiry-facts dd {
    margin-bottom: 0.3rem;
  }
}
/* Status badges readable on the dark background too. */
.status-available {
  color: var(--ok-ink);
}
.status-reserved {
  color: light-dark(#8a5300, #ffcc80);
}
/* The gallery's hidden radio buttons stay put on the screen, so choosing a picture never scrolls the page. */
.gallery-pick {
  position: fixed;
  top: 50%;
  left: 0;
}
/* Keyboard focus on the gallery shows on the big picture too (the thumbnails may be off-screen). */
.gallery-pick:focus-visible ~ .gallery-main {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.gallery-figure img {
  max-height: 70vh;
}
/* With several pictures the frame keeps one shape, so the thumbnails below do not jump about. */
.gallery .gallery-main {
  aspect-ratio: 3 / 4;
  max-height: 70vh;
}
.gallery .gallery-figure,
.gallery .gallery-figure a {
  height: 100%;
}
.gallery .gallery-figure img {
  height: 100%;
  max-height: none;
}
@media (min-width: 40.01rem) {
  .catalog-list .catalog-title {
    grid-column: 1;
  }
  .catalog-list .catalog-issue {
    grid-column: 2;
  }
  .catalog-list .catalog-grade {
    grid-column: 3;
  }
}
.lost-message {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.gallery .gallery-figure a {
  display: block;
}

/* --- favorites --- */
.site-nav [data-favorites-count] {
  font-weight: 400;
}
.catalog-item {
  position: relative;
}
.favorite-compact {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  background: color-mix(in srgb, Canvas 90%, transparent);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  cursor: pointer;
}
.favorite-compact[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}
.favorite-compact:hover {
  border-color: var(--accent);
}
.catalog-list .favorite-compact {
  top: 50%;
  right: 0.25rem;
  translate: 0 -50%;
  box-shadow: none;
}
.catalog-list .catalog-link {
  padding-right: 3.25rem;
}
.favorite[aria-pressed="true"]:not(.favorite-compact) {
  border-color: var(--accent);
  color: var(--accent);
}
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
}
.item-actions:empty {
  display: none;
}
.favorites-help {
  margin: 0 0 1rem;
}
.favorites-list .catalog-text {
  grid-template-columns: minmax(0, 1fr) 7rem max-content;
}
.favorites-list .catalog-link {
  padding-right: 6.5rem;
}
.favorites-list button[data-favorite-remove] {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  translate: 0 -50%;
}
.favorites-total {
  margin: 0.75rem 0;
}
.favorites-gone {
  margin: 1rem 0;
  color: var(--muted);
}
.favorites-gone ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}
.favorites-gone li {
  margin-bottom: 0.3rem;
}
@media (max-width: 40rem) {
  .favorites-list .catalog-text {
    grid-template-columns: minmax(0, 1fr);
  }
}
.admin-inquiry-books {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.5rem;
}
.admin-inquiry-books li {
  margin-bottom: 0.2rem;
}
@media (min-width: 40.01rem) {
  .favorites-list .catalog-grade {
    grid-column: 2;
  }
  .favorites-list .catalog-price {
    grid-column: 3;
    text-align: right;
    white-space: nowrap;
  }
}

/* --- labels --- */
.label-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
}
.label-pick .hint {
  margin: 0;
}
.item-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
}
.item-tools form {
  margin: 0;
}
.label-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.label-entry {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.6rem 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem);
  gap: 0.5rem 1.25rem;
}
.label-entry-head {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.label-entry-head button {
  margin-left: auto;
}
.label-lines {
  display: grid;
  gap: 0.35rem;
}
.label-line {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
}
.label-line-name {
  color: var(--muted);
}
.label-line input {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  box-sizing: border-box;
}
.label-preview {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 1px dashed var(--line);
  border-radius: 0.3rem;
  font-family: "Liberation Sans", Arial, sans-serif;
  font-size: 0.85rem;
  line-height: 1.3;
  display: grid;
  align-content: start;
  background: Canvas;
}
.label-preview-line {
  display: block;
  overflow-wrap: anywhere;
}
.label-preview-1,
.label-preview-3 {
  font-weight: 700;
}
.label-preview-url {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  overflow-wrap: anywhere;
}
.label-options {
  display: grid;
  gap: 0.75rem;
  max-width: 40rem;
  min-width: 0;
}
.label-options label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  min-width: 0;
}
.label-options select {
  width: 100%;
}
.queued-mark {
  font-weight: 700;
  color: var(--ok);
  text-decoration: none;
  padding: 0 0.3rem;
}
.label-options select,
.label-options input {
  font: inherit;
  font-weight: 400;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  max-width: 100%;
}
.label-nudge {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}
.label-nudge label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.label-nudge .hint {
  flex-basis: 100%;
}
.labels-form .actions-row {
  margin-top: 1rem;
}
.hidden-form {
  display: none;
}
@media (max-width: 48rem) {
  .label-entry {
    grid-template-columns: minmax(0, 1fr);
  }
  .label-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }
}

/* --- consignments --- */
.consign-form {
  max-width: 40rem;
}
.consign-form textarea {
  font: inherit;
  min-height: 12rem;
}
.consignment-card .admin-inquiry-message {
  max-height: 12rem;
  overflow: auto;
}
.consignment-books td,
.consignment-books th {
  white-space: nowrap;
}
.consignment-books td:nth-child(2) {
  white-space: normal;
}
.consignment-books tfoot th,
.consignment-books tfoot td {
  border-top: 2px solid var(--line);
}
.muted-row td {
  color: var(--muted);
}

/* --- pick lists --- */
.pick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0.4rem 0;
}
.picklist-chooser {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  min-width: 0;
  max-width: 100%;
}
.picklist-chooser select,
.picklist-chooser input {
  font: inherit;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  max-width: min(22rem, calc(100vw - 3rem));
  min-width: 0;
}
.picklist-chooser select {
  text-overflow: ellipsis;
}
.picklist-add {
  margin-top: 0.4rem;
  max-width: 100%;
}
.picklist-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0.5rem 0 1rem;
}
.picklist-meta {
  color: var(--muted);
  margin-top: 0;
}
.picklist .picklist-check {
  width: 1.5rem;
}
.checkbox-square {
  display: inline-block;
  width: 0.9rem;
  height: 0.9rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  vertical-align: middle;
}
.picklist-variant {
  color: var(--muted);
}
.picklist-manage {
  margin-top: 1.5rem;
}
.picklist-manage form {
  margin: 0.6rem 0;
}
.nowrap {
  white-space: nowrap;
}
/* Printing a pick list: only the list, in black on white. (Scoped to pages that have one.) */
@media print {
  :root:has(.picklist-title) {
    color-scheme: light;
    --muted: #444;
    --ink: #000;
    --paper: #fff;
  }
  body:has(.picklist-title) {
    background: #fff;
    color: #000;
    font-size: 10pt;
  }
  body:has(.picklist-title) :is(.admin-bar, .site-header, .site-footer, .admin-nav, .no-print, .notice, .error) {
    display: none !important;
  }
  body:has(.picklist-title) :is(main, main.wide) {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  body:has(.picklist-title) .table-wrap {
    overflow: visible;
  }
  .picklist {
    width: 100%;
    border-collapse: collapse;
  }
  .picklist th,
  .picklist td {
    border-bottom: 1px solid #999;
    padding: 0.25rem 0.35rem;
    color: #000;
  }
  .picklist a {
    color: #000;
    text-decoration: none;
  }
  .picklist .status {
    border: 1px solid #000;
    background: none;
    color: #000;
  }
  .picklist tr {
    break-inside: avoid;
  }
  .picklist thead {
    display: table-header-group;
  }
  .picklist-title {
    margin: 0 0 0.2rem;
  }
}

/* --- eBay --- */
.ebay-preview td {
  vertical-align: top;
}
.ebay-uncertain td {
  background: color-mix(in srgb, #e0a000 14%, transparent);
}

/* --- reports --- */
.report-table {
  margin: 0.75rem 0 1.25rem;
}
.report-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.report-table tfoot th,
.report-table tfoot td,
.report-total th,
.report-total td {
  font-weight: 700;
  border-top: 2px solid var(--line);
}
.report-group th,
.report-group td {
  font-weight: 600;
}
.report-sub {
  padding-left: 1.25rem;
  font-weight: 400;
  color: var(--muted);
}
.report-sub-row td {
  color: var(--muted);
}
.report-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: center;
}

/* --- content pages --- */
.site-footer {
  max-width: 60rem;
  margin: 3rem auto 1.5rem;
  padding: 1rem 1.5rem 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.footer-nav a {
  color: inherit;
}
.footer-copy {
  margin: 0;
}
.content-page {
  max-width: 44rem;
  line-height: 1.6;
}
.content-page img {
  max-width: 100%;
  height: auto;
}
.content-page table {
  border-collapse: collapse;
  margin: 1rem 0;
}
.content-page th,
.content-page td {
  border: 1px solid var(--line);
  padding: 0.3rem 0.6rem;
  text-align: left;
}
.content-page blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.content-page pre {
  overflow: auto;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 0.35rem;
}
.page-form {
  max-width: none;
}
.page-form-head {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 6rem);
  gap: 1rem;
  align-items: start;
}
@media (min-width: 64rem) {
  .page-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
  }
  .page-editor > label {
    grid-column: 1 / -1;
  }
  .page-preview {
    margin-top: 0;
  }
}
.slug-input {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
}
.slug-input input {
  flex: 1 1 auto;
  min-width: 0;
}
.page-form-where {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
.page-editor textarea {
  font:
    0.9rem/1.45 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  width: 100%;
}
.page-code-editor {
  min-height: 24rem;
  max-height: 70vh;
  font-size: 0.9rem;
}
.page-preview {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 0.35rem;
}
.page-delete {
  margin-top: 1.5rem;
}
@media (max-width: 48rem) {
  .page-form-head {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- admin bar (staff, every page) --- */
.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  padding: 0.35rem 1.5rem;
  background: #1f1f1f;
  color: #eee;
  font-size: 0.875rem;
}
.admin-bar a {
  color: inherit;
  text-decoration: none;
}
.admin-bar a:hover,
.admin-bar a:focus-visible {
  text-decoration: underline;
}
.admin-bar-count {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  font-size: 0.8em;
}
.admin-bar-spacer {
  flex: 1 1 auto;
}
.admin-bar-user {
  color: #bbb;
}
.admin-bar-logout {
  font: inherit;
  padding: 0.15rem 0.6rem;
  background: transparent;
  color: inherit;
  border: 1px solid #666;
  border-radius: 0.35rem;
  cursor: pointer;
}
.admin-bar-logout:hover {
  border-color: #eee;
}
@media (max-width: 40rem) {
  .admin-bar-user {
    display: none;
  }
}

/* --- homepage --- */
.home-banner {
  margin: 0 0 2rem;
  position: relative;
}
.home-banner-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.home-banner-picture {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
}
.home-banner-text {
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
  max-width: min(80%, 34rem);
  padding: 0.5rem 0.9rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: clamp(1.1rem, 2.5vw, 1.75rem);
  font-weight: 700;
  border-radius: 0.35rem;
}
@media (max-width: 40rem) {
  .home-banner-text {
    left: 0.75rem;
    bottom: 0.75rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.95rem;
    max-width: 85%;
  }
}
/* The strip stays one row: five narrow tiles down to tablet width, a sideways-scrolling row on phones. */
@media (min-width: 40rem) and (max-width: 64rem) {
  .home-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem 0.75rem;
  }
}
@media (max-width: 40rem) {
  .home-strip {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }
  .home-strip .catalog-item {
    flex: 0 0 58%;
    scroll-snap-align: start;
  }
}
.home-latest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.home-latest-head h2 {
  margin: 0;
}
.preview-banner {
  max-width: 100%;
  max-height: 8rem;
}

/* --- favorites pill (public pages, while the visitor has favorites) --- */
.favorites-pill {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.favorites-pill[hidden] {
  display: none;
}
/* Room at the foot of the page, so the pill never sits on the footer's last line. */
body:has(.favorites-pill:not([hidden])) .site-footer {
  padding-bottom: 4.5rem;
}
.favorites-pill:hover,
.favorites-pill:focus-visible {
  filter: brightness(1.08);
  text-decoration: none;
}
.favorites-pill:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.favorites-pill-count {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  text-align: center;
}
@media print {
  .favorites-pill {
    display: none !important;
  }
}

/* The homepage's text block (Settings → Homepage text). */
.home-text {
  max-width: 44rem;
  margin: 2rem 0 0;
  line-height: 1.6;
}

/* Prices on the public lists. */
.catalog-grid .catalog-price {
  flex-basis: 100%;
  font-weight: 600;
}
.catalog-list .catalog-text {
  grid-template-columns: minmax(0, 1fr) 5rem 7rem max-content;
}
@media (min-width: 40.01rem) {
  .catalog-list .catalog-price {
    grid-column: 4;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
  }
}
@media (max-width: 40rem) {
  .catalog-list .catalog-text {
    grid-template-columns: minmax(0, 1fr);
  }
}
.inquiry-subhead {
  margin: 0 0 1rem;
}
.inquiry-form select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  max-width: 100%;
}

/* --- invoices --- */
.invoice-select {
  font: inherit;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  max-width: min(22rem, calc(100vw - 3rem));
}
.invoice-list .num,
.invoice-items .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.invoice-items tfoot th {
  text-align: right;
  font-weight: 600;
}
.invoice-email-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 0.35rem;
  font:
    0.85rem/1.45 ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
}
.invoice-send {
  margin-bottom: 0.5rem;
}

/* --- All comics: the actions bar above the table --- */
.inventory-actions {
  margin: 0 0 0.75rem;
}
.inventory-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.inventory-actions-bar label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}
.inventory-actions-bar select {
  font: inherit;
  font-weight: 400;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}
.inventory-actions-bar select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.inventory-actions-count {
  margin: 0;
}
.action-panel {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 0.35rem;
}
.action-panel[hidden] {
  display: none;
}

/* --- Backup and restore --- */
.backup-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0.75rem 0;
}
.backup-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.backup-choice .hint {
  margin: 0;
}
.backup-restore input[type="file"] {
  max-width: 100%;
}
.backup-restore [data-upload-status]:empty {
  display: none;
}
.backup-restore label {
  margin-top: 0.75rem;
}
.backup-choice .button {
  text-align: center;
  white-space: nowrap;
}
.backup-saved td {
  vertical-align: top;
}
.backup-saved .nowrap,
.backup-saved .num {
  white-space: nowrap;
}
.backup-saved-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.4rem;
}
.backup-saved-actions .button.small {
  margin-left: 0;
}
.backup-delete > summary {
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.15rem 0;
}
.backup-delete form {
  margin-top: 0.4rem;
  padding: 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.backup-delete label.check {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.backup-confirm-cancel {
  margin-top: 1rem;
}
.backup-kept {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.backup-kept p {
  margin: 0 0 0.5rem;
}
/* Narrow screens: each safety copy as a card, its buttons underneath. */
@media (max-width: 40rem) {
  .backup-saved thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .backup-saved,
  .backup-saved tbody,
  .backup-saved tr,
  .backup-saved td {
    display: block;
  }
  .backup-saved tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
  }
  .backup-saved td {
    border: 0;
    padding: 0.1rem 0;
  }
  .backup-saved td.num {
    text-align: left;
  }
  .backup-saved td:first-child {
    font-weight: 600;
  }
  .backup-saved-actions {
    margin-top: 0.4rem;
  }
}

/* --- Privacy: retention settings, the Privacy page, redacted records --- */
.days-input {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
}
.form .days-input input {
  width: 6rem;
}
.settings-retention > .hint {
  margin-bottom: 0.5rem;
}
.privacy-search {
  margin-top: 0.75rem;
}
.privacy-search input[type="email"] {
  font: inherit;
  font-weight: 400;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
  width: min(22rem, 100%);
}
.privacy-search label {
  flex: 1 1 16rem;
  max-width: 24rem;
}
.privacy-preview {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
}
.privacy-preview h3 {
  margin-top: 0;
  overflow-wrap: anywhere;
}
.privacy-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
}
.privacy-list li {
  margin: 0.2rem 0;
  overflow-wrap: anywhere;
}
.privacy-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.privacy-confirm label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.privacy-confirm input[type="checkbox"] {
  margin-top: 0.2rem;
}
.privacy-none {
  overflow-wrap: anywhere;
}
.privacy-table td {
  vertical-align: top;
}
.privacy-retention .kv {
  margin-bottom: 0.75rem;
}
.privacy-retention .hint + .hint {
  margin-top: 0.5rem;
}
.notice.privacy-redacted {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}

/* --- Passwords and accounts (set-up, forgot/reset, change password) --- */
.password-rules {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font-size: 0.9rem;
}
.password-rules p {
  margin: 0;
}
.password-rules ul {
  margin: 0.35rem 0;
  padding-left: 1.25rem;
}
.password-rules li + li {
  margin-top: 0.2rem;
}
.form label.show-password[hidden] {
  display: none;
}
.account-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 1rem;
  margin: 0 0 1.5rem;
}
.account-facts dt {
  font-weight: 600;
}
.account-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 30rem) {
  .account-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem;
  }
  .account-facts dd + dt {
    margin-top: 0.5rem;
  }
}
/* The email in the admin bar is the way to "Your account": on a phone it stays, shortened. */
@media (max-width: 40rem) {
  .admin-bar-user {
    display: inline-block;
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}
