/* Sale price list (ragonlist.com). Staff use it on their phones, so it is laid out for
   360–430 px first: 16 px gutters, 44 px tap targets, 17 px search text (no iOS zoom). */

:root {
  color-scheme: light dark;
  --bg: #f3f0e8;
  --surface: #ffffff;
  --surface-2: #f7f5ef;
  --ink: #17231c;
  --ink-2: #4a554d;
  --ink-3: #737d76;
  --line: #e3ded2;
  --head: #21362a;
  --head-2: #2b4537;
  --head-ink: #f7f3ec;
  --head-ink-2: rgba(247, 243, 236, 0.74);
  --head-chip: rgba(247, 243, 236, 0.1);
  --head-chip-line: rgba(247, 243, 236, 0.22);
  --status: #e5ede6;
  --status-ink: #2b4537;
  --bin: #fbeecd;
  --bin-ink: #67470a;
  --price: #121b15;
  --focus: #3d8a6a;
  --ok: #7fd3a3;
  --ok-dot: #2f9e64;
  --warn: #f2c063;
  --warn-ink: #7a4b00;
  --warn-bg: #fff3d9;
  --photo-bg: #ffffff;
  --shadow: 0 1px 2px rgba(23, 35, 28, 0.05), 0 6px 18px rgba(23, 35, 28, 0.06);
  --radius: 16px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --gutter-l: max(16px, env(safe-area-inset-left));
  --gutter-r: max(16px, env(safe-area-inset-right));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1511;
    --surface: #18201b;
    --surface-2: #1d2722;
    --ink: #edf1eb;
    --ink-2: #b9c3bb;
    --ink-3: #8b968e;
    --line: #29352d;
    --head: #132018;
    --head-2: #1a2b21;
    --status: #22332a;
    --status-ink: #c3dccb;
    --bin: #3a2e13;
    --bin-ink: #f2d897;
    --price: #ffffff;
    --warn-ink: #f2c063;
    --ok-dot: #7fd3a3;
    --warn-bg: #2f250f;
    --photo-bg: #f4f4f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.pl-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.pl-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

/* ── Header ─────────────────────────────────────────────────────────── */

.pl-head {
  background: var(--head);
  color: var(--head-ink);
  padding-top: env(safe-area-inset-top);
}

.pl-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding-top: 8px;
}

.pl-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pl-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--head-ink);
  color: var(--head);
  font: 600 22px/1 var(--serif);
}

.pl-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pl-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--head-ink-2);
}

.pl-title {
  font: 600 20px/1.15 var(--serif);
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.pl-countrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}

.pl-updated {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 44px;
  margin-right: -6px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.pl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok-dot);
}

.pl-updated.is-busy .pl-dot {
  background: var(--ink-3);
  animation: pl-pulse 1s ease-in-out infinite;
}

.pl-updated.is-warn {
  margin-right: 0;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-weight: 600;
}

.pl-updated.is-warn .pl-dot {
  background: var(--warn);
}

/* ── Sticky search + filters ────────────────────────────────────────── */

.pl-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--head);
  color: var(--head-ink);
  padding: 8px 0 12px;
  box-shadow: 0 8px 20px rgba(10, 18, 13, 0.18);
}

.pl-search {
  position: relative;
  display: flex;
  align-items: center;
}

.pl-search-icon {
  position: absolute;
  left: 14px;
  width: 22px;
  height: 22px;
  color: #6c766f;
  pointer-events: none;
}

.pl-search input {
  width: 100%;
  height: 52px;
  padding: 0 52px 0 46px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  color: #17231c;
  font-size: 17px;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.pl-search input::placeholder {
  color: #858e87;
  font-weight: 400;
}

.pl-search input::-webkit-search-cancel-button,
.pl-search input::-webkit-search-decoration {
  -webkit-appearance: none;
}

.pl-search input:focus-visible {
  outline: 3px solid var(--ok);
  outline-offset: 0;
}

.pl-clear {
  position: absolute;
  right: 4px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #5d6760;
  cursor: pointer;
}

.pl-clear svg {
  width: 20px;
  height: 20px;
}

.pl-clear[hidden] {
  display: none;
}

.pl-filters {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pl-filters::-webkit-scrollbar {
  display: none;
}

.pl-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--head-chip-line);
  border-radius: 999px;
  background: var(--head-chip);
  color: var(--head-ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.pl-chip svg {
  width: 18px;
  height: 18px;
}

.pl-chip[aria-pressed="true"] {
  border-color: var(--head-ink);
  background: var(--head-ink);
  color: var(--head);
}

#pl-photos[aria-pressed="false"] {
  color: var(--head-ink-2);
}

.pl-select {
  padding: 0;
}

.pl-select select {
  min-height: 42px;
  padding: 0 34px 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f7f3ec' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.pl-select select option {
  color: #17231c;
  background: #ffffff;
}

.pl-select.is-set {
  border-color: var(--head-ink);
  background: var(--head-ink);
  color: var(--head);
}

.pl-select.is-set select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2321362a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ── Results ────────────────────────────────────────────────────────── */

.pl-main {
  padding-top: 12px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.pl-count {
  min-width: 0;
  margin: 0 2px;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.pl-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 14px;
  font-weight: 500;
}

.pl-banner[hidden] {
  display: none;
}

.pl-banner button {
  min-height: 44px;
  margin-top: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--head);
  color: var(--head-ink);
  font-weight: 600;
  cursor: pointer;
}

.pl-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) {
  .pl-list {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
  }
}

.pl-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.pl-row:active {
  transform: scale(0.985);
  background: var(--surface-2);
}

@media (hover: hover) {
  .pl-row:hover {
    border-color: color-mix(in srgb, var(--focus) 45%, var(--line));
  }
}

.no-photos .pl-row {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.pl-thumb {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--photo-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.pl-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pl-thumb.is-empty {
  background: var(--surface-2);
}

.pl-thumb.is-empty::after,
.pl-sheet-photo.is-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink-3);
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8Z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3C/svg%3E") center / 26px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8Z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.5'/%3E%3C/svg%3E") center / 26px no-repeat;
}

.pl-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.pl-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.pl-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.pl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.pl-sku {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.pl-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.pl-tag-status {
  background: var(--status);
  color: var(--status-ink);
}

.pl-tag-bin {
  background: var(--bin);
  color: var(--bin-ink);
  font-family: var(--mono);
  font-weight: 600;
}

.pl-bins {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pl-price {
  flex: none;
  color: var(--price);
  font-size: 21px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pl-price.is-none {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.pl-skeleton {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: 16px 16px;
  gap: 10px 12px;
  height: 88px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pl-skeleton span {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%) 0 0 / 200% 100%;
  animation: pl-shimmer 1.3s linear infinite;
}

.pl-skeleton span:first-child {
  grid-row: span 2;
  height: 64px;
  border-radius: 12px;
}

.pl-skeleton span:last-child {
  width: 45%;
}

.pl-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 16px;
  color: var(--ink-3);
  text-align: center;
}

.pl-empty[hidden] {
  display: none;
}

.pl-empty svg {
  width: 36px;
  height: 36px;
}

.pl-empty p {
  max-width: 34ch;
  margin: 0;
  font-size: 15px;
}

.pl-more {
  height: 1px;
}

/* ── Item sheet ─────────────────────────────────────────────────────── */

.pl-sheet {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.pl-sheet::backdrop {
  background: rgba(8, 14, 10, 0.55);
}

.pl-sheet[open] .pl-sheet-inner {
  animation: pl-sheet-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pl-sheet-inner {
  position: relative;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 24px 24px 0 0;
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 760px) {
  .pl-sheet {
    width: min(520px, calc(100% - 48px));
    margin: auto;
  }

  .pl-sheet-inner {
    max-height: 88vh;
    border-radius: 24px;
  }

  .pl-grabber {
    display: none;
  }
}

.pl-grabber {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 2;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.18);
}

.pl-sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(23, 35, 28, 0.72);
  color: #ffffff;
  cursor: pointer;
}

.pl-sheet-close svg {
  width: 20px;
  height: 20px;
}

.pl-sheet-photo {
  position: relative;
  display: grid;
  place-items: center;
  height: min(44dvh, 380px);
  background: var(--photo-bg);
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.pl-sheet-photo.is-empty {
  height: 120px;
  background: var(--surface-2);
}

.pl-sheet-photo img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 20px;
  object-fit: contain;
}

.pl-sheet-body {
  padding: 20px var(--gutter-r) 24px var(--gutter-l);
}

@media (min-width: 760px) {
  .pl-sheet-body {
    padding: 22px 26px 28px;
  }
}

.pl-sheet-label {
  margin: 0 0 4px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pl-sheet-price {
  margin: 0;
  color: var(--price);
  font-size: clamp(48px, 15vw, 68px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.pl-sheet-price.is-none {
  font-size: 28px;
  color: var(--ink-3);
}

.pl-sheet-name {
  margin: 14px 0 0;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pl-facts {
  display: grid;
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
}

.pl-facts > div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.pl-facts dt {
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 600;
}

.pl-facts dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pl-mono {
  font-family: var(--mono);
  letter-spacing: 0.01em;
}

.pl-copy {
  min-height: 44px;
  margin: -6px 0 -6px auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.pl-sheet-bins .pl-tag {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  font-size: 14px;
  cursor: pointer;
}

.pl-hint {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

/* ── Scan button, typo note ─────────────────────────────────────────── */

.pl-searchrow {
  display: flex;
  gap: 8px;
}

.pl-searchrow .pl-search {
  flex: 1;
  min-width: 0;
}

.pl-scan-open {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--head-ink);
  color: var(--head);
  cursor: pointer;
}

.pl-scan-open svg {
  width: 26px;
  height: 26px;
}

.pl-scan-open[hidden] {
  display: none;
}

.pl-fuzzy {
  margin: 0 2px 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.pl-fuzzy[hidden] {
  display: none;
}

/* ── Scanner ────────────────────────────────────────────────────────── */

.pl-scan {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000000;
  color: #ffffff;
  overflow: hidden;
}

.pl-scan::backdrop {
  background: #000000;
}

.pl-scan-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pl-scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(82vw, 420px);
  height: min(34vh, 220px);
  transform: translate(-50%, -50%);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
  outline: 3px solid rgba(255, 255, 255, 0.92);
  overflow: hidden;
  pointer-events: none;
}

.pl-scan-line {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: #ff5a4f;
  box-shadow: 0 0 10px rgba(255, 90, 79, 0.8);
  animation: pl-scan-sweep 1.6s ease-in-out infinite alternate;
}

.pl-scan-top,
.pl-scan-bottom {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

.pl-scan-top {
  top: 0;
  padding-top: calc(12px + env(safe-area-inset-top));
}

.pl-scan-bottom {
  bottom: 0;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.pl-scan-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.pl-scan-msg {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.62);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
}

.pl-scan-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  cursor: pointer;
}

.pl-scan-btn svg {
  width: 22px;
  height: 22px;
}

.pl-scan-btn[aria-pressed="true"] {
  background: #ffffff;
  color: #000000;
}

.pl-scan-btn[hidden] {
  display: none;
}

/* ── Motion ─────────────────────────────────────────────────────────── */

@keyframes pl-shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes pl-scan-sweep {
  from {
    top: 18%;
  }
  to {
    top: 82%;
  }
}

@keyframes pl-pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes pl-sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
