@import url("/house-tokens.css");
@import url("/house-components.css");

/* UX-1: latin Plex weights used by the house style */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* { box-sizing: border-box; }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: 0;
  transform: translateY(-120%);
  z-index: 20;
  background: var(--white);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  padding: 11px 18px;
  text-decoration: none;
}
.skip-link:focus {
  transform: translateY(16px);
}

html { background: var(--white); color: var(--ink); }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1 { font-weight: 700; font-size: 34px; line-height: 40px; letter-spacing: -0.01em; }
h2 { font-weight: 700; font-size: 22px; line-height: 28px; margin-top: 24px; }
h3 { font-weight: 600; font-size: 16px; line-height: 22px; }

/* UX-3: buttercup underline only in running text; lists stay quiet until hover/focus */
a {
  color: var(--ink);
  text-decoration-color: var(--buttercup);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}
.hits a,
.facets a,
.nav a,
.pane a,
.staff-nav a,
table a {
  text-decoration: none;
}
.hits a:focus-visible,
.facets a:focus-visible,
.nav a:focus-visible,
.pane a:focus-visible,
.staff-nav a:focus-visible,
table a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--buttercup);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}
@media (hover: hover) {
  a:hover { text-decoration-color: var(--ink); }
  .hits a:hover, .facets a:hover, .nav a:hover, .pane a:hover, .staff-nav a:hover, table a:hover {
    text-decoration: underline;
    text-decoration-color: var(--buttercup);
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
  }
}
a:active, .hits a:active, .facets a:active, .nav a:active {
  text-decoration: underline;
  text-decoration-color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--buttercup);
}

.wrap { width: min(72rem, calc(100% - 2rem)); margin: 0 auto; padding: 24px 0 48px; }
main.wrap { padding-top: 24px; }

.band {
  background: var(--buttercup);
  color: var(--ink);
  padding: 28px 0 20px;
}
.band .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 0;
  margin: 0 auto;
  width: min(72rem, calc(100% - 2rem));
}
.band .brand-block { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.band .kicker { margin-bottom: 0; }
.brand {
  font-weight: 700;
  font-size: 34px;
  line-height: 40px;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.nav { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; line-height: 20px; align-items: center; }
.nav a, .nav button.linkish {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav form { display: inline; margin: 0; }
.nav button.linkish {
  font: inherit;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.nav button.linkish:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--buttercup);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}
@media (hover: hover) {
  .brand:hover { text-decoration: none; }
  .nav button.linkish:hover {
    text-decoration: underline;
    text-decoration-color: var(--buttercup);
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
  }
}

.app .band { padding: 18px 0 14px; }
.app .brand { font-size: 22px; line-height: 28px; }
.app main.wrap { padding-block: 16px 32px; }

/* Staff band aligns with 300px pane | content grid */
body.app .band .wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: end;
  gap: 0;
}
body.app .band .brand-block {
  padding-inline: var(--space-app-pane);
  box-sizing: border-box;
}
body.app .band .nav {
  padding-inline: 24px;
  justify-content: flex-end;
}

.site-foot {
  border-top: 1px solid var(--concrete);
  padding: 16px 0 24px;
}
.site-foot .wrap { padding: 0; }
.site-foot .version {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* UX-2: one form system */
.search { display: flex; gap: 12px; margin: 24px 0; align-items: stretch; }
form.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 40rem;
  margin: 16px 0;
}
form.stack label,
label.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-weight: 600;
  font-size: 13px;
  line-height: 18px;
}
label.field.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  min-height: 44px;
}
label.field.inline-check input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-height: 24px;
  flex: none;
}
.field-hint, .required-note { font-weight: 400; color: var(--muted); font-size: 13px; line-height: 19px; }
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
legend.label { margin-bottom: 8px; }

input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
  font: 400 16px/24px var(--sans);
  color: inherit;
  background: var(--white);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 11px 12px;
  min-height: var(--control-touch);
  width: 100%;
}
textarea { min-height: 8rem; resize: vertical; }
input.short, select.short { max-width: 20rem; }
input.medium, select.medium { max-width: 32rem; }
.search input[type="search"] { width: 100%; }

button, .button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 14px/20px var(--sans);
  background: var(--buttercup);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 11px 18px;
  min-height: var(--control-touch);
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--buttercup); }
.btn.secondary, button.secondary, .button.secondary {
  background: var(--white);
  color: var(--ink);
}
.btn.danger, button.danger, .button.danger {
  background: var(--white);
  color: var(--color-status-critical);
  border-color: var(--color-status-critical);
}
button:active, .button:active, .btn:active, .btn.primary:active {
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
}
.btn.secondary:active, button.secondary:active {
  background: var(--ink);
  color: var(--white);
}
.btn.danger:active, button.danger:active {
  background: var(--color-status-critical);
  color: var(--white);
}
@media (hover: hover) {
  button:hover, .button:hover, .btn:hover, .btn.primary:hover {
    background: var(--ink);
    color: var(--white);
    text-decoration: none;
  }
  .btn.secondary:hover, button.secondary:hover, .button.secondary:hover {
    background: var(--ink);
    color: var(--white);
  }
  .btn.danger:hover, button.danger:hover, .button.danger:hover {
    background: var(--color-status-critical);
    color: var(--white);
  }
}

.app button, .app .button, .app .btn, .app input, .app select {
  min-height: var(--control-pointer);
}
@media (pointer: coarse) {
  .app button, .app .button, .app .btn, .app input, .app select { min-height: var(--control-touch); }
  .facets a, .browse-classes a, .nav a { min-height: 44px; display: inline-flex; align-items: center; }
}

.hits { list-style: none; padding: 0; margin: 0; }
.hits li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--concrete);
}
.hits li.with-photo, .hits li.with-cover { grid-template-columns: auto 1fr auto; align-items: center; }
.hits .title { font-weight: 600; font-style: normal; }

.call, .count { font-family: var(--mono); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; color: var(--muted); }

.portrait { width: 40px; height: 40px; object-fit: cover; border-radius: 0; display: block; border: 1.5px solid var(--ink); }
.portrait.large { width: 96px; height: 96px; margin: 8px 0 16px; }

.cover { width: 48px; height: 72px; object-fit: cover; background: transparent; border: 1px solid var(--concrete); }
.cover.large { width: 72px; height: 108px; }
.cover-slot {
  position: relative;
  width: 48px;
  height: 72px;
  flex: none;
}
.cover-slot .cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  transition: opacity 160ms ease;
}
.cover-slot .cover[hidden],
.cover-slot img.cover:not([src]),
.cover-slot img.cover[src=""] {
  display: none;
}
.cover-slot.large { width: 72px; height: 108px; }
.cover-slot.large .cover-fallback { width: 72px; height: 108px; }
.cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 72px;
  background: var(--receipt);
  border: 1px solid var(--concrete);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 16px;
  color: var(--muted);
}

/* UX-111 record page */
.record-layout { display: grid; gap: 24px; margin-top: 24px; }
.record-main { display: grid; gap: 16px; min-width: 0; }
.record-title { margin: 0; }
.record-author { margin: 0; }
.record-cover { margin: 8px 0; }
.record-details { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.record-details dt { color: var(--muted); }
.record-details dd { margin: 0; }
ul.copies {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}
ul.copies li {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--concrete);
}
ul.copies li::before { content: none; }
@media (min-width: 40.01rem) {
  ul.copies li {
    grid-template-columns: minmax(8rem, 1fr) minmax(6rem, 1fr) minmax(8rem, 1.2fr);
    gap: 12px;
    align-items: baseline;
  }
  ul.copies li .call::after,
  ul.copies li .copy-branch::after { content: none; }
}
@media (max-width: 40rem) {
  ul.copies li .call::after { content: " · "; color: var(--muted); }
}
@media (min-width: 64rem) {
  .record-layout {
    grid-template-columns: 16rem minmax(0, 40rem);
    gap: 48px;
    align-items: start;
  }
  .record-main { display: contents; }
  .record-cover { grid-column: 1; grid-row: 1 / span 8; }
  .record-title,
  .record-author,
  .availability-summary,
  .record-reserve,
  .banner,
  .record-details,
  .copies-label,
  ul.copies,
  .label,
  .squares,
  .citation-row,
  .Z3988,
  .record-main > p { grid-column: 2; }
}

mark.cleanup-diff {
  background: var(--receipt);
  color: inherit;
  padding: 0 2px;
}

.muted { color: var(--muted); }
cite, .work { font-style: italic; font-weight: 400; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--concrete); vertical-align: top; }

.banner {
  background: var(--receipt);
  border: 1.5px solid var(--ink);
  border-left: 4px solid var(--buttercup);
  padding: 12px 14px;
  margin: 16px 0;
}
.banner.good { border-left-color: var(--color-status-good); }
.error {
  background: var(--color-harbour-pohutukawa-tint);
  border: 1.5px solid var(--color-status-critical);
  color: var(--ink);
  padding: 12px 14px;
  margin: 8px 0 0;
}

.facets { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; line-height: 19px; margin: 16px 0; }
.facet-groups { display: grid; gap: 16px; margin: 8px 0 16px; }
.facet-group .label { margin: 0 0 4px; }
.facet-group .count { margin-left: 4px; }
.facets .squares { gap: 0; margin: 0; }
.facet-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--ink);
  padding: 6px 10px;
  background: var(--receipt);
  text-decoration: none;
  min-height: 36px;
}

.staff-shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0; align-items: start; }
.staff-shell .pane { position: sticky; top: 0; max-height: 100vh; }
.staff-shell .pane a[aria-current="page"] {
  font-weight: 600;
  box-shadow: inset 4px 0 0 var(--buttercup);
  padding-left: 8px;
}
.staff-content { min-width: 0; padding-inline: 24px 0; }
.menu-toggle { display: none; }

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 16px;
}
.receipt-grid a { text-decoration: none; }
.receipt-grid .total { font: 700 34px/40px var(--sans); }

.kiosk { font-size: 22px; line-height: 28px; }
.kiosk input[type="search"] { font-size: 22px; padding: 14px; min-height: 48px; }
.kiosk .keys { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; align-items: center; }
.kiosk .keys-row { display: flex; gap: 8px; justify-content: center; width: 100%; }
.kiosk .keys-row.indent-half { padding-left: 3%; }
.kiosk .keys-row.indent-full { padding-left: 6%; }
.citation-row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  margin: 8px 0;
}
.citation-row .btn.link,
button.btn.link {
  background: transparent;
  border: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--buttercup);
  text-decoration-thickness: 3px;
  min-height: 32px;
  padding: 4px 0;
  font-weight: 600;
  justify-self: end;
}
.citation-row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  margin: 8px 0;
}
.citation-row .btn.link,
button.btn.link {
  background: transparent;
  border: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--buttercup);
  text-decoration-thickness: 3px;
  min-height: 32px;
  padding: 4px 0;
  font-weight: 600;
  justify-self: end;
}
.kiosk .keys button {
  background: var(--white);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  min-width: 64px;
  min-height: 64px;
  flex: 1 1 64px;
  font-size: 22px;
  line-height: 28px;
  font-size: 22px;
  line-height: 28px;
  max-width: 72px;
  padding: 8px;
}
.kiosk .keys button.wide { flex: 5 1 200px; max-width: none; }
.kiosk .keys button:active, .kiosk .keys button:hover {
  background: var(--ink);
  color: var(--white);
}
.kiosk .kiosk-split { display: grid; gap: 32px; }
.kiosk .kiosk-qr img { width: 200px; height: 200px; }

form.stack > .btn,
form.stack > button { align-self: flex-start; }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.inline-form .field { flex: 1 1 12rem; max-width: 32rem; margin: 0; }
.inline-form .btn { flex: none; }

.results-layout {
  display: grid;
  gap: 24px;
  margin-top: 16px;
}
.results-column { min-width: 0; max-width: 52rem; }
.facets { display: block; }
.refine-toggle { display: none; margin: 16px 0; }
.facet-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--ink);
  padding: 6px 10px;
  text-decoration: none;
  font-size: 13px;
  line-height: 18px;
  background: var(--receipt);
}
.desk-workspace { max-width: 40rem; }
.desk-session { list-style: none; padding: 0; margin: 16px 0; }
.desk-session li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--concrete);
}
.desk-action { margin-left: auto; }
.patron-results { list-style: none; padding: 0; margin: 8px 0 0; max-width: 32rem; }
.patron-results li { border-top: 1px solid var(--concrete); }
.patron-option {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 8px 0;
  justify-content: flex-start;
}
.patron-option-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.portrait.tiny { width: 24px; height: 24px; }
.portrait.tiny.placeholder { display: inline-block; background: var(--receipt); border: 1px solid var(--concrete); }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 13px/18px var(--sans);
  border: 0;
  padding: 0;
  background: transparent;
}
.status::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background-repeat: no-repeat;
  background-size: 12px 12px;
}
/* UX-130: tick / triangle / cross (no filled square + ✕) */
.status.good::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%230A7A3E' stroke-width='2'%3E%3Cpath d='M2 6.5 4.5 9 10 3'/%3E%3C/svg%3E");
}
.status.warning::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%231A1A1A' stroke-width='1.5'%3E%3Cpath d='M6 1.5 11 10.5H1z'/%3E%3Cpath d='M6 4.5v3M6 8.75v.5'/%3E%3C/svg%3E");
}
.status.critical::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23B00020' stroke-width='2'%3E%3Cpath d='M3 3l6 6M9 3 3 9'/%3E%3C/svg%3E");
}
.status.good { color: var(--ink); }
.status.warning { color: var(--ink); }
.status.critical { color: var(--color-status-critical); }
.status .branch-muted, .status-branch { color: var(--muted); font-weight: 400; }

.label { margin-top: 32px; margin-bottom: 12px; }
form + .label, table + .label { margin-top: 48px; }
h1 { margin: 0 0 24px; }
h1 + .muted, h1 + p { margin-top: -16px; margin-bottom: 24px; }
.staff-content main.wrap, .staff-shell .staff-content > main { padding-top: 24px; }
.hits li { padding-top: 16px; padding-bottom: 16px; }
.hits .title { font-style: normal; font-weight: 700; }
h1.work { font-style: normal; font-weight: 700; }
cite, .work cite { font-style: italic; font-weight: 400; }

.browse-classes { list-style: none; padding: 0; margin: 16px 0; }
.browse-classes a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  align-items: center;
  border-top: 1px solid var(--concrete);
  padding: 8px 0;
  text-decoration: none;
}

.danger-zone {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--concrete);
}

.phone-circ-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin: 16px 0 24px;
  padding: 12px 14px;
  background: var(--receipt);
  border: 1px solid var(--concrete);
  max-width: 40rem;
}
.phone-circ-toggle .field { margin: 0; }
.chart { margin: 16px 0 32px; max-width: 40rem; }
.chart-svg { width: 100%; height: auto; display: block; background: var(--receipt); border: 1px solid var(--concrete); }
.chart-table { margin-top: 8px; max-width: 20rem; }
.how-to-borrow { margin: 0 0 24px; max-width: 36rem; }
.how-to-borrow ol { padding-left: 1.25rem; margin: 12px 0; }
.how-to-borrow li { margin: 8px 0; }
.browse-home .how-to-borrow { max-width: none; }
.cleanup-queue { list-style: none; padding: 0; margin: 16px 0; max-width: 40rem; }
.cleanup-queue > li {
  display: block;
  padding: 16px 0;
  border-top: 1px solid var(--concrete);
}
.cleanup-queue .stack { max-width: none; margin-top: 8px; }
.browse-aside { min-width: 0; }
.home-main { min-width: 0; }

.empty { color: var(--muted); margin: 8px 0 16px; }

.results-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin: 16px 0;
  flex-wrap: wrap;
}

dl {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 4px 12px;
  margin: 12px 0 20px;
}
dt { font-size: 13px; line-height: 19px; color: var(--muted); }
dd { margin: 0; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  background: var(--white);
  border-top: 1px solid var(--concrete);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  margin-top: 8px;
}
.sticky-actions .unsaved { color: var(--muted); font-size: 13px; line-height: 19px; }
.sticky-actions .unsaved[hidden] { display: none; }
.record-cover-pick {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
  max-width: 40rem;
}
.record-cover-pick .cover-thumb {
  width: 64px;
  height: 96px;
  object-fit: cover;
  background: var(--receipt);
  border: 1px solid var(--concrete);
  flex: none;
}
.record-cover-pick .cover-thumb.placeholder { display: block; }
.copies-table { width: 100%; max-width: 40rem; border-collapse: collapse; margin: 16px 0; }
.copies-table th, .copies-table td {
  text-align: left;
  padding: 8px 12px 8px 0;
  border-top: 1px solid var(--concrete);
  vertical-align: top;
}
.copies-table .num { text-align: right; font-family: var(--mono); }
.section-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 32px 0 12px;
}
.section-toolbar .label { margin: 0; }
.reports-table { width: 100%; max-width: 32rem; border-collapse: collapse; margin: 0 0 24px; }
.reports-table th, .reports-table td {
  text-align: left;
  padding: 8px 12px 8px 0;
  border-top: 1px solid var(--concrete);
}
.reports-table .num { text-align: right; font-family: var(--mono); }
.reports-table tfoot th, .reports-table tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
.call-number-worklist { list-style: none; padding: 0; margin: 16px 0; }
.call-number-worklist li {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  border-top: 1px solid var(--concrete);
  padding: 12px 0;
}
.call-number-worklist .inline-form { margin: 0; }
.phone-circ-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 16px 0 24px;
  max-width: 40rem;
}
.phone-circ-toggle .field-hint { flex: 1 1 100%; margin: 0; }
.desk-scan-sheet {
  border: 0;
  padding: 0;
  max-width: none;
  width: 100%;
  height: 100%;
  background: var(--white);
}
.desk-scan-sheet::backdrop { background: rgba(0, 0, 0, 0.4); }
.desk-scan-sheet[open] {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.desk-scan-sheet .scan-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.desk-barcode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 24px;
}
.desk-barcode-row .inline-form { flex: 1; margin: 0; min-width: 12rem; }
#borrower-card .call + .muted::before { content: " · "; }
#borrower-card h2 { margin: 0 0 4px; }
#borrower-card .portrait { margin-bottom: 0; }

.marc-editor {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 20px;
}

.app-action {
  width: 100%;
  margin: 8px 0;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  margin: 16px 0;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--concrete);
}
.auth-actions .auth-btn { width: 100%; max-width: 20rem; }
.loan-rule-form {
  display: grid;
  grid-template-columns: repeat(3, 6rem) auto;
  gap: 8px;
  align-items: end;
}
.loan-rule-form .field { margin: 0; }

/* UX-124 scan frame */
.scan-frame {
  position: relative;
  width: 100%;
  max-width: 40rem;
  aspect-ratio: 4 / 3;
  background: var(--receipt);
  border: 1.5px solid var(--ink);
  overflow: hidden;
  display: grid;
  place-items: center;
  margin: 16px 0;
}
.scan-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink);
}
.scan-guide {
  position: absolute;
  inset: 18% 16%;
  border: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow:
    inset 3px 3px 0 0 var(--buttercup),
    inset -3px -3px 0 0 var(--ink),
    inset 3px -3px 0 0 var(--ink),
    inset -3px 3px 0 0 var(--buttercup);
}
.scan-frame #scan { position: relative; z-index: 3; }
.scan-torch {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  min-height: 40px;
  padding: 8px 12px;
}
.scan-result {
  max-width: 40rem;
  border: 1.5px solid var(--ink);
  background: var(--receipt);
  padding: 14px 16px;
  margin: 12px 0;
}
.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}
.results-toolbar .refine-toggle { margin: 0; width: auto; }
.results-toolbar .inline-form { margin: 0; }
.results-toolbar .field { margin: 0; font-weight: 400; }
.facet-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  mask-image: linear-gradient(90deg, var(--ink) 85%, transparent);
  padding-bottom: 4px;
}
.facet-chips .chip { flex: none; }
.facets .squares li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 14px;
  line-height: 20px;
  padding: 2px 0;
}
.facets .squares li::before {
  align-self: center;
  margin-top: 0;
  width: 6px;
  height: 6px;
}
.facets .squares a {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  min-height: inherit;
  text-decoration: none;
}
.facets .count { margin-left: auto; font-family: var(--mono); font-size: 13px; line-height: 20px; }
/* Home: browse left on desktop; under Recently added on phones (UX-123) */
.home-layout .browse-home { min-width: 0; }
.home-layout .home-main { min-width: 0; }

.staff-bottom-bar {
  display: none;
}
.desk-scan-open { display: none; }

@media (max-width: 40rem) {
  .hits li { grid-template-columns: 1fr; }
  /* UX-120 compact band */
  .band {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 0 12px;
  }
  .band .wrap {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .band .brand { font-size: 22px; line-height: 28px; }
  .band .nav {
    margin-left: auto;
    flex-wrap: nowrap;
    gap: 8px 12px;
    font-size: 14px;
  }
  .band .nav a { min-height: 32px; }
  body.app .band .wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    grid-template-columns: none;
  }
  body.app .band .brand-block,
  body.app .band .nav { padding-inline: 1rem; }
  .brand { font-size: 22px; line-height: 28px; }
  main.wrap { padding-top: 16px; }
  .search { margin: 16px 0; }
  .label { margin-top: 24px; }
  input.short, select.short,
  input.medium, select.medium { max-width: none; }
  .staff-shell { grid-template-columns: 1fr; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .staff-shell .pane {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    height: 100%;
    max-height: none;
    background: var(--white);
    border: 0;
    padding: 16px 16px calc(80px + env(safe-area-inset-bottom, 0px));
    overflow: auto;
  }
  .staff-shell.menu-open .pane { display: flex; flex-direction: column; }
  .menu-toggle { display: none; }
  .staff-content { padding-inline: 0; }
  .staff-bottom-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--white);
    border-top: 1.5px solid var(--ink);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .staff-bottom-bar a,
  .staff-bottom-bar button {
    min-height: 56px;
    border: 0;
    background: transparent;
    font: 600 12px/16px var(--sans);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
  }
  .refine-toggle { display: inline-flex; width: auto; }
  .facets {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    margin: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    background: var(--white);
    flex-direction: column;
    overflow: auto;
    padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .facets.open { display: flex; }
  .facets-sheet-header,
  .facets-sheet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--concrete);
    background: var(--white);
    flex: none;
  }
  .facets-sheet-footer {
    border-bottom: 0;
    border-top: 1px solid var(--concrete);
    position: sticky;
    bottom: 0;
  }
  .facets .facet-groups {
    flex: 1;
    overflow: auto;
    padding: 16px;
    margin: 0;
    gap: 20px;
  }
  /* UX-122: 44px touch rows in the phone refine sheet */
  .facets .squares li {
    min-height: 44px;
    font-size: 16px;
    line-height: 24px;
    padding: 0;
    gap: 12px;
  }
  .facets .squares li::before { width: 8px; height: 8px; }
  .facets-advanced { padding: 0 16px 16px; }
  form.stack > .btn,
  form.stack > button,
  .inline-form .btn { width: 100%; align-self: stretch; }
  .results-toolbar .inline-form .btn,
  .results-toolbar .btn { width: auto; }
  .advanced-search-link { display: none; }
  /* UX-123: left panel (How to borrow + Browse) under Recently added */
  .home-layout {
    display: flex;
    flex-direction: column;
  }
  .home-layout .home-main { display: contents; }
  .home-layout .recently-added { order: 1; }
  .home-layout .browse-home { order: 2; margin-top: 24px; }
  .home-layout .home-hours { order: 0; }
  .call-number-worklist li {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .call-number-worklist .inline-form {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
  }
  .call-number-worklist .inline-form input { flex: 1; min-width: 0; }
  .copies-table thead { display: none; }
  .copies-table, .copies-table tbody, .copies-table tr, .copies-table td {
    display: block;
    width: 100%;
  }
  .copies-table tr { padding: 12px 0; border-top: 1px solid var(--concrete); }
  .copies-table td { border: 0; padding: 2px 0; }
  .desk-scan-open { display: inline-flex; }
}

@media (min-width: 40.01rem) {
  .results-layout { grid-template-columns: 16rem minmax(0, 52rem); align-items: start; }
  .home-layout {
    display: grid;
    grid-template-columns: 16rem minmax(0, 52rem);
    align-items: start;
  }
  .home-layout .home-main { display: block; }
  .home-layout .browse-home,
  .home-layout .recently-added,
  .home-layout .home-hours { order: initial; margin-top: 0; }
  .refine-toggle { display: none; }
  .facets {
    display: block;
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 0;
    background: transparent;
  }
  .facets-sheet-header,
  .facets-sheet-footer,
  .facets-advanced { display: none; }
  .staff-bottom-bar { display: none !important; }
}
