/* AT·RECORD — warm analog / neo-brutalist theme.
   Tokens mirror the Figma semantic variables; shadows are hard (no blur),
   borders are 2px ink, radius is 0 everywhere. */
:root {
  --bg: #f1e7d2;
  --surface: #fbf5e7;
  --ink: #2a2017;
  --ink-muted: #6a5a41;
  --line: #dbc9aa;
  --owned: #3e5b39;
  --accent: #c99a3a;
  --wanted: #c0673b;
  --sage: #8a9a6b;
  --danger: #a8472a;
  --mustard: #d7a93e;

  /* Shadows are pinned to this rather than --ink directly, so they stay
     near-black in dark mode instead of flipping to cream. */
  --shadow-color: #2a2017;
  --shadow-xs: 2px 2px 0 0 var(--shadow-color);
  --shadow-sm: 3px 3px 0 0 var(--shadow-color);
  --shadow-md: 4px 4px 0 0 var(--shadow-color);

  /* Invariant text colours for content pinned to a fixed-dark or
     fixed-cream surface regardless of scheme (colour-fill buttons/badges,
     the hero band, list-row cover art overlays). */
  --ink-fixed: #2a2017;
  --cream-fixed: #f1e7d2;

  --display: "Anton", ui-sans-serif, system-ui, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191008;
    --surface: #251a10;
    --ink: #f1e7d2;
    --ink-muted: #a08a6b;
    --line: #3a2d1e;
    --owned: #4d7046;
    --wanted: #d07a4d;
    --danger: #c25736;
    --shadow-color: #0c0805;
  }
}

* {
  box-sizing: border-box;
  border-radius: 0;
}

html,
body {
  margin: 0;
}

body {
  font: 15px/1.5 var(--mono);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* A single narrow column: full-bleed on mobile, centered on desktop. No
   phone-mockup framing (border/shadow) — real phones cover that job. A
   viewport-height flex column so the app bar can stay fixed while an inner
   region scrolls (crate/browse), rather than the whole body scrolling. */
.app {
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* The signed-out page scrolls on its own within the shell. */
.app > .signin {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* The authed shell: app bar (fixed) over the routed page (fills the rest). */
.shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.shell > *:not(.app-bar) {
  flex: 1;
  min-height: 0;
}

/* A list screen (crate/browse): a fixed hero + toolbar band over a single
   scrolling content region. */
.list-screen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.list-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* Clear the fixed FAB so the last items / LOAD MORE aren't hidden by it. */
  padding-bottom: 88px;
}

/* A sub-page (add/settings/record/scan/inbox/browse) scrolls as a whole. */
.page-scroll {
  overflow-y: auto;
}

/* --- app bar ---------------------------------------------------------- */
.app-bar {
  flex-shrink: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 14px;
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}
.app-bar__title {
  font: 400 22px/1 var(--display);
  letter-spacing: 0.5px;
}
.app-bar__title--sub {
  font: 700 13px/1 var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.app-bar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  font: 700 15px/1 var(--mono);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--owned);
  border: 2px solid var(--ink);
  color: var(--cream-fixed);
  font: 400 14px/1 var(--display);
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* An anchored panel under a relatively-positioned trigger: shared by the
   title/handle autocomplete dropdowns (.suggestions) and the account popout
   (.popout). Apply alongside the specific class, e.g. class="popout dropdown-panel". */
.dropdown-panel {
  position: absolute;
  z-index: 10;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-md);
}

/* --- settings ----------------------------------------------------------- */
.popout__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 700 12px/1 var(--mono);
  letter-spacing: 0.5px;
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
}
.settings-account {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 24px;
}
.settings-account__text {
  min-width: 0;
}
.settings-account__handle {
  margin: 0 0 2px;
  font: 700 16px/1.2 var(--mono);
  letter-spacing: 0.3px;
  word-break: break-all;
}
.settings-account__sub {
  margin: 0;
  font: 400 12px/1.3 var(--mono);
  color: var(--ink-muted);
}

/* --- chips / badges --------------------------------------------------- */
.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 2px solid var(--ink);
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}
.chip {
  padding: 6px 11px;
  box-shadow: var(--shadow-xs);
}
.badge {
  padding: 3px 7px;
  font-size: 9px;
  cursor: default;
}
.chip--ink,
.badge--ink {
  background: var(--ink);
  color: var(--surface);
}
.chip--owned,
.badge--owned {
  background: var(--owned);
  color: var(--cream-fixed);
}
.chip--wanted,
.badge--wanted {
  background: var(--wanted);
  color: var(--cream-fixed);
}
.chip--accent,
.badge--accent {
  background: var(--accent);
  color: var(--ink-fixed);
}
.chip--surface,
.badge--surface {
  background: var(--surface);
  color: var(--ink);
}
.chip--alert,
.badge--alert {
  background: var(--danger);
  color: var(--cream-fixed);
}
/* a muted, unselected filter chip */
.chip--off {
  background: var(--surface);
  color: var(--ink-muted);
  box-shadow: none;
}

/* --- card ------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 16px;
}

/* --- buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 13px 16px;
  font: 700 13px/1 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  transition:
    transform 0.04s ease,
    box-shadow 0.04s ease;
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-xs);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--accent);
  color: var(--ink-fixed);
}
.btn--danger {
  background: var(--wanted);
  color: var(--cream-fixed);
}
.btn--dark {
  background: var(--ink);
  color: var(--surface);
}
.btn--ghost {
  box-shadow: none;
  background: transparent;
}
.btn--block {
  width: 100%;
}

/* --- fields ----------------------------------------------------------- */
.field {
  display: block;
  margin-bottom: 16px;
}
.field > span,
.section-label {
  display: block;
  font: 700 11px/1.2 var(--mono);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.section-label {
  margin-bottom: 10px;
}
input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font: 400 15px/1.3 var(--mono);
}
textarea {
  min-height: 84px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: var(--shadow-xs);
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-row {
  display: flex;
  gap: 12px;
}
.field-row > .field {
  flex: 1;
  min-width: 0;
}

/* --- segment toggle (OWNED | WANTED) ---------------------------------- */
.segment {
  display: flex;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-xs);
}
.segment button {
  flex: 1;
  border: none;
  background: var(--surface);
  color: var(--ink-muted);
  padding: 12px;
  font: 700 13px/1 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
}
.segment button + button {
  border-left: 2px solid var(--ink);
}
.segment button.is-active {
  background: var(--owned);
  color: var(--cream-fixed);
}

/* --- hero (crate) ----------------------------------------------------- */
/* The hero band is a fixed-dark scrim (like a photo backdrop) in both
   schemes, so its gradient endpoint and overlaid text are pinned to the
   invariant tokens rather than --ink/--bg, which would otherwise flip. */
.hero {
  position: relative;
  flex-shrink: 0;
  height: 160px;
  border-bottom: 3px solid var(--ink);
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--owned),
    #2c4129 60%,
    var(--ink-fixed)
  );
}
.hero__sticker {
  position: absolute;
  left: 16px;
  top: 92px;
  background: var(--ink-fixed);
  border: 2px solid var(--cream-fixed);
  color: var(--cream-fixed);
  padding: 6px 12px;
  font: 400 28px/1 var(--display);
}
.hero__count {
  position: absolute;
  left: 18px;
  top: 134px;
  color: var(--cream-fixed);
  font: italic 900 13px/1 var(--serif);
}
.hero__badge {
  position: absolute;
  right: 16px;
  top: 16px;
}

/* --- toolbar / tags --------------------------------------------------- */
.body {
  padding: 16px;
}
.toolbar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- display toggle (grid | list) -------------------------------------- */
.display-toggle {
  display: flex;
  flex-shrink: 0;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-xs);
}
.display-toggle__btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font: 700 16px/1 var(--mono);
  cursor: pointer;
}
.display-toggle__btn + .display-toggle__btn {
  border-left: 2px solid var(--ink);
}
.display-toggle__btn.is-active {
  background: var(--ink-fixed);
  color: var(--cream-fixed);
}

/* --- cover grid ------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: stretch;
  gap: 16px 14px;
}
.cover-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--ink);
}
.cover-card__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px;
}
.cover-card__title {
  font: 700 13px/1.2 var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cover-card__artist {
  font: 400 11px/1.2 var(--mono);
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cover-card__fmt {
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- cover tile (the Anton letter on a colour block) ------------------ */
.cover-tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-tile {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* The letter-tile fallback sits on a colour fill (or real cover art), so
     its glyph colour is pinned rather than theme-relative. */
  color: var(--cream-fixed);
  font-family: var(--display);
  font-weight: 400;
  border-bottom: 2px solid var(--ink);
}
.cover-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-tile--card {
  height: 150px;
  font-size: 84px;
}
.cover-tile--detail {
  height: 300px;
  font-size: 190px;
  border-bottom-width: 3px;
}
.cover-tile--owned {
  background: var(--owned);
}
.cover-tile--wanted {
  background: var(--wanted);
}
.cover-tile--accent {
  background: var(--accent);
  color: var(--ink-fixed);
}
.cover-tile--sage {
  background: var(--sage);
  color: var(--ink-fixed);
}
.cover-tile__badge {
  position: absolute;
  left: 8px;
  top: 8px;
  box-shadow: var(--shadow-xs);
}
/* Overlaid on real cover art as often as on a colour tile, so pinned
   invariant tokens keep it legible in both schemes. */
.cover-tile__fmt {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--ink-fixed);
  color: var(--cream-fixed);
  padding: 5px 10px;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.5px;
}
.cover-tile__status {
  position: absolute;
  left: 16px;
  top: 16px;
  box-shadow: var(--shadow-sm);
}

/* --- crate list rows ---------------------------------------------------- */
.rows {
  display: flex;
  flex-direction: column;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  text-decoration: none;
  color: var(--ink);
}
.row + .row {
  border-top: 1px solid var(--line);
}
.row__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row__title {
  font: 700 13px/1.2 var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__meta {
  font: 400 11px/1.2 var(--mono);
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__status {
  flex-shrink: 0;
}
.cover-tile--row {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  font-size: 20px;
  border: 2px solid var(--ink);
}

/* --- browse grid -------------------------------------------------------- */
/* Fill the stretched card so the actions/badge pin to the bottom and every
   browse card in a row lines up regardless of buttons vs badge. */
.browse-card .cover-card__info {
  flex: 1;
}
.browse-card .cover-card__info > .badge,
.browse-card__actions {
  margin-top: auto;
}
.browse-card__actions {
  display: flex;
  gap: 6px;
}
.browse-card__actions .btn {
  flex: 1;
  padding: 9px 8px;
  font-size: 11px;
}

/* --- fab -------------------------------------------------------------- */
.fab {
  position: fixed;
  right: max(16px, calc(50vw - 195px + 16px));
  bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-md);
  color: var(--ink-fixed);
  padding: 14px 20px;
  text-decoration: none;
  z-index: 5;
}
.fab__plus {
  font: 400 22px/1 var(--display);
}
.fab__label {
  font: 700 13px/1 var(--mono);
  letter-spacing: 0.5px;
}

/* --- amend panel ------------------------------------------------------- */
.amend-panel {
  margin: 0 18px 16px;
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}
.field.checkbox input {
  width: auto;
}
.field.checkbox span {
  margin: 0;
}

/* --- record detail ---------------------------------------------------- */
.titleblock {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 4px;
}
.titleblock__title {
  font: 900 26px/1.1 var(--serif);
  margin: 0;
}
.titleblock__artist {
  font: 700 15px/1 var(--mono);
  color: var(--ink-muted);
}
.titleblock__via {
  display: block;
  margin-top: 2px;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  font-style: italic;
}
.titleblock__source {
  display: block;
  margin-top: 2px;
  font: 400 11px/1 var(--mono);
  color: var(--ink-muted);
  font-style: italic;
}
.stars {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}
.stars__glyphs {
  font: 700 18px/1 var(--mono);
  color: var(--accent);
  letter-spacing: 1px;
}
.stars__count {
  font: 400 12px/1 var(--mono);
  color: var(--ink-muted);
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 18px 20px;
}
.grades {
  display: flex;
  gap: 12px;
}
.grade {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
}
.grade__label {
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.8px;
  color: var(--ink-muted);
}
.grade__value {
  font: 400 34px/1 var(--display);
  color: var(--owned);
}
.grade__name {
  font: 400 10px/1.2 var(--mono);
  color: var(--ink-muted);
}

.detail-rows {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 0 14px;
}
.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font: 700 12px/1.3 var(--mono);
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-row__label {
  color: var(--ink-muted);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.detail-row__value {
  color: var(--ink);
  text-align: right;
  min-width: 0;
}

.notes {
  background: var(--owned);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 16px;
}
.notes__label {
  font: 700 11px/1 var(--mono);
  letter-spacing: 1.5px;
  color: var(--accent);
  margin: 0 0 8px;
}
.notes__text {
  font: italic 900 16px/1.4 var(--serif);
  color: var(--cream-fixed);
  margin: 0;
}

/* --- edit inbox --------------------------------------------------------- */
.inbox-intro {
  font: 700 12px/1.3 var(--mono);
  color: var(--ink-muted);
  letter-spacing: 0.3px;
  margin: 0 0 14px;
}
.proposal-card__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}
.proposal-card__title {
  font: 400 20px/1.2 var(--display);
  color: var(--ink);
}
.proposal-card__by {
  font: italic 700 12px/1.3 var(--serif);
  color: var(--ink-muted);
}
.proposal-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0 0 12px;
}
.diff-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.diff-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font: 700 13px/1.3 var(--mono);
}
.diff-row__label {
  flex-basis: 100%;
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--ink-muted);
}
.diff-row__old {
  color: var(--ink-muted);
  text-decoration: line-through;
}
.diff-row__arrow {
  color: var(--ink-muted);
}
.diff-row__new {
  color: var(--ink);
  font-weight: 900;
}
.proposal-actions {
  display: flex;
  gap: 12px;
}
.applied-strip {
  background: var(--owned);
  color: var(--cream-fixed);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
  font: 700 13px/1.4 var(--mono);
}

.actions {
  display: flex;
  gap: 12px;
}
.actions .btn {
  border-width: 2.5px;
  box-shadow: var(--shadow-md);
  padding: 15px 18px;
}
.actions .btn--primary {
  flex: 1;
}

.edit-panel {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.edit-panel .field {
  flex: 1;
  margin-bottom: 0;
}

/* --- timeline --------------------------------------------------------- */
.timeline {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  font: 400 13px/1.4 var(--mono);
}
.timeline li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.timeline li:first-child {
  border-top: none;
}
.timeline-when {
  color: var(--ink-muted);
  flex-shrink: 0;
}

/* --- title autocomplete ------------------------------------------------ */
.autocomplete {
  position: relative;
}
.suggestions {
  left: 0;
  right: 0;
  top: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
}
.suggestions li + li {
  border-top: 1px solid var(--line);
}
.suggestions button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.suggestions button:hover {
  background: var(--bg);
}
.suggestion__main {
  min-width: 0;
}
.suggestion__main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestion__main .item-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- discogs search / infinite scroll --------------------------------- */
.search-row {
  display: flex;
  gap: 8px;
}
.search-row input {
  flex: 1;
}
.search-row .btn {
  flex-shrink: 0;
}
.connect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.connect-row .item-meta {
  flex: 1;
  min-width: 160px;
}

/* --- barcode scan ------------------------------------------------------- */
.scan-camera {
  position: relative;
  margin: 16px;
  background: var(--ink-fixed);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-md);
  aspect-ratio: 3 / 4;
  overflow: hidden;
}
.scan-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Live camera feed: the hint text sits over real video, so it stays cream
   in both schemes (same reasoning as the hero scrim). */
.scan-camera__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  text-align: center;
  color: var(--cream-fixed);
  font: 700 12px/1 var(--mono);
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.scan-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.scan-row + .scan-row {
  border-top: 1px solid var(--line);
}
.scan-row__body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.scan-row__body--added {
  color: var(--owned);
  font: 700 13px/1 var(--mono);
}
.scan-row__main {
  flex: 1;
  min-width: 0;
}
.scan-row__main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scan-row__dismiss {
  padding: 6px 10px;
}
.scan-suggestions {
  margin-top: 6px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.scan-suggestions .section-label {
  margin-top: 4px;
}
.results-scroll {
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
  border: 2px solid var(--ink);
  background: var(--surface);
}
.results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.results li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.results li:first-child {
  border-top: none;
}
.result-main {
  flex: 1;
  min-width: 0;
}
.result-main strong {
  font-weight: 700;
}
.load-more {
  text-align: center;
  margin: 8px 0;
}

/* --- crate windowing (LOAD MORE) --------------------------------------- */
.load-more-block {
  margin-top: 16px;
}
.load-more-count {
  text-align: center;
  font: 700 11px/1.3 var(--mono);
  letter-spacing: 0.5px;
  color: var(--ink-muted);
  margin: 0 0 10px;
}

/* small cover thumb used in result rows */
.cover {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid var(--ink);
  background: var(--bg);
}
.cover-empty {
  display: inline-block;
}

/* --- misc text -------------------------------------------------------- */
.hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 8px 0 0;
}
.item-meta {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.empty {
  color: var(--ink-muted);
  padding: 24px 4px;
}
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-xs);
  padding: 12px 14px;
  margin: 16px;
  font: 700 13px/1.4 var(--mono);
}
.notice__icon {
  flex-shrink: 0;
  font-size: 15px;
}
.notice__msg {
  flex: 1;
  min-width: 0;
}
.notice__dismiss {
  flex-shrink: 0;
  width: auto;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font: 700 14px/1 var(--mono);
  padding: 2px 4px;
}
.notice--success {
  background: var(--owned);
  color: var(--cream-fixed);
}
.notice--error {
  background: var(--danger);
  color: var(--cream-fixed);
}
.notice--info {
  background: var(--surface);
  color: var(--ink);
}
.notice--warning {
  background: var(--mustard);
  color: var(--ink-fixed);
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
}
.checkbox input {
  width: auto;
}
.checkbox span {
  font-size: 13px;
  color: var(--ink-muted);
}

/* --- signed-out / login ----------------------------------------------- */
.signin {
  padding: 24px 16px;
}
.signin h2 {
  font: 400 30px/1 var(--display);
  margin: 0 0 4px;
}
.signin .tagline {
  color: var(--ink-muted);
  margin: 0 0 20px;
  font-size: 13px;
}

/* --- login OAuth error panel ------------------------------------------- */
.login-error {
  background: var(--surface);
  border: 3px solid var(--danger);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin: 0 0 20px;
}
.login-error__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.login-error__sticker {
  background: var(--danger);
  color: var(--cream-fixed);
  border: 2px solid var(--ink);
  padding: 4px 9px;
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.login-error__code {
  border: 1px dashed var(--ink);
  padding: 3px 8px;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.login-error__copy {
  margin: 0;
  font: 400 13px/1.5 var(--mono);
  color: var(--ink);
}

/* --- register: PDS provider hand-off ---------------------------------- */
.signin .card + .card {
  margin-top: 16px;
}
.providers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.provider {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
}
.provider:hover {
  background: var(--cream);
}
.provider__name {
  font: 700 14px/1 var(--display);
}
.provider__blurb {
  flex: 1;
  color: var(--ink-muted);
  font-size: 12px;
}
.provider__arrow {
  font: 700 13px/1 var(--mono);
  color: var(--ink-muted);
}

/* --- crate loading skeletons ------------------------------------------- */
.loading-status {
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.6px;
  color: var(--ink-muted);
  margin: 0 0 14px;
}
.skeleton-card {
  border: 2px dashed var(--ink);
  background: var(--surface);
}
.skeleton-card--dim {
  opacity: 0.66;
}
.skeleton-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  background: var(--bg);
  border-bottom: 2px dashed var(--ink);
}
.skeleton-cover__glyph {
  font-size: 48px;
  color: var(--line);
}
.skeleton-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
}
.skeleton-bar {
  height: 10px;
  background: var(--line);
}
.skeleton-bar--w70 {
  width: 70%;
}
.skeleton-bar--w48 {
  width: 48%;
}
.skeleton-bar--w33 {
  width: 33%;
}

/* --- crate empty (first-run) state ------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-md);
  padding: 28px 20px 22px;
}
.empty-state .vinyl {
  margin-bottom: 4px;
}
.empty-state__title {
  font: 400 26px/1 var(--display);
  letter-spacing: 0.5px;
  margin: 0;
}
.empty-state__sub {
  font: italic 400 14px/1.4 var(--serif);
  color: var(--ink-muted);
  margin: 0 0 6px;
}
.empty-state .btn {
  width: 100%;
}
.empty-state__import {
  margin-top: 4px;
  font: 700 12px/1.3 var(--mono);
  color: var(--ink-muted);
  text-decoration: underline;
}

/* --- crate offline error state ----------------------------------------- */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  background: var(--surface);
  border: 3px solid var(--danger);
  box-shadow: var(--shadow-md);
  padding: 24px 20px 20px;
}
.error-state__sticker {
  background: var(--danger);
  color: var(--cream-fixed);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-xs);
  padding: 5px 10px;
  font: 700 12px/1 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.error-state__title {
  font: 400 24px/1.05 var(--display);
  letter-spacing: 0.5px;
  margin: 0;
}
.error-state__body {
  font: 400 13px/1.5 var(--mono);
  color: var(--ink-muted);
  margin: 0 0 4px;
}
.error-state .btn {
  width: 100%;
}
.error-state__hint {
  font: 400 11px/1.3 var(--mono);
  color: var(--ink-muted);
  margin: 0;
}
