/* THE PRICES PAGE. Built from the kit's own pieces (cards, the summary and the
   Next bar, tabs, buttons, inputs) and these few rules for what only this page
   has: a row per item, the price box, the suggestion chip, the location
   prices, the bulk change and the Save bar that stays on the screen.

   A row is a grid from an upright iPad (48rem) and a stack on a phone, each
   cell under its own small label. Nothing here is a fixed pixel width that
   could push a phone sideways. */
.prices-page { min-width: 0; }
.prices-form { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

/* ---------------------------------------------------------- control line -- */
.prices-head { align-items: flex-end; }
.prices-crumb { display: inline-flex; align-items: center; min-height: var(--spacing-tap); margin-block: -0.5rem; }
.prices-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; }
.prices-scope { width: auto; min-width: 11rem; max-width: 100%; }
.prices-find { flex: 1 1 14rem; min-width: 0; width: auto; }
.prices-menu-panel { width: 16rem; }
/* On a phone ⋯ ends the Find row at the right edge, so its menu hangs from
   the button's right edge, under it (it opened below the screen before). */
@media (max-width: 39.9375rem) {
  .prices-menu-panel { left: auto; right: 0; }
}
/* From an upright iPad up the switch, Find an item and ⋯ stay on ONE line
   beside the name (wrapping let ⋯ drop under the switch); Find gives way. */
@media (min-width: 48rem) {
  .prices-controls { flex-wrap: nowrap; }
  .prices-find { min-width: 12rem; }
  .prices-controls > details { flex: none; }
}
.prices-hint { margin: 0; }

/* ------------------------------------------------------------------ tabs -- */
.prices-tabs { align-self: flex-start; }
.prices-tabs button.ui-tab { border: 0; font-family: inherit; cursor: pointer; }
.prices-tabs button.ui-tab:not([aria-current]) { background: transparent; }
.prices-tab-count {
  margin-left: 0.375rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgb(31 26 20 / 0.08);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ bulk change -- */
.prices-bulk { padding: 0; }
.prices-bulk-summary {
  display: flex;
  align-items: center;
  min-height: var(--spacing-tap);
  padding: 0 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-ink);
  cursor: pointer;
}
.prices-bulk-body { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; padding: 0 1rem 1rem; }
.prices-bulk-field { display: flex; flex-direction: column; gap: 0.25rem; }
.prices-bulk-inputs { display: flex; gap: 0.5rem; }
.prices-bulk-amount { width: 7rem; text-align: right; }
.prices-bulk-mode { width: auto; }
.prices-bulk-check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: var(--spacing-tap); font-size: 0.9375rem; }
.prices-bulk-check input { width: 1.25rem; height: 1.25rem; accent-color: var(--color-accent); }
.prices-bulk-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.prices-bulk-hint { flex: 1 1 100%; margin: 0; }

/* --------------------------------------------------------------- the list -- */
.prices-list {
  min-width: 0;
  background: var(--color-card);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-ui);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.prices-rows { margin: 0; padding: 0; list-style: none; }
.prices-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.375rem 1rem;
  align-items: start;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-line);
}
.prices-rows > .prices-row:first-child { border-top: 0; }
.prices-row-head { display: none; border-top: 0; background: var(--color-page); font-size: 0.8125rem; font-weight: 600; color: var(--color-muted); }
.prices-cell { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.prices-item { font-size: 1rem; font-weight: 600; line-height: 1.375rem; color: var(--color-ink); overflow-wrap: anywhere; }
a.prices-item:hover { color: var(--color-accent-strong); text-decoration: underline; }
.prices-meta, .prices-quiet { font-size: 0.8125rem; line-height: 1.125rem; color: var(--color-muted); overflow-wrap: anywhere; }
.prices-unit { font-size: 0.9375rem; color: var(--color-muted); }

/* A phone: the unit leaves its own cell and reads after the price, and every
   other cell says what it is. */
@media (max-width: 47.9375rem) {
  .prices-cell[data-label]::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-muted);
  }
  .prices-unit { display: none; }
  .prices-price[data-unit]::after { content: "per " attr(data-unit); font-size: 0.8125rem; color: var(--color-muted); }
  .prices-cost, .prices-margin { flex-direction: row; align-items: baseline; gap: 0.5rem; }
  .prices-link { min-height: var(--spacing-tap); }
}
@media (min-width: 48rem) {
  .prices-row { grid-template-columns: minmax(0, 2.4fr) 5.5rem minmax(0, 13rem) minmax(0, 2fr); }
  .prices-has-cost .prices-row { grid-template-columns: minmax(0, 2.2fr) 5rem minmax(0, 12rem) 5.5rem 4.5rem minmax(0, 1.8fr); }
  .prices-row-head { display: grid; }
}

/* An edited row is lit; one that sells for less than it costs is red where
   the margin is; one with no price has its box outlined. */
.prices-row.is-edited { background: var(--color-accent-soft); box-shadow: inset 3px 0 0 var(--color-accent); }
.prices-row.is-below-cost .prices-margin, .prices-bad { color: var(--color-bad); font-weight: 600; }
.prices-row.is-missing .prices-box { border-color: var(--color-warn-fill); }

/* -------------------------------------------------------------- the price -- */
.prices-input { display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; }
.prices-dollar { color: var(--color-muted); }
.prices-box { width: 8rem; max-width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.prices-same { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-ink); }
.prices-problem { font-size: 0.8125rem; font-weight: 600; color: var(--color-bad); }
.prices-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-size: 0.75rem;
  font-weight: 600;
}
.prices-link {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-accent-strong);
  text-align: left;
  cursor: pointer;
}
.prices-link:hover { text-decoration: underline; }

/* ------------------------------------------------- suggestions, locations -- */
.prices-sales { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.prices-sales-details > summary { font-size: 0.8125rem; font-weight: 600; color: var(--color-muted); cursor: pointer; list-style: none; }
.prices-sales-details > summary::-webkit-details-marker { display: none; }
.prices-sales-range { margin: 0.25rem 0 0; font-size: 0.8125rem; color: var(--color-muted); }
.prices-matched { color: var(--color-good); }
.prices-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--color-line-strong);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-ink);
  cursor: pointer;
}
.prices-chip:hover { background: var(--color-accent-soft); }
.prices-diff-summary { font-size: 0.8125rem; font-weight: 600; color: var(--color-accent-strong); cursor: pointer; list-style: none; }
.prices-diff-summary::-webkit-details-marker { display: none; }
.prices-diff-list { margin: 0.25rem 0 0; padding: 0; list-style: none; }
.prices-diff-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; font-size: 0.875rem; }
.prices-diff-place { font-weight: 600; }

/* ---------------------------------------------------------------- review -- */
/* A redraw lands on the Review list or the row just changed (#prices-review,
   #price-row-ID): clear of the sticky top bar, not under it. */
.prices-review, .prices-row { scroll-margin-top: 5.5rem; }
/* The title, and Discard all beside it (it wraps under the title on a phone). */
.prices-review-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; }
.prices-review-group { margin: 1rem 0 0.25rem; font-size: 0.9375rem; font-weight: 700; color: var(--color-ink); }
.prices-review-list { margin: 0; padding: 0; list-style: none; }
.prices-review-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.375rem 0;
  border-top: 1px solid var(--color-line);
  font-size: 0.9375rem;
}
.prices-review-name { flex: 1 1 14rem; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.prices-review-where { font-size: 0.8125rem; color: var(--color-muted); }

/* ------------------------------------------------------------- save bar -- */
.prices-savebar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: var(--color-card);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-ui) var(--radius-ui) 0 0;
  box-shadow: 0 -4px 14px rgb(31 26 20 / 0.1);
}
.prices-savebar.is-idle { display: none; }
.prices-savebar-words { margin: 0; min-width: 0; font-size: 0.9375rem; color: var(--color-ink); }
.prices-savebar-keep { color: var(--color-muted); }
.prices-savebar-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 39.9375rem) {
  .prices-savebar-buttons { width: 100%; }
  .prices-savebar-buttons .ui-btn { flex: 1 1 0; }
}
