/* CableClub's colors, light, then dark for devices in dark mode: everyone's
   until they pick a scheme or a mode. src/themes.ts has the same values
   (CABLECLUB_LIGHT, CABLECLUB_DARK), for anyone who picks light or dark. */
:root {
  --bg: #f8f4ea;
  --surface: #fffdf8;
  --text: #26221c;
  --muted: #655d51;
  --border: #e4dccb;
  --accent: #2a62c9;
  --accent-text: #ffffff;
  --ok-bg: #e6f4ea; --ok: #1e6b34;
  --error-bg: #fdecea; --error: #a3261b;
  --warn-bg: #fff1d6; --warn: #7a5000;
  --chart-up: #2a62c9; --chart-down: #c2610c;
  --badge-bg: #efe8da;
  --accent-2: #e84a6a;
  --art-ink: #3f3d56; --art-floor: #ebe4d6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d;
    --surface: #1d2128;
    --text: #e6e9ee;
    --muted: #98a3b3;
    --border: #2f3540;
    --accent: #6b9cf0;
    --accent-text: #0e1116;
    --ok-bg: #173323; --ok: #8fd6a4;
    --error-bg: #3a1a17; --error: #f2a097;
    --warn-bg: #3a2e12; --warn: #f0c56b;
    --chart-up: #5b8de6; --chart-down: #cc7533;
    --badge-bg: #2a303a;
    --accent-2: #ff6584;
    --art-ink: #b9bdcc; --art-floor: #262b33;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Sidebar navigation beside the page; a bar across the top on narrow screens */
body { display: grid; grid-template-columns: 14rem minmax(0, 1fr); align-items: start; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; gap: 0.3rem; width: max-content; font-weight: 700; color: var(--text); font-size: 1.45rem; padding: 0 0.6rem; margin: 0 auto 1rem; }
/* The logo takes no width of its own, then fills the brand: as wide as the text. */
.sidebar .brand svg.logo { width: 0; min-width: 100%; height: auto; fill: none; stroke: none; }
.brand:hover { text-decoration: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.sidebar h2 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; margin: 1rem 0.6rem 0.35rem; }
.sidebar h2:first-child { margin-top: 0; }
.sidebar nav a { display: flex; align-items: center; gap: 0.65rem; padding: 0.45rem 0.6rem; border-radius: 8px; color: var(--muted); }
.sidebar nav a:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.sidebar nav a.active { color: var(--text); background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); font-weight: 600; }
.sidebar nav a.active svg { color: var(--accent); }
.sidebar nav a.nav-store { font-size: 0.92rem; }
/* A store's dot sits where the other links' icons do. */
/* A store link shows its tile where the other links' icons are, with its status dot on the corner. */
.nav-logo { position: relative; flex: none; width: 1.15rem; height: 1.15rem; display: inline-flex; }
.nav-logo .store-tile { width: 100%; height: 100%; border-radius: 4px; font-size: 0.62rem; }
.nav-logo .nav-status { position: absolute; right: -0.22rem; bottom: -0.22rem; width: 0.5rem; height: 0.5rem; box-shadow: 0 0 0 2px var(--surface); }
.nav-status { width: 0.55rem; height: 0.55rem; border-radius: 50%; }
.nav-status.ok { background: var(--ok); }
.nav-status.warn { background: var(--warn); }
.nav-status.problem { background: var(--error); }
.sidebar svg { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-bottom { margin-top: auto; padding-top: 1rem; }
.org-name, .org-switch { margin-bottom: 1.25rem; padding: 1rem 0.6rem 0; border-top: 1px solid var(--border); }
.org-name { color: var(--muted); font-size: 0.85rem; }
.org-switch select { width: 100%; }
.account { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: 0.75rem; padding: 0.75rem 0.6rem 0; border-top: 1px solid var(--border); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border); font-weight: 600; font-size: 0.85rem; }
.account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account form { margin: 0.15rem 0 0; }
/* Under the account, past a line like the one above it, and centered. */
.app-version { margin-top: 0.75rem; padding: 0.6rem 0.6rem 0; border-top: 1px solid var(--border); text-align: center; }
.link-button { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.link-button:hover { text-decoration: underline; background: none; }
@media (max-width: 800px) {
  body { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 1rem; padding: 0.6rem 1rem; border-right: none; border-bottom: 1px solid var(--border); }
  .brand { margin: 0; padding: 0; font-size: 1.15rem; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar h2 { display: none; }
  .nav-bottom { margin: 0; padding: 0; border: none; }
  .org-name, .org-switch { margin: 0; padding: 0; border: none; }
  .account { margin: 0; padding: 0; border: none; }
  .account-text > span { display: none; }
  .app-version { display: none; }
}

/* Sign-in pages: one centered card, no sidebar */
body.plain { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; }
body.plain main { width: min(26rem, 100%); padding: 1rem; }
.signin { text-align: center; }
.signin h1 { font-size: 1.4rem; }
.signin .button { display: block; margin-top: 0.75rem; }
.signin .flash { text-align: left; }

/* Pages fill the space beside the sidebar, up to a very wide screen. */
main { max-width: 1920px; padding: 1.5rem 2rem; }
h1 { margin: 0 0 0.75rem; font-size: 1.6rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
.panel h2, .card h2 { margin-top: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.error-text { color: var(--error); }
.warn-text { color: var(--warn); }
/* A note under a table row, across all its columns, read as part of the row. */
tr.has-note td { border-bottom: none; }
tr.row-note td { padding-top: 0; }
tr.row-note .flash { margin: 0; border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.crumbs { margin: 0 0 0.25rem; color: var(--muted); }
h2 .small { font-weight: normal; margin-left: 0.5rem; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A number never breaks across lines, as a negative amount would after its minus sign ("−" then "$0.78"). */
td.num { white-space: nowrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.card p { margin: 0.25rem 0; }
.big { font-size: 1.8rem; font-weight: 700; }
.big small { font-size: 0.9rem; font-weight: normal; color: var(--muted); }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; margin: 1rem 0; }
/* The grid's gap spaces its panels, so they don't also take .panel + .panel's margin. */
.columns > .panel, .sources > .panel { margin-top: 0; }
/* A wide table scrolls inside its panel instead of widening the column past the screen. */
.columns > * { min-width: 0; }
.panel table { border: none; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 0.2rem 0; }
/* Centered in the window, less main's top and bottom padding. */
.empty-state { max-width: 34rem; min-height: calc(100vh - 3rem); margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
@media (max-width: 800px) { .empty-state { min-height: 0; margin: 2rem auto; } }
/* unDraw's fixed colors, swapped for the theme's. Skin tones stay as drawn. */
.empty-art { width: 100%; max-width: 26rem; height: auto; max-height: 20rem; margin-bottom: 1rem; }
.empty-art .ink { fill: var(--art-ink); }
.empty-art .ink-2 { fill: color-mix(in oklab, var(--art-ink) 70%, var(--text)); }
.empty-art .floor { fill: var(--art-floor); }
.empty-art .floor-2 { fill: color-mix(in oklab, var(--art-floor) 80%, var(--art-ink)); }
.empty-art .paper { fill: var(--surface); }
.empty-art .accent { fill: var(--accent); }
.empty-art .accent-2 { fill: var(--accent-2); }
.panel form.scheme-grid { display: grid; align-items: stretch; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.scheme { display: flex; flex-direction: column; gap: 0.45rem; margin: 0; padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 0.85rem; }
.scheme:hover { border-color: var(--muted); }
.scheme:has(:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.scheme:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.scheme input { position: absolute; opacity: 0; pointer-events: none; }
.swatches { display: flex; height: 2.25rem; border-radius: 5px; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.swatches span { flex: 1; }

input, select, button {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
input[type=checkbox] { padding: 0; }
button, .button {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  display: inline-block;
}
.button { padding: 0.4rem 0.8rem; border-radius: 6px; }
.button:hover { text-decoration: none; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

form label { display: inline-flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--muted); margin-right: 0.75rem; }
.panel form { margin: 0.5rem 0 1rem; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0.5rem; }
form.inline { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }
/* A TCG Collector check's row: Add, Skip, and It's [printing] with Match, wrapping as one line of controls. */
.check-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.check-match { padding-left: 0.6rem; border-left: 1px solid var(--border); }
.check-match label { flex-direction: row; align-items: center; gap: 0.4rem; margin: 0; font-size: inherit; color: var(--muted); }
.check-match select { width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }
.filters label { flex-direction: row; align-items: center; gap: 0.3rem; color: var(--text); font-size: 0.9rem; }
.filters input[type=search] { min-width: 260px; }
form.action { display: flex; align-items: baseline; gap: 0.75rem; margin: 0.5rem 0; }
form.action button { min-width: 9rem; }
.toolbar { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; }

.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--badge-bg); font-size: 0.78rem; margin: 0 0.2rem 0.2rem 0; white-space: nowrap; }
.badge.active, .badge.job-done { background: var(--ok-bg); color: var(--ok); }
.badge.sold_out, .badge.warn, .badge.job-running { background: var(--warn-bg); color: var(--warn); }
.badge.deleted, .badge.job-failed, .badge.group-error { background: var(--error-bg); color: var(--error); }
.badge.job-cancelled { background: var(--badge-bg); color: var(--muted); }
.badge.muted { color: var(--muted); }
.badge.group-match { background: var(--warn-bg); color: var(--warn); }
.badge.group-new { background: var(--ok-bg); color: var(--ok); }

.flash { padding: 0.6rem 0.9rem; border-radius: 6px; margin: 0 0 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--error-bg); color: var(--error); }
.impersonating { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.6rem 0.9rem; margin: 0 0 1rem; border-radius: 6px; background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.impersonating span { flex: 1 1 0; min-width: 16rem; }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash ul { margin: 0.4rem 0 0; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin: 1rem 0; flex-wrap: wrap; }
.tabs a { padding: 0.4rem 0.8rem; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.gallery { display: flex; gap: 0.5rem; overflow-x: auto; margin: 1rem 0; }
.gallery img { height: 180px; border-radius: 6px; border: 1px solid var(--border); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.job-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
pre.log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.85rem;
}

/* Holds a job's question popup on every page, without taking a place in the page's grid. */
#toasts {
  position: fixed;
  top: 1.875rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 260px;
  max-width: 480px;
  padding: 0.6rem 0.6rem 0.6rem 0.8rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18), 0 2px 6px rgb(0 0 0 / 0.08);
  opacity: 0;
  transform: translateY(-140%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1), opacity 0.3s;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-60%); transition: transform 0.4s ease-in, opacity 0.4s ease-in; }
.toast-icon {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.toast.ok .toast-icon { background: var(--ok-bg); color: var(--ok); }
.toast.error .toast-icon { background: var(--error-bg); color: var(--error); }
.toast-text { flex: 1; }
.toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}
.toast-close:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.out { transform: none; transition: opacity 0.2s; }
}

dialog {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  max-width: 460px;
  padding: 1.25rem 1.5rem;
}
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
/* While a popup is open the page behind it stays put: the wheel scrolls the popup, and never passes on to the page at its ends. */
html:has(dialog:modal) { overflow: hidden; scrollbar-gutter: stable; }
dialog { overscroll-behavior: contain; }
dialog h2 { margin-top: 0; }
/* A review of what would be pushed, in a popup wide enough for its tables. */
dialog.review-dialog { width: min(64rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 3rem); overflow: auto; }
.review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.review-head p { margin: 0.25rem 0 0; }
dialog.review-dialog .panel { border: none; padding: 0; margin: 0; background: none; box-shadow: none; }
dialog.review-dialog .panel > h2 { display: none; }
/* What the review expects to find, shown while it reads the store. */
dialog.review-dialog .panel.review-expected { margin-top: 1rem; }
.review-head h2 { margin: 0; }
.review-reading { display: flex; align-items: center; gap: 0.6rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
dialog label.check, .panel label.check { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text); font-size: 0.95rem; }
dialog ol.steps { margin: 0 0 0.75rem; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.4rem; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
/* In a popup inside a card, ".panel form" lays the form out as a row, which would shrink the buttons' row to fit them on the left. */
.panel dialog form > .dialog-buttons { flex-basis: 100%; }

.item-top { display: grid; grid-template-columns: 360px 1fr; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.item-top > .panel { margin-top: 0; align-self: stretch; }
.item-image { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
/* Zoomed in place by app.js (data-zoom): the frame stays put and clips the larger image. */
.item-image img { display: block; width: 100%; transition: transform 0.2s ease-out; }
/* "Image Coming Soon" where a picture is missing (noImage() in layout.ts): the theme's border color behind the
   surface color's words, like the seller's design, sized like a card picture by whatever holds it. */
.no-image-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.no-image-art { display: block; width: 100%; height: auto; aspect-ratio: 245 / 337; fill: var(--border); color: var(--surface); }
.tile-image .no-image-art { height: 100%; }
table.catalog td.thumb .no-image-art, table.bundle-items td.thumb .no-image-art { width: 36px; border-radius: 3px; }
.item-image.zoomed { cursor: crosshair; }
.item-image.zoomed img { transform: scale(2); }
@media (prefers-reduced-motion: reduce) { .item-image img { transition: none; } }
/* The catalog item's printings: the page's own is tinted. */
table.printings tr.current { background: var(--badge-bg); }
.printings-note { margin: 0.4rem 0 0; }
/* The "?" stays at the end of the title's line, however the title wraps. */
.your-copies .panel-head, .insights .panel-head, .your-sales .panel-head { flex-wrap: nowrap; align-items: flex-start; }
/* Buying and Selling Insights fits six columns in half the row. */
.insights th, .insights td { padding-inline: 0.5rem; }
.insights th:first-child, .insights td:first-child { padding-left: 0.75rem; }
/* Your Copies: each product's SKU over a row per store. */
.copies-product + .copies-product { margin-top: 1.25rem; }
.copies-product .sku, .your-sales .sku { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }
/* Your Sales: totals over the table, then ten sales until Show More. */
.your-sales .price-summary { margin-bottom: 0.75rem; }
.your-sales .sales-figure { font-size: 1.35rem; font-weight: 700; }
.sales-rows td { white-space: nowrap; }
.sales-rows tr[data-more] { display: none; }
.sales-rows.expanded tr[data-more] { display: table-row; }
.sales-rows + button { margin-top: 0.5rem; }
.copies-product .table-scroll { margin-top: 0.3rem; }
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.source h3 { margin-top: 0; }
.source { overflow-x: auto; }
.source table { margin: 0.5rem 0; }
/* A price source's prices, each column centered under its heading. */
.source table.source-prices th, .source table.source-prices td { text-align: center; }
/* Price warnings beside the Market Price heading, each a link to the source card it's about, which shows it's the one. */
.market-head { justify-content: flex-start; }
.price-alerts { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
a.price-alert { margin: 0; font-size: 0.85rem; font-weight: 600; padding: 0.15rem 0.6rem; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); text-decoration: none; }
a.price-alert:hover { text-decoration: none; border-color: var(--warn); }
.panel.source { scroll-margin-top: 1rem; }
.panel.source:target { box-shadow: 0 0 0 2px var(--warn); }
.source th, .source td { padding: 0.4rem 0.45rem; }
tr.used td { font-weight: 600; }
.source-actions { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

table.catalog td { vertical-align: middle; }
/* The name's link covers the whole row, so any part of it opens the card. */
table.catalog tbody tr { position: relative; }
table.catalog tbody tr:hover { background: var(--badge-bg); }
table.catalog a.row-link::after { content: ""; position: absolute; inset: 0; }
table.catalog a.row-link:focus-visible { outline: none; }
table.catalog tbody tr:has(a.row-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
table.catalog td.thumb { width: 44px; padding: 0.25rem 0.5rem; }
table.catalog td.thumb img { width: 36px; display: block; border-radius: 3px; }

.spacer { flex: 1; }
.catalog-search .filters input[type=search] { flex: 1; max-width: 520px; }
/* Filters keep to the left from the top; the heading, search, and results
   share the right column, at most five 230px tiles wide, centered beyond that. */
/* The filters span both rows; when they're taller than the heading and the
   results, the results' row takes the extra (1fr) so they stay under the search. */
.catalog-search { --catalog-max: calc(5 * 230px + 4 * 1rem); display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 1.5rem; align-items: start; }
main:has(.catalog-search) { max-width: none; }
.catalog-layout { display: contents; }
.catalog-head, .catalog-main { grid-column: 2; width: 100%; max-width: var(--catalog-max); justify-self: center; }
.catalog-head { grid-row: 1; }
.catalog-main { grid-row: 2; }
.catalog-search .facets { grid-column: 1; grid-row: 1 / span 2; }
/* The filters scroll on their own beside the cards, like the sidebar. */
.catalog-search .facets { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-inline: 0.5rem 0.75rem; }
.catalog-main .toolbar { margin-top: 0; }
.facets { display: flex; flex-direction: column; gap: 1rem; }
.facet { border: 0; margin: 0; padding: 0; min-width: 0; }
.facet legend { font-weight: 600; font-size: 0.85rem; padding: 0; margin-bottom: 0.3rem; }
.facet label { display: flex; flex-direction: row; align-items: baseline; margin-right: 0; gap: 0.4rem; font-size: 0.85rem; color: var(--text); padding: 0.1rem 0; cursor: pointer; }
.facet label input { flex: none; margin: 0; }
.facet .facet-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.facet .count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.facet details summary { font-size: 0.8rem; color: var(--accent); cursor: pointer; padding: 0.15rem 0; }
.facet select { font-size: 0.85rem; margin-top: 0.3rem; max-width: 100%; }
.facet .facet-find { width: 100%; font-size: 0.85rem; padding: 0.25rem 0.5rem; margin-bottom: 0.3rem; }
.facet label[hidden] { display: none; }
.title-link, .title-link:hover { color: inherit; text-decoration: none; }
.find-card { margin: 0 0 1.5rem; }
.artist-cards .toolbar { flex-wrap: wrap; }
.find-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.find-box { flex: 1 1 280px; position: relative; display: flex; }
.find-box svg { position: absolute; left: 0.8rem; top: 50%; width: 1.1rem; height: 1.1rem; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.catalog-search .find-box input[type=search], .artist-cards .find-box input[type=search] { flex: 1; max-width: none; font-size: 1.05rem; padding: 0.6rem 2.6rem 0.6rem 2.4rem; }
.find-box input[type=search]::-webkit-search-cancel-button { appearance: none; }
/* Shows only while the box has text (the placeholder is hidden then). */
.find-clear { display: grid; place-items: center; position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.find-clear:hover { background: var(--badge-bg); color: var(--text); }
.find-box:has(input:placeholder-shown) .find-clear { display: none; }
.feature-heading { margin: 0; font-size: 1.15rem; }
.feature-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(max(180px, (100% - 4rem) / 5), 1fr)); gap: 1rem; }
.feature-tile[hidden] { display: none; }
.feature-tile { display: flex; flex-direction: column; padding: 0.8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.feature-tile:hover { border-color: var(--accent); }
.feature-image { display: block; aspect-ratio: 245 / 337; margin-bottom: 0.7rem; border-radius: 6px; overflow: hidden; background: var(--badge-bg); }
.feature-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.feature-tile h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.feature-tile h3 a { color: var(--text); }
/* Only the set's name is the link, not the width of the tile. */
.feature-set { align-self: flex-start; max-width: 100%; font-size: 0.85rem; text-decoration: underline; }
.feature-tile p { margin: 0.1rem 0 0; }
/* One line each, so every tile in the grid is the same height. */
.feature-tile h3, .feature-set, .feature-tile p.muted { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.feature-price { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto !important; padding-top: 0.6rem; font-size: 1.2rem; font-weight: 700; }
.feature-price .badge { margin: 0; font-weight: 500; }
.catalog-empty { padding: 2.5rem 1rem; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.catalog-empty h2 { margin-top: 0; }
.catalog-empty p { max-width: 520px; margin: 0.5rem auto; }
.catalog-none { padding: 1.5rem 0; color: var(--muted); }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.view-toggle label { display: flex; flex-direction: row; align-items: center; margin: 0; padding: 0.3rem 0.75rem; font-size: 0.85rem; color: var(--text); cursor: pointer; background: var(--surface); }
.view-toggle label + label { border-left: 1px solid var(--border); }
.view-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.view-toggle label:has(input:checked) { background: var(--accent); color: var(--accent-text); }
.view-toggle label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card-tile { display: flex; gap: 1rem; padding: 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.tile-image { flex: none; width: 170px; aspect-ratio: 245 / 337; display: flex; align-items: center; justify-content: center; background: var(--badge-bg); border-radius: 6px; overflow: hidden; }
.tile-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-meta { min-width: 0; flex: 1; }
.tile-meta h3 { margin: 0; font-size: 1.05rem; }
.tile-meta p { margin: 0.1rem 0 0; }
.tile-meta .facts { margin-top: 0.6rem; font-size: 0.85rem; }
.lead { font-size: 1.1rem; margin: -0.5rem 0 0.25rem; }

button.small-button { font-size: 0.8rem; padding: 0.15rem 0.5rem; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; }

/* The catalog's Sets page: tiles grouped by era. */
.sets-toolbar { flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
.sets-find { flex: 0 1 320px; }
.sets-find input[type=search] { flex: 1; max-width: none; padding-left: 2.4rem; }
.set-era { margin-bottom: 1.75rem; }
.set-era h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.set-era h2 .count { color: var(--muted); font-size: 0.85rem; font-weight: normal; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.set-tile { display: flex; flex-direction: column; gap: 0.25rem; }
.set-tile-link { display: flex; flex-direction: column; gap: 0.25rem; color: var(--text); text-decoration: none; }
.set-tile-link:hover { text-decoration: none; }
.set-tile[hidden], .set-era[hidden] { display: none; }
.set-tile-link:hover .set-art { border-color: var(--accent); }
.set-tile-name { font-weight: 600; line-height: 1.25; }
.set-stock { color: var(--accent); font-weight: 600; align-self: flex-start; }
.set-stock:hover { text-decoration: underline; }
/* A filter shown as a chip, with × to take it away (Inventory's set, from the catalog's Sets page). */
.filter-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.4rem 0.25rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 0.9rem; white-space: nowrap; }
.filter-chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; color: var(--muted); text-decoration: none; }
.filter-chip-remove:hover { background: var(--badge-bg); color: var(--text); text-decoration: none; }
/* Logos are drawn for a light background, so their tiles stay light in dark mode too. */
.set-art { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; padding: 0.75rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 0.25rem; }
.set-art img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.set-art-text { background: var(--badge-bg); padding-top: 1.75rem; }
.set-art-name { font-size: 1.05rem; font-weight: 700; text-align: center; line-height: 1.2; color: var(--text); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.set-scope .set-art-text { padding-top: 0.75rem; }
.set-date { position: absolute; top: 0.35rem; right: 0.35rem; font-size: 0.7rem; padding: 0.05rem 0.4rem; border-radius: 999px; background: rgb(0 0 0 / 0.55); color: #fff; }
.set-scope { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.set-scope .set-art { width: 180px; margin: 0; flex: none; }
.set-scope-text { flex: 1 1 240px; min-width: 0; }
.set-scope-text h2 { margin: 0; font-size: 1.25rem; }
.set-scope-text p { margin: 0.25rem 0 0; }
.set-matches { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.set-matches .chip { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 22rem; padding: 0.25rem 0.8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.9rem; white-space: nowrap; }
.set-matches .chip-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.set-matches .chip .badge { margin: 0; }
.set-matches .chip:hover { text-decoration: none; border-color: var(--accent); }
/* Settings > Admin > Catalog > Sets: each set's logo, and a form to change it. */
.admin-set-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0; }
.admin-set-filters input[type=search] { flex: 1 1 220px; }
table.admin-sets td { vertical-align: middle; }
table.admin-sets td:nth-child(4), .logo-change summary { white-space: nowrap; }
.set-logo-thumb { display: flex; align-items: center; justify-content: center; width: 120px; height: 48px; padding: 0.25rem; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.set-logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-change summary { list-style: none; display: inline-block; cursor: pointer; }
.logo-change summary::-webkit-details-marker { display: none; }
.logo-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; min-width: 260px; }
.logo-form label { display: flex; flex-direction: column; align-items: stretch; gap: 0.2rem; font-size: 0.85rem; }
.logo-form input { width: 100%; max-width: none; }
.logo-form button { align-self: flex-start; }

/* A filter value with nothing in the results: still listed, so the filters don't move. */
.facet label.facet-empty { color: var(--muted); cursor: default; }
.facet label.facet-empty .facet-label { opacity: 0.6; }

@media (max-width: 640px) {
  main { padding: 1rem; }
  .columns, .item-top { grid-template-columns: 1fr; }
  .item-image { max-width: 360px; }
  table { display: block; overflow-x: auto; }
  .filters input[type=search] { min-width: 0; width: 100%; }
  .catalog-search { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .catalog-head, .catalog-main, .catalog-search .facets { grid-column: 1; }
  .catalog-search .facets { grid-row: 2; margin-bottom: 1.5rem; position: static; max-height: none; overflow: visible; padding-inline: 0; }
  .catalog-main { grid-row: 3; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .feature-tile { padding: 0.6rem; }
  .feature-tile:nth-child(n + 7) { display: none; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .tile-image { width: 120px; }
  .facets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .sets-find { flex: 1 1 100%; }
  .set-scope .set-art { width: 140px; }
}

/* Prices: cards waiting to be matched to a price source. */
.tabs .count { color: var(--muted); font-size: 0.8rem; margin-left: 0.2rem; }
.review { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1rem; align-items: start; }
.review-card { display: flex; gap: 0.75rem; align-items: flex-start; }
.review-card img, .review-card .no-image-art { width: 110px; flex: none; border-radius: 6px; }
.review-card h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.review-card .facts { margin-bottom: 0.6rem; }
.missing-sets { margin-bottom: 1rem; }
.missing-sets summary { cursor: pointer; font-weight: 600; }
.missing-sets table { margin-top: 0.75rem; }
@media (max-width: 640px) {
  .review { grid-template-columns: minmax(0, 1fr); }
}

/* Settings: sidebar with General and the Admin group */
.settings-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.settings-nav { position: sticky; top: 1rem; }
.settings-nav h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.4rem; }
.settings-nav ul { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.settings-nav a { display: block; padding: 0.35rem 0.6rem; border-radius: 6px; color: var(--text); text-decoration: none; }
.settings-nav a:hover { background: var(--border); }
.settings-nav a.active { background: var(--border); font-weight: 600; }
/* A page with pages under it (Admin's Catalog): its pages sit indented below it. */
.settings-nav ul.settings-subnav { margin: 0 0 0.25rem 0.75rem; padding-left: 0.5rem; border-left: 1px solid var(--border); }
.settings-body > h1:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .settings-nav { position: static; display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
  .settings-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
  .settings-nav h2 { width: 100%; margin: 0.25rem 0; }
}

/* Inventory card matching */
/* Candidate cards: a fixed image slot beside the details, the button at the
   bottom, and every card in a row the same height. The grid selectors outrank
   ".panel form", which would otherwise wrap and bottom-align the contents. */
.candidates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 0.75rem; align-items: stretch; grid-auto-rows: 1fr; }
.candidates-grid > .candidate, .candidate {
  display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 0.75rem; align-items: stretch;
  flex-wrap: nowrap; margin: 0; padding: 0.6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.candidate > img, .candidate > .no-image-art { align-self: start; width: 80px; aspect-ratio: 245 / 337; border-radius: 4px; object-fit: contain; }
.candidate > div { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; height: 100%; overflow-wrap: anywhere; }
.candidate strong { display: block; line-height: 1.3; }
.candidate select { display: block; width: 100%; max-width: 12rem; margin-top: 0.35rem; }
.candidate > div > :last-child:not(:first-child) { margin-top: auto; }
.candidate button { align-self: flex-start; }
.candidate > div > :nth-last-child(2) { margin-bottom: 0.5rem; }
.review .candidate.linked { border-color: var(--accent); }
.match-search { margin-top: 0.75rem; }
.match-search input[type=search] { width: 100%; max-width: 420px; }
.match-search .candidates-grid { margin-top: 0.75rem; }

/* "?" help: a popup on hover or keyboard focus */
.help-tip { position: relative; display: inline-block; vertical-align: middle; }
.help-icon { width: 1.25rem; height: 1.25rem; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--badge-bg); color: var(--muted); font-size: 0.75rem; font-weight: 700; line-height: 1; cursor: help; }
.help-icon:hover, .help-icon:focus-visible { color: var(--text); border-color: var(--muted); }
.help-popup {
  position: absolute; z-index: 20; top: calc(100% + 0.5rem); left: -0.5rem; width: min(26rem, calc(100vw - 2rem));
  padding: 0.75rem 0.9rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); font-size: 0.85rem; font-weight: 400; line-height: 1.45;
  /* A "?" in a table heading mustn't pass on the heading's capitals and alignment. */
  text-transform: none; letter-spacing: normal; text-align: left; white-space: normal;
  visibility: hidden; opacity: 0; transition: opacity 0.12s;
}
.help-tip:hover .help-popup, .help-tip:focus-within .help-popup { visibility: visible; opacity: 1; }
.help-tip.end .help-popup { left: auto; right: -0.5rem; }
/* Opened above the "?" when there's more room there (app.js); one too tall for the window scrolls inside. */
.help-tip.up .help-popup { top: auto; bottom: calc(100% + 0.5rem); }
.help-popup { overflow-y: auto; overscroll-behavior: contain; }
.help-popup strong { display: block; margin-bottom: 0.4rem; }
.help-list { display: grid; gap: 0.4rem; }
.help-list span { padding-left: 0.9rem; position: relative; }
.help-list span::before { content: "•"; position: absolute; left: 0; color: var(--muted); }
/* The card condition guide (condition-guide.ts): each condition's name in its color, its value, then what it looks like. */
.condition-guide { display: flex; flex-direction: column; gap: 0.85rem; }
.guide-entry { display: flex; flex-direction: column; gap: 0.2rem; }
.guide-entry b { font-weight: 600; }
.guide-entry i { font-size: 0.82rem; }
.guide-nm { color: var(--ok); }
.guide-lp, .guide-mp { color: var(--warn); }
.guide-hp, .guide-dmg { color: var(--error); }
.guide-sealed { color: var(--accent); }
/* Take Home or Listed Price (store-pricing.ts): the same markup aimed both ways, side by side. */
.pricing-form legend.aim-legend { display: flex; align-items: center; gap: 0.4rem; }
.aim-examples { margin-top: 0.35rem; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.aim-examples th, .aim-examples td { padding: 0.3rem 0.45rem; text-align: right; white-space: nowrap; }
.aim-examples th { font-size: 0.68rem; }
.aim-examples thead tr:first-child th { text-align: center; color: var(--text); }
.aim-examples thead tr:first-child th:first-child, .aim-examples td:first-child { text-align: left; }
.aim-examples th[colspan], .aim-examples tr:last-child th:nth-child(odd), .aim-examples td:nth-child(even) { border-left: 1px solid var(--border); }
.aim-examples tbody tr:last-child td { border-bottom: none; }
/* On phones the popup spans the fieldset, not the legend, so the table fits. */
@media (max-width: 640px) {
  .pricing-form legend.aim-legend { position: static; }
  .pricing-form fieldset:has(> legend.aim-legend) { position: relative; }
  .aim-examples { font-size: 0.74rem; }
  .aim-examples th, .aim-examples td { padding: 0.25rem 0.3rem; }
  .aim-examples th { white-space: normal; letter-spacing: 0; }
}
@media (max-width: 640px) {
  .help-tip { position: static; }
  .help-popup, .help-tip.end .help-popup { left: 0; right: 0; width: auto; }
  :has(> .help-tip) { position: relative; }
  .panel form.auto-row { position: relative; }
  .auto-row .auto-row-label { position: static; }
}

/* Sync: a card per store, a page per store, and Add a Store. */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0.1rem 0 0; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.head-actions form { margin: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.panel-head h2 { margin: 0; }
.panel .panel-head form { margin: 0; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; margin: 0 0 1.5rem; }
.store-grid > .panel { margin: 0; }
/* Connections' cards hold more than Add a Store's, so they get more room. */
.connection-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.connection-grid .add-store { min-height: 7rem; }
.store-card { display: flex; flex-direction: column; gap: 0.75rem; }
.store-head { display: flex; align-items: center; gap: 0.75rem; }
.store-head .badge { margin: 0; }
.store-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.store-name h2 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.store-name h2 .badge { font-weight: 500; }
.store-name h2 a { color: inherit; }
.store-tile { flex: none; width: 2.5rem; height: 2.5rem; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; background: color-mix(in oklab, var(--accent) 14%, var(--surface)); color: var(--accent); }
.store-tile.small { width: 1.6rem; height: 1.6rem; border-radius: 7px; font-size: 0.8rem; }
.store-tile.large { width: 3.2rem; height: 3.2rem; border-radius: 12px; font-size: 1.5rem; }
/* A store's logo in its tile (docs/logos.md): the store's square profile icon, edge to edge, its corners rounded like the tile's. A -dark one replaces the light one in dark mode. */
.store-tile.logo { background: none; overflow: hidden; }
.store-tile.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-tile.logo img.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .store-tile.logo img.logo-dark { display: block; }
  .store-tile.logo img.logo-light { display: none; }
}
/* The key popup: short, so its "?" help can hang past its edge instead of giving it scrollbars. Its fields, and Remove Key at the far left of the buttons. */
dialog.key-dialog { width: min(26rem, calc(100vw - 2rem)); overflow: visible; }
.key-fields { display: flex; flex-direction: column; gap: 0.85rem; }
.dialog-buttons .dialog-start { margin-right: auto; }
/* A store's name links to its own site, marked with the arrow out. */
.store-name h2 a .tab-icon, a.button .tab-icon { margin-left: 0.25rem; vertical-align: -0.05em; }
.store-problem { margin: 0; color: var(--error); }
.store-problem-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.store-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.store-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.store-can { display: flex; flex-wrap: wrap; }
.connected { color: var(--ok); font-weight: 600; }
.add-store { min-height: 12rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem; padding: 1rem; border: 2px dashed var(--border); border-radius: 8px; color: var(--text); text-align: center; }
.add-store:hover { border-color: var(--accent); text-decoration: none; }
.add-plus { font-size: 2rem; line-height: 1; color: var(--accent); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--border); }
.activity li:first-child { border-top: none; }
.activity .badge { margin: 0; }
.activity-what { flex: 1 1 16rem; min-width: 0; display: flex; flex-direction: column; }
.activity-meta { display: flex; align-items: center; gap: 0.75rem; white-space: nowrap; }
.action-list { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.85rem 0; border-top: 1px solid var(--border); }
.action-row:first-child { border-top: none; }
.action-text { flex: 1 1 18rem; display: flex; flex-direction: column; }
.action-last { min-width: 10rem; }
.action-row button { min-width: 9rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat-grid > .panel { margin: 0; }
.stat { display: flex; flex-direction: column; }
.kind-picks fieldset { border: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.kind-picks label { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 1rem; color: var(--text); margin: 0; }
.panel form.kind-picks { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.panel form.schedule-picks { align-items: center; gap: 0.75rem 1.5rem; }
/* The buy price reads as one line: "Pay up to [70] % of market". */
.buy-price-row, .buy-price-picks label.choice { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 1rem; color: var(--text); margin: 0; }
.buy-price-row input[type=number], .buy-price-picks input[type=number] { width: 4.5rem; }
.panel form.buy-price-picks { display: block; }
.buy-price-picks fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.schedule-picks label:not(.check) { flex-direction: row; align-items: center; gap: 0.5rem; }
.panel form.auto-row { gap: 0.75rem 1rem; margin: 0.75rem 0 0.5rem; padding: 0.75rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.auto-pick { display: inline-flex; align-items: center; gap: 0.5rem; }
.auto-row-label { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; }

/* A store's Pricing tab. */
.panel form.pricing-form { display: block; margin: 1rem 0; }
.pricing-form fieldset { border: none; margin: 0 0 1.5rem; padding: 0; }
.pricing-form legend { padding: 0; margin-bottom: 0.5rem; font-weight: 600; }
.pricing-form fieldset > p { margin: 0 0 0.6rem; }
.pricing-form fieldset > p + .field-row { margin-top: 0; }
.pricing-form .field-row + p { margin-top: 0.4rem; }
.pricing-form label.choice { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 1rem; color: var(--text); margin: 0 1.25rem 0.25rem 0; }
.panel form.mode-picks { display: block; margin: 0 0 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
/* A legend can't sit in a flex row, so a hidden one names the group for screen readers and a span shows it. */
.mode-picks fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.5rem 1.1rem; }
.mode-picks .mode-label { font-size: 1.15rem; font-weight: 700; margin-right: 0.25rem; }
@media (max-width: 480px) { .mode-picks fieldset { gap: 0.5rem 0.7rem; } .mode-picks .mode-label { margin-right: 0; } }
.mode-picks label.choice { flex-direction: row; align-items: center; gap: 0.4rem; font-size: 1rem; color: var(--text); margin: 0; }
.pricing-form .field-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.pricing-form .field-row label { margin: 0; }
.pricing-form label > span { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--text); }
.pricing-form table.markup-points { width: auto; background: none; border: none; }
.pricing-form table.markup-points th, .pricing-form table.markup-points td { padding: 0.2rem 1rem 0.2rem 0; border: none; background: none; text-align: left; font-weight: 500; }
.pricing-form table.markup-points td { vertical-align: middle; }
.pricing-form [data-add-markup] { margin-top: 0.4rem; }
.pricing-form .tier-buttons { white-space: nowrap; }
.tier-move { width: 2rem; min-height: 2rem; padding: 0; margin-right: 0.2rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 0.95rem; line-height: 1; }
.tier-move:disabled { opacity: 0.35; }
/* Fieldsets won't shrink below their contents unless told to, and the tier inputs need to fit a phone. */
.pricing-form fieldset { min-width: 0; }
/* A field a save couldn't read: outlined until it's edited. */
.field-error, .pricing-form input.field-error, .pricing-form select.field-error { border-color: var(--error); box-shadow: 0 0 0 2px color-mix(in oklab, var(--error) 30%, transparent); }
#pricing-problems ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.field-error:focus, .field-error:focus-visible { outline: 2px solid var(--error); outline-offset: 1px; }
.pricing-form table.markup-points input { width: 5.5rem; max-width: 100%; }
.pricing-form table.markup-points th, .pricing-form table.markup-points td { padding-right: 0.6rem; }
/* Round Prices' choices: part of the Rounding fieldset, dimmed while it's off. */
.pricing-form fieldset.round-options { border: 0; margin: 0.4rem 0 0.75rem; padding: 0 0 0 1.6rem; }
.pricing-form fieldset.round-options:disabled { opacity: 0.5; }
.pricing-form .round-slider { margin-top: 0.75rem; }
.pricing-form .round-label { position: relative; display: flex; align-items: center; gap: 0.4rem; }
/* The popup starts at the label, not the ?, so it fits on a phone. */
.pricing-form .round-label .help-tip { position: static; }
.pricing-form .round-label label { margin: 0; }
.pricing-form .round-control { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.25rem; }
.pricing-form .round-slider input[type="range"] { width: min(100%, 16rem); }
.pricing-form .round-slider p { margin: 0.25rem 0 0; }
.pricing-form .round-example { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; padding: 0.35rem 0.75rem; border-radius: 8px; background: var(--badge-bg); }
.round-example-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.round-example strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
/* A ? that explains something: shown on hover, or on tap (focus) on phones. */
.help-tip:has(> .help-tip-button) { position: relative; display: inline-flex; }
.help-tip-button { width: 1.4rem; height: 1.4rem; min-height: 0; padding: 0; border-radius: 50%; font-size: 0.8rem; font-weight: 700; line-height: 1; background: var(--badge-bg); color: var(--text); border: 1px solid var(--border); }
.help-tip-text { display: none; position: absolute; left: 0; bottom: calc(100% + 0.4rem); z-index: 20; width: min(20rem, 80vw); padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 0.85rem; line-height: 1.4; box-shadow: 0 6px 20px rgb(0 0 0 / 0.15); }
.help-tip:hover .help-tip-text, .help-tip:focus-within .help-tip-text { display: block; }
.pricing-form .cents-box { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--text); font-weight: 600; }
.pricing-form .cents-box input { width: 4.5rem; }
.fee-facts { margin: 0 0 1.25rem; }
.fee-facts h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.fee-facts p { margin: 0.4rem 0 0; }
.form-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
table.pricing-preview td { vertical-align: top; }
.price-steps summary { cursor: pointer; list-style-position: inside; }
.price-steps ol { margin: 0.4rem 0 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--muted); text-align: left; min-width: 16rem; }
.price-steps li { display: flex; justify-content: space-between; gap: 1rem; }
/* Segmented links: one of a few choices (a kind, a store, a period). */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented a { padding: 0.35rem 0.9rem; color: var(--muted); text-decoration: none; }
.segmented a + a { border-left: 1px solid var(--border); }
.segmented a.active { background: var(--badge-bg); color: var(--text); font-weight: 600; }
/* Sales: a row each for the store, search, and page size, then the date ranges. */
.sales-filters { flex-direction: column; align-items: stretch; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sales-filters input[type=search] { flex: 1; min-width: 12rem; max-width: 28rem; }
/* The choices sit on the border color with a 1px gap between them, so the lines between survive wrapping. */
.ranges { display: inline-grid; grid-auto-flow: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.filters .ranges label, .ranges button { display: block; margin: 0; padding: 0.35rem 0.9rem; border: 0; border-radius: 0; background: var(--surface);
  color: var(--muted); font: inherit; font-size: 0.9rem; text-align: center; cursor: pointer; }
.filters .ranges label:hover, .ranges button:hover { background: var(--badge-bg); color: var(--text); }
.filters .ranges label:has(:checked), .ranges button[aria-pressed=true] { background: var(--badge-bg); color: var(--text); font-weight: 600; }
.ranges label:has(:focus-visible), .ranges button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Room for the bold label, so choosing one doesn't shift the rest. */
.ranges [data-label]::after { content: attr(data-label); display: block; height: 0; overflow: hidden; visibility: hidden; font-weight: 600; }
/* The heading starts the page over, like its sidebar link. */
.heading-link { color: inherit; text-decoration: none; }
.heading-link:hover { text-decoration: underline; }
.sales-count { margin: 0 0 0 auto; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.date-pair { display: flex; flex-wrap: wrap; gap: 0.75rem; }
@media (max-width: 640px) {
  .ranges { display: grid; grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
  .ranges button { grid-column: 1 / -1; }
}
table.sortable th a { color: inherit; text-decoration: none; white-space: nowrap; }
table.sortable th a:hover { color: var(--text); }
table.sortable th[aria-sort] a { color: var(--text); }
table.sortable th a { display: inline-flex; align-items: center; gap: 0.25rem; }
.sort-icon { width: 0.6rem; height: 0.85rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.45; }
table.sortable th a:hover .sort-icon { opacity: 0.8; }
.sort-icon.asc, .sort-icon.desc { opacity: 1; }
.sort-icon.asc .down, .sort-icon.desc .up { opacity: 0.25; }
.table-scroll { overflow-x: auto; }
@media (max-width: 640px) {
  table.pricing-preview .wide-only { display: none; }
  table.pricing-preview th, table.pricing-preview td { padding-inline: 0.4rem; }
  .price-steps ol { min-width: 0; }
}
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
/* The card's own heading and text, not those of a popup inside it. */
.danger-zone > div > h2 { margin-bottom: 0.25rem; }
.danger-zone > div > p { margin: 0; }
button.danger, .button.danger { background: transparent; color: var(--error); border-color: var(--error); }
/* A link styled as a button has no border of its own, as .button.secondary sets. */
.button.danger { border: 1px solid var(--error); }
button.negative { background: var(--error); color: var(--surface); border-color: var(--error); }
.account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin: 0 0 1rem; }
/* Connections: a store's status above its tabs, the edit button on its card, and the arrows on Pulls and Pushes. */
.status-card { display: flex; flex-direction: column; gap: 0.85rem; }
.status-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 2rem; }
.status-row.waiting { align-items: center; padding-top: 0.85rem; border-top: 1px solid var(--border); }
.status-fact { display: flex; flex-direction: column; }
.status-fact strong { font-size: 1.05rem; }
.status-active { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-deleted { color: var(--error); }
.status-buttons { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.status-link { margin-left: auto; font-weight: 600; }
.status-card .store-problem-box { margin: 0; }
/*
 * The muted style, for actions that shouldn't draw the eye (an interest's Edit and Delete, a Whatnot account's links, Copy
 * In Stock Message): muted text or icon on the surface with a light border, turning the accent on hover. Every icon button
 * has it; .muted-button gives it to a text button or link (with .small-button beside a heading). Use it instead of
 * .secondary wherever an action is a helper rather than the point of the page.
 */
.icon-button, button.muted-button, .button.muted-button { color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.icon-button:hover, button.muted-button:hover, .button.muted-button:hover { color: var(--accent); background: var(--surface); border-color: var(--accent); }
.icon-button { flex: none; width: 2.75rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.icon-button svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a { display: inline-flex; align-items: center; gap: 0.35rem; }
.tab-icon { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#confirm-dialog [data-skip-row][hidden] { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.chips a { padding: 0.3rem 0.9rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); background: var(--surface); }
.chips a.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chips a:hover { text-decoration: none; border-color: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* A product page's Change Card. */
.change-card { margin-top: 1rem; }
/* A product page's last row: a single's Make It a Bundle card (combo-convert.ts) and Delete Product, evenly, one above the other on phones; the popup is wide enough for its table. */
.product-actions { display: grid; grid-template-columns: repeat(var(--columns, 1), minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
/* As tall as the tallest, each button at the bottom right so they line up. */
.product-actions > .panel { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
/* Not the popups inside them: a popup centers itself with its margins. */
.product-actions > .panel > :not(dialog) { max-width: 100%; margin-top: 0; margin-bottom: 0; }
.product-actions > .panel > button { margin-top: auto; align-self: flex-end; }
/* Market Prices' Change Linked Item (or Find Its Card, Find It in the Catalog): its button in the card's top right, opening its popup. */
#market.has-action { position: relative; }
#market.has-action > h2 { padding-right: 13rem; }
#market .market-action > button { position: absolute; top: 0.85rem; right: 1.25rem; }
dialog.list-dialog.link-dialog { width: min(46rem, calc(100vw - 2rem)); max-width: none; }
.link-dialog .change-card-search input[type=search] { max-width: none; }
/* A fixed height, so the popup keeps its size as matches come and go. */
.link-results { height: min(28rem, 55vh); overflow-y: auto; }
/* Match Card's results box while its cards are found: a spinner in the middle of the room they'll take. */
.sale-card-loading { display: flex; align-items: center; justify-content: center; height: 100%; }
.sale-card-loading .spinner { width: 1.6rem; height: 1.6rem; }
/* Match Card's copy step (pages/sales.ts): the card, then Copy beside one place for its rules, where the rules not picked keep their room. */
.sale-card-copy { --interest-box: 2.3rem; display: flex; flex-direction: column; gap: 1rem; margin: 0; }
.sale-card-copy > .candidate { max-width: 26rem; }
.sale-copy-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: end; }
.sale-copy-rules { display: grid; }
.sale-copy-rules > * { grid-area: 1 / 1; }
.sale-card-copy:has(input[name=copy][value=graded]:checked) .sale-copy-raw,
.sale-card-copy:has(input[name=copy][value=single]:checked) .sale-copy-graded { visibility: hidden; }
#market > h2 > a { white-space: nowrap; }
@media (max-width: 640px) {
  #market.has-action > h2 { padding-right: 0; }
  #market .market-action > button { position: static; margin-bottom: 0.75rem; }
}
#market > h2 > a .tab-icon, .price-source a .tab-icon { margin-left: 0.2rem; vertical-align: -0.1em; }
/* A sold buyer bundle's Sold badge and date, linking to the sale. */
a.badge .tab-icon { width: 0.75rem; height: 0.75rem; margin-left: 0.2rem; vertical-align: -0.05em; }
.facts dd > a .tab-icon { margin-left: 0.2rem; vertical-align: -0.1em; }
@media (max-width: 640px) { .product-actions { grid-template-columns: minmax(0, 1fr); } }
dialog.list-dialog.convert-dialog { width: min(46rem, calc(100vw - 2rem)); max-width: none; }
/* Its form stacks its parts, though it sits in a card, where ".panel form" lines a form's fields up in a row. */
.panel dialog.convert-dialog form { display: block; margin: 0; }
.change-card > summary { list-style: none; display: inline-block; }
.change-card > summary::-webkit-details-marker { display: none; }
.change-card[open] > summary { margin-bottom: 0.5rem; }
.change-card-search { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.change-card-search input[type=search] { flex: 1 1 18rem; max-width: 32rem; }

/* Market price summary, changes, and the price chart (product and catalog pages). */
.price-top { display: flex; gap: 1.25rem; align-items: stretch; margin-bottom: 1rem; }
.price-card { flex: none; width: 150px; aspect-ratio: 245 / 337; object-fit: contain; border-radius: 6px; background: var(--badge-bg); }
.price-facts { min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.price-facts h3 { margin: 0; font-size: 1.15rem; }
.price-facts p { margin: 0; }
/* The TCGplayer link, under the prices and level with the bottom of the card's picture. */
.price-facts .price-source { margin-top: auto; }
.price-summary { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; align-items: flex-end; margin: 0 0 0.5rem; font-variant-numeric: tabular-nums; }
.price-summary dt { font-size: 0.8rem; color: var(--muted); }
.price-summary dd { margin: 0; }
.price-summary .price-now { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
/* A card's market price in each condition, side by side (the card page's Market Price by Condition). */
.condition-prices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.condition-prices > div { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.75rem 0.5rem; border-right: 1px solid var(--border); text-align: center; }
.condition-prices > div:last-child { border-right: none; }
.condition-prices strong { font-size: 1.5rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .condition-prices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .condition-prices > div { border-bottom: 1px solid var(--border); }
}
.change { white-space: nowrap; font-variant-numeric: tabular-nums; }
.change.up { color: var(--ok); font-weight: 600; }
.change.down { color: var(--error); font-weight: 600; }
.price-chart { margin: 0.5rem 0 1rem; }
.price-chart { overflow-x: auto; }
.price-chart svg { display: block; width: 100%; min-width: 600px; height: auto; }
.range-toggle { display: flex; justify-content: flex-end; gap: 0.25rem; margin-bottom: 0.25rem; }
.range-toggle a { padding: 0.15rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.8rem; color: var(--muted); }
.range-toggle a:hover { text-decoration: none; color: var(--text); }
.range-toggle a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chart-axis line { stroke: var(--border); }
.chart-axis text { fill: var(--muted); font-size: 13px; }
.chart-band { fill: var(--accent); fill-opacity: 0.1; }
.chart-low { fill: none; stroke: var(--accent); stroke-opacity: 0.45; stroke-width: 1.5; }
.chart-market { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart-dot { fill: var(--accent); }
.chart-yours { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-hit { fill: transparent; cursor: crosshair; }
/* A finger dragged sideways moves the tip (app.js); up and down still scrolls the page. */
.price-chart svg[data-chart] { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
/* Phones get the chart's narrow drawing (prices.ts), which fits the screen so it can be touched end to end. */
.price-chart svg.chart-narrow { display: none; }
@media (max-width: 640px) {
  .price-chart svg.chart-wide { display: none; }
  .price-chart svg.chart-narrow { display: block; min-width: 0; }
}
/* SVG doesn't hide on the hidden attribute by itself. */
.chart-guide[hidden] { display: none; }
.chart-guide line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-guide circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
/* The price under the mouse, beside it (app.js). Fixed, so the chart's scroll box doesn't clip it. */
.chart-tip { position: fixed; z-index: 30; pointer-events: none; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.45rem 0.65rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.15);
  font-size: 0.82rem; line-height: 1.35; white-space: nowrap; }
.chart-tip[hidden] { display: none; }
.chart-tip strong { font-size: 0.85rem; }
.chart-tip span { display: flex; justify-content: space-between; gap: 1rem; }
.chart-tip span > :first-child { color: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-legend i { display: inline-block; width: 18px; }
.key-market { height: 0; border-top: 2.5px solid var(--accent); }
.key-band { height: 10px; background: var(--accent); opacity: 0.15; }
.key-yours { height: 0; border-top: 1.5px dashed var(--warn); }

/* Inventory: search first, then the kinds, views, and table (docs/plans/inventory-workflow.md). */
.inventory-search { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.inventory-search input[type=search] { flex: 1 1 20rem; font-size: 1.1rem; padding: 0.55rem 0.8rem; }
.inventory-kinds { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.inventory-kinds .view-toggle a { padding: 0.3rem 0.75rem; font-size: 0.85rem; color: var(--text); background: var(--surface); text-decoration: none; }
.inventory-kinds .view-toggle a + a { border-left: 1px solid var(--border); }
.inventory-kinds .view-toggle a.active { background: var(--accent); color: var(--accent-text); }
.segmented .count, .view-pills .count { color: var(--muted); font-size: 0.8rem; margin-left: 0.2rem; }
.segmented.small a { padding: 0.2rem 0.7rem; font-size: 0.9rem; }
#results > .segmented.small { margin-bottom: 0.75rem; }
.view-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.view-pills a { padding: 0.15rem 0.75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.9rem; text-decoration: none; }
.view-pills a:hover { color: var(--text); }
.view-pills a.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.view-pills a.active .count { color: var(--border); }
table.inventory td { vertical-align: middle; }
table.inventory th { white-space: nowrap; }
table.inventory th.c a { justify-content: center; }
table.inventory .c { text-align: center; font-variant-numeric: tabular-nums; }
table.inventory td.select, table.inventory th.select { width: 1.6rem; }
/* A quarter bigger than the browser's 13px, so they're easier to hit. */
table.inventory .select input[type=checkbox] { width: 16px; height: 16px; margin: 0; vertical-align: middle; cursor: pointer; }
table.inventory tbody tr[data-href] { cursor: pointer; }
table.inventory tbody tr[data-href]:hover { background: var(--bg); }
table.inventory .stack { display: inline-flex; flex-direction: column; align-items: center; gap: 0.15rem; }
table.inventory .change.small { font-size: 0.8rem; }
table.inventory .grade { font-weight: 700; font-size: 1.05rem; }
.product-cell { display: flex; gap: 0.6rem; align-items: center; min-width: 12rem; }
.product-cell img, .product-cell .no-image-art { width: 32px; aspect-ratio: 245 / 337; border-radius: 3px; flex: none; object-fit: contain; background: var(--badge-bg); }
.product-cell a { color: var(--text); font-weight: 600; }
/* A store's price, clicked to change it; the pencil says so. */
button.price-edit { background: none; border: 0; border-bottom: 1px dashed var(--muted); border-radius: 0; padding: 0 0.1rem; color: var(--text); font-weight: 700; cursor: text; font-variant-numeric: tabular-nums; }
button.price-edit::after { content: "✎"; margin-left: 0.3rem; color: var(--muted); font-weight: 400; }
.price-form { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.35rem; margin: 0; }
.price-form input { width: 5rem; text-align: center; padding: 0.2rem 0.4rem; }
.price-problem { flex-basis: 100%; color: var(--error); font-size: 0.8rem; }
/* A price waiting in Price Changes: the price now struck through, the suggestion, its change, flags, and Approve and Keep. */
table.inventory .suggestion .was { color: var(--muted); font-variant-numeric: tabular-nums; }
table.inventory .suggestion details.price-steps { display: inline-block; }
table.inventory .suggestion .price-steps ol { min-width: 14rem; }
.cell-flags { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem; }
.cell-flags .badge { margin: 0; }
.cell-actions { display: inline-flex; gap: 0.35rem; align-items: center; }
.cell-actions button { white-space: nowrap; }
.recipe-would { display: block; margin-top: 0.15rem; }
.row-menu-items form { margin: 0; }
.row-menu-items .link-button { display: block; width: 100%; padding: 0.35rem 0.7rem; border-radius: 6px; text-align: left; color: var(--text); }
.row-menu-items .link-button:hover { background: var(--bg); text-decoration: none; }
td.row-actions { text-align: right; width: 1%; }
details.row-menu { position: relative; display: inline-block; }
details.row-menu summary { list-style: none; cursor: pointer; }
details.row-menu summary::-webkit-details-marker { display: none; }
.row-menu-items { position: absolute; right: 0; top: calc(100% + 0.25rem); z-index: 10; display: flex; flex-direction: column; min-width: 12rem; padding: 0.3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.12); text-align: left; }
/* app.js pins an open menu to the viewport (fixed), above or below its button, so the table's clipping can't hide it. */
details.row-menu[open]:not(.placed) .row-menu-items { visibility: hidden; }
details.row-menu.placed .row-menu-items { position: fixed; right: auto; }
.row-menu-items a { padding: 0.35rem 0.7rem; border-radius: 6px; color: var(--text); text-decoration: none; white-space: nowrap; }
.row-menu-items a:hover { background: var(--bg); }
/* Biggest Moves, at the top of Moved 5% or More: bars either side of a $0 line, labeled, with a breakdown on hover. */
.moves { margin-bottom: 1rem; }
.moves-chart { margin-top: 0.5rem; }
.move-row, .move-axis { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) minmax(0, 1fr) 10rem; align-items: center; }
.move-row { position: relative; padding: 0.25rem 0; border-radius: 6px; color: var(--text); text-decoration: none; }
.move-row:hover, .move-row:focus-visible { background: var(--bg); text-decoration: none; }
.move-name { font-size: 0.88rem; padding-right: 0.75rem; line-height: 1.25; overflow: hidden; }
.move-name .muted { display: block; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.move-down { display: flex; justify-content: flex-end; height: 1.2rem; border-right: 1px solid var(--muted); }
.move-up { display: flex; height: 1.2rem; }
.move-bar { height: 100%; min-width: 3px; }
.move-bar.up { background: var(--chart-up); border-radius: 0 4px 4px 0; }
.move-bar.down { background: var(--chart-down); border-radius: 4px 0 0 4px; }
.move-value { text-align: right; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.move-tip { position: absolute; z-index: 5; left: 50%; top: calc(100% + 0.2rem); width: 17rem; padding: 0.6rem 0.8rem; display: flex; flex-direction: column; gap: 0.15rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
  font-size: 0.82rem; line-height: 1.4; visibility: hidden; opacity: 0; transition: opacity 0.12s; pointer-events: none; }
.move-row:hover .move-tip, .move-row:focus-visible .move-tip { visibility: visible; opacity: 1; }
.move-tip strong { margin-bottom: 0.25rem; }
.move-line { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.move-line.total { border-top: 1px solid var(--border); padding-top: 0.2rem; margin-top: 0.1rem; font-weight: 600; }
.move-axis { margin-top: 0.2rem; padding-top: 0.3rem; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.move-ticks { display: flex; justify-content: space-between; }
@media (max-width: 640px) {
  .move-row, .move-axis { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) minmax(0, 1fr) 6rem; }
  .move-value .muted { display: none; }
}
/* Rows checked on Inventory: what can be done with them. */
.selection-bar { position: sticky; bottom: 1rem; z-index: 5; display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: 0.7rem 1rem;
  background: var(--text); color: var(--surface); border-radius: 10px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.2); }
.selection-bar[hidden] { display: none; }
.selection-bar .link-button { color: var(--surface); text-decoration: underline; }
/* The bar's ⋯ menu (Approve Prices on a store), at its right end; its items read like the rows' ⋯ menu. */
.selection-bar .selection-menu { margin-left: auto; }
.selection-bar .row-menu-items .link-button { color: var(--text); text-decoration: none; white-space: nowrap; }
.selection-bar .row-menu-items .link-button:disabled { color: var(--muted); cursor: default; background: none; }
/* A thumbnail's larger image beside it while the mouse is over it (data-preview in app.js). */
.image-preview { position: fixed; z-index: 30; width: min(300px, 80vw); aspect-ratio: 245 / 337; border-radius: 12px; overflow: hidden; background: var(--surface) center / cover no-repeat; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18), 0 2px 6px rgb(0 0 0 / 0.08); pointer-events: none; }
.image-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tile-price { margin: 0.5rem 0 0 !important; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-price .change { font-size: 0.9rem; }

@media (max-width: 640px) {
  .price-top { flex-direction: column; }
}

/* A product's copies: summary, batches (the oldest sells next), history, and their dialogs. */
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.panel-head h2 { margin: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.copies-summary { display: flex; flex-wrap: wrap; gap: 0.75rem 2.5rem; margin: 1rem 0; font-variant-numeric: tabular-nums; }
.copies-summary dt { font-size: 0.8rem; color: var(--muted); }
.copies-summary dd { margin: 0; font-size: 1.15rem; font-weight: 600; }
table.batches td { vertical-align: middle; }
table.batches tr.sells-next { background: var(--badge-bg); }
.badge.next { background: var(--accent); color: var(--accent-text); }
.batch-edit summary { list-style: none; cursor: pointer; }
.batch-edit summary::-webkit-details-marker { display: none; }
.batch-edit form { margin-top: 0.4rem; }
ul.history { list-style: none; margin: 0 0 0.5rem; padding: 0; }
ul.history li { display: flex; gap: 1rem; align-items: baseline; min-height: 2rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
ul.history li > span:first-child { flex: none; width: 6.5rem; }
ul.history li[data-more] { display: none; }
ul.history.expanded { max-height: 22rem; overflow-y: auto; }
ul.history.expanded li[data-more] { display: flex; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
dialog fieldset.choices { border: 0; margin: 0 0 0.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
dialog fieldset.choices legend { padding: 0; margin-bottom: 0.3rem; font-size: 0.85rem; color: var(--muted); }
dialog label.narrow { max-width: 10rem; margin-bottom: 0.75rem; }
dialog .preview { background: var(--bg); border-radius: 6px; padding: 0.6rem 0.8rem; font-size: 0.9rem; margin: 0.75rem 0 0; }
dialog .preview:empty { display: none; }
/* Remove Copies shows one count box at a time: Copies to Remove, or Copies You Counted for Count was too high.
   It shares a row with Note, so it drops the bottom margin narrow boxes have on a line of their own. */
dialog label[hidden] { display: none; }
dialog label.narrow:is([data-remove-count], [data-recount-count]) { margin-bottom: 0; }
@media (max-width: 640px) {
  .dialog-grid { grid-template-columns: 1fr; }
}
dialog:has(.dialog-grid) { max-width: 560px; width: calc(100% - 2rem); }
dialog form > label input[type=text], .dialog-grid input { width: 100%; }

/* A product's Pricing section: the market strip, then one row per store. */
.market-strip { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem 1.5rem; padding: 0.75rem 1rem; margin: 0.75rem 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.market-strip > div { display: flex; flex-direction: column; }
/* A figure in the strip: its label centered over its value, and a warning under the value it's about. */
.market-strip > .strip-figure { align-items: center; text-align: center; gap: 0.15rem; }
.price-warnings { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem; margin-top: 0.1rem; }
.price-warnings .badge { margin: 0; }
td.num .price-warnings { display: flex; justify-content: flex-end; }
/* Under the amount in a price source's centered table, so the column stays narrow. */
.source-prices .price-warnings { display: flex; justify-content: center; }
.panel > .price-warnings { display: flex; justify-content: flex-start; margin: 0 0 0.5rem; }
.badge.stack { white-space: normal; text-align: center; line-height: 1.25; border-radius: 10px; padding: 0.15rem 0.55rem; }
.market-strip .market-now { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.market-strip .strip-end { margin-left: auto; }
.market-strip > span { align-self: center; }
.pricing-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.5rem; }
.pricing-chips:empty { display: none; }
table.pricing td { vertical-align: middle; }
table.pricing .price-cell { font-weight: 700; font-size: 1.05rem; }
table.pricing tr.needs-decision { background: var(--warn-bg); }
table.pricing tr.not-listed td { color: var(--muted); }
.pricing-actions { white-space: nowrap; text-align: right; }
.pricing-actions form.inline { display: inline-flex; margin-left: 0.4rem; }
.pricing-actions .link-button { margin-left: 0.4rem; }

/* A product's Stores section: one card per connected store. */
.store-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; margin: 0.75rem 0; }
.store-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1rem; border: 1px solid var(--border); border-radius: 8px; }
.store-card p { margin: 0; }
/* A select is as wide as its longest option (Whatnot's profile names run long), so it's held to the card. */
.store-card { min-width: 0; }
.store-shipping { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; margin: 0; }
.store-shipping select { width: 100%; min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.store-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; font-size: 1.05rem; }
.store-card-head .badge { margin: 0; }
/* View Listing: the listing on its store, in a new tab, in the card's top right. */
.store-card-head .store-card-view { margin-left: auto; font-size: 0.85rem; white-space: nowrap; }
.store-card-view .tab-icon { margin-left: 0.2rem; vertical-align: -0.1em; }
.store-card-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: auto; padding-top: 0.25rem; }
.store-card-actions form, .store-card-actions > button { margin-left: auto; }
.store-card-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-left: auto; }
.store-card-buttons form { margin: 0; }
/* The store card's List on Whatnot popup: New Product's Whatnot settings (.np-whatnot). */
dialog.list-dialog { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: auto; }
.list-dialog .np-whatnot { margin: 1rem 0; }
.warn-text { color: var(--warn); }
dialog fieldset.choices.stacked { flex-direction: column; flex-wrap: nowrap; }
dialog fieldset.choices.stacked label.check { align-items: flex-start; }

/* Lots. */
.lot-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.75rem; align-items: end; }
ul.lot-results { list-style: none; margin: 0.75rem 0 0; padding: 0; }
ul.lot-results li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
input.narrow-number { width: 5rem; }
dialog form > h2, dialog label.lot-pick { width: 100%; }
dialog label.lot-pick { margin-bottom: 0.5rem; }
dialog input:disabled { opacity: 0.5; }

/* A featured tile's price move, like a portfolio app's: an arrow by the price, the change under it. */
.trend { font-size: 0.75em; margin-right: 0.3rem; vertical-align: 0.1em; }
.trend.up, .feature-change.up { color: var(--ok); }
.trend.down, .feature-change.down { color: var(--error); }
.feature-change { margin: 0.1rem 0 0 !important; font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.badge.set-by { font-size: 0.72rem; margin: 0 0 0 0.35rem; vertical-align: 0.1em; font-weight: 500; }
.badge.set-by.recipe { background: var(--ok-bg); color: var(--ok); }

/* A featured tile opens its card from anywhere on it: the name's link stretches over the tile, and the set's link sits above that. */
.feature-tile { position: relative; cursor: pointer; }
.feature-tile h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.feature-tile h3 a:focus-visible { outline: none; }
.feature-tile:has(h3 a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.feature-set { position: relative; z-index: 1; }

/* A product being deleted. */
.panel.deleting { border-color: var(--error); }
ul.deleting-stores { list-style: none; margin: 0 0 1rem; padding: 0; }
ul.deleting-stores li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }

/* The dashboard. Cards sit side by side and stack when there isn't room. */
.dashboard-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.dashboard-row > .panel { margin-top: 0; min-width: 0; }
.panel.todo { flex: 1 1 20rem; display: flex; flex-direction: column; gap: 0.6rem; }
.todo .panel-head { justify-content: flex-start; margin-bottom: 0; }
.todo-badge { min-width: 1.4rem; padding: 0 0.45rem; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 0.8rem; font-weight: 700; text-align: center; }
a.todo-task { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
a.todo-task:hover { border-color: var(--muted); }
.todo-count { flex: none; min-width: 1.75rem; font-size: 1.4rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.todo-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.todo-go { color: var(--accent); font-size: 1.2rem; }
.todo-clear { margin: 0; }
.todo-clear:empty { display: none; }
/* Nothing to do: the illustration and the line, centered in the space above the statuses. */
.todo-caught-up { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.5rem 0; text-align: center; }
.todo-caught-up .empty-art { width: auto; max-width: 100%; height: 9rem; max-height: none; margin: 0; }
.todo-caught-up p { margin: 0; }
ul.todo-status { list-style: none; margin: auto 0 0; padding: 0.6rem 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; }
ul.todo-status li { display: flex; align-items: center; gap: 0.5rem; }
ul.todo-status .nav-status { flex: none; }
.panel.selling { flex: 2 1 34rem; display: flex; flex-direction: column; gap: 0.9rem; }
.selling .panel-head { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 0; }
.selling h2 .muted { font-weight: normal; margin-left: 0.35rem; }
.selling-hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.35rem 1.5rem; }
.selling-hero > div { display: flex; flex-direction: column; }
.selling-figure { font-size: 3.2rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.selling-change { padding-bottom: 0.4rem; }
.selling-note { margin: -0.4rem 0 0; }
dl.selling-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr)); gap: 0.75rem; margin: 0; }
.selling-tiles > div { background: var(--bg); border-radius: 8px; padding: 0.6rem 0.9rem; display: flex; flex-direction: column; gap: 0.1rem; }
/* Store Traffic and Whatnot This Month (dashboard.ts): a tile per store, then a funnel with sales a day. */
.panel.traffic, .panel.whatnot-month { flex: 1 1 100%; display: flex; flex-direction: column; gap: 0.9rem; }
.traffic h2 .muted, .whatnot-month h2 .muted { font-weight: normal; margin-left: 0.35rem; }
.traffic .panel-head, .whatnot-month .panel-head { margin-bottom: 0; }
.traffic-stores { display: flex; flex-wrap: wrap; gap: 1rem; align-items: stretch; }
.traffic-store { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }
.traffic-store.whatnot { flex: 2 1 30rem; }
.traffic-store.wix { flex: 1 1 16rem; }
.traffic-store h3 { margin: 0; font-size: 1rem; }
.traffic-store .selling-tiles dd.small { height: 1.35em; white-space: nowrap; text-overflow: ellipsis; }
.traffic-store h3 .muted { font-weight: normal; margin-left: 0.35rem; }
.traffic-split { display: flex; flex-direction: column; gap: 0.35rem; }
.traffic-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--badge-bg); }
.traffic-bar > span:first-child, .swatch.shows { background: var(--chart-up); }
.traffic-bar > span:last-child, .swatch.shop { background: var(--chart-down); }
.traffic-key { display: flex; gap: 1rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.4rem; }
/* The steps' 1px gaps show the border color behind them, so the dividers are right however the steps wrap. */
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.funnel-step { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.75rem 0.9rem; background: var(--surface); }
.funnel-figure { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.month-sales { display: flex; flex-direction: column; gap: 0.35rem; }
.month-sales-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.75rem; }
.month-sales-head h3 { margin: 0; font-size: 1rem; }
/* Sales a day (dashboard.ts): drawn twice like the price chart, wide and narrow for phones; its tip is the price chart's. */
.day-chart svg { display: block; width: 100%; height: auto; }
.day-chart svg[data-days] { touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.day-chart svg.chart-narrow { display: none; }
@media (max-width: 640px) {
  .day-chart svg.chart-wide { display: none; }
  .day-chart svg.chart-narrow { display: block; }
}
.spark-line { fill: none; stroke: var(--chart-up); stroke-width: 2; stroke-linejoin: round; }
.selling-tiles dt { color: var(--muted); font-size: 0.85rem; }
.selling-tiles dd { margin: 0; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Three lines whatever the note says, so the card keeps its height as the period changes. */
.selling-tiles dd.small { font-size: 0.85rem; font-weight: normal; line-height: 1.35; height: calc(3 * 1.35em); overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.dashboard-head .segmented { background: var(--surface); }

/* Your Last 10 Shows: a bar per show, its numbers beside it on hover or focus. */
.panel.shows { flex: 2 1 34rem; }
.shows .panel-head { margin-bottom: 0; }
.shows .panel-head strong { color: var(--text); }
.show-chart { position: relative; margin: 1.6rem 0 0.75rem; padding-left: 3rem; }
.show-grid { position: absolute; left: 0; right: 0; top: 0; height: 13rem; pointer-events: none; }
.show-grid > span { position: absolute; left: 3rem; right: 0; border-top: 1px solid var(--border); }
.show-grid > span > span { position: absolute; left: -3rem; width: 2.5rem; text-align: right; transform: translateY(-50%); font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
ol.show-bars { list-style: none; margin: 0; padding: 0; display: flex; }
.show-bars li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.show-plot { position: relative; height: 13rem; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.2rem; }
button.show-bar { width: min(24px, 60%); min-height: 2px; padding: 0; border: 0; border-radius: 4px 4px 0 0; background: var(--accent); cursor: default; }
/* Hover shows a show's details, and so does keyboard focus; a click doesn't keep them open. */
button.show-bar:hover, button.show-bar:focus-visible { background: color-mix(in srgb, var(--accent) 75%, var(--text)); }
.show-amount { font-size: 0.8rem; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.show-day { margin-top: 0.4rem; font-size: 0.8rem; color: var(--muted); text-align: center; line-height: 1.2; }
.show-tip { display: none; position: absolute; z-index: 5; left: calc(50% + 18px); top: 10%; width: max-content; max-width: 15rem; padding: 0.5rem 0.75rem; flex-direction: column; gap: 0.15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); font-size: 0.85rem; text-align: left; }
.show-bars li.flip .show-tip { left: auto; right: calc(50% + 18px); }
.show-bars li:hover .show-tip, .show-bars li:has(:focus-visible) .show-tip { display: flex; }
.show-tip > span:not(.show-title) { display: flex; justify-content: space-between; gap: 1rem; }
.show-tip > span > span:first-child { color: var(--muted); }
.show-title { color: var(--muted); font-size: 0.8rem; }
/* On a phone there's no room beside a bar, so the numbers go to the far side of the chart. */
@media (max-width: 40rem) {
  .show-plot { position: static; }
  .show-tip, .show-bars li.flip .show-tip { top: 0; left: auto; right: 0; max-width: min(15rem, calc(100% - 3.5rem)); }
  .show-bars li.flip .show-tip { left: 3rem; right: auto; }
}

/* Stock Value and Movers in Your Stock. */
.panel.stock { flex: 1 1 18rem; display: flex; flex-direction: column; gap: 0.9rem; }
.panel.movers { flex: 1 1 26rem; display: flex; flex-direction: column; gap: 0.5rem; }
.stock .panel-head, .movers .panel-head { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 0; }
.movers .panel-head { flex-wrap: wrap; align-items: baseline; }
.stock-figure { display: flex; flex-direction: column; }
.stock-figure strong { font-size: 1.9rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stock-paid { border-top: 1px solid var(--border); padding-top: 0.75rem; }
.stock-paid strong { font-size: 1.4rem; }
.stock-meter { display: flex; flex-direction: column; gap: 0.35rem; }
.meter { height: 0.6rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.stock-link { margin-top: auto; }
.movers-table td .small { white-space: nowrap; }
@media (max-width: 40rem) {
  .movers-table .movers-stock { display: none; }
  .movers-table td .small { display: block; white-space: normal; }
}

/* Aging Stock: copies by days in stock, the ones over 90 days in the accent color. */
.panel.aging { flex: 1 1 26rem; display: flex; flex-direction: column; gap: 0.6rem; }
.aging .panel-head { flex-wrap: wrap; align-items: center; margin-bottom: 0; }
/* The bar chart fills the card: a y axis of copies, the plot, then the x axis of days. */
.aging-chart { flex: 1; min-height: 13rem; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(8rem, 1fr) auto auto; column-gap: 0.5rem; }
.aging-axis-title { grid-column: 1 / -1; font-size: 0.75rem; color: var(--muted); }
.aging-x-title { grid-column: 2; text-align: center; margin-top: 0.15rem; }
/* The y labels and the plot share a box, with room above for the top bar's count. */
.aging-y, .aging-plot { position: relative; margin-top: 1.25rem; }
.aging-y { min-width: 1.5rem; }
.aging-y span { position: absolute; right: 0; transform: translateY(50%); font-size: 0.75rem; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.aging-plot { border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.aging-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid color-mix(in srgb, var(--border) 55%, var(--surface)); }
ol.aging-bars { list-style: none; position: absolute; inset: 0; margin: 0; padding: 0; display: flex; }
.aging-bars li { flex: 1 1 0; position: relative; }
.aging-bar { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: min(24px, 60%); min-height: 2px; border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--muted) 70%, var(--surface)); }
.aging-bars li.old .aging-bar { background: var(--accent); }
.aging-count { position: absolute; left: 0; right: 0; margin-bottom: 0.25rem; text-align: center; font-size: 0.85rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
/* A column's breakdown by kind, on hover or keyboard focus: at the top of the plot, beside the bar, toward the middle. */
.aging-bars li[tabindex] { cursor: default; outline: none; }
.aging-bars li[tabindex]:focus-visible .aging-bar { outline: 2px solid var(--accent); outline-offset: 2px; }
.aging-tip { display: none; position: absolute; top: 0; left: calc(50% + 20px); z-index: 5; min-width: 11rem; padding: 0.5rem 0.65rem;
  flex-direction: column; gap: 0.2rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 14px rgb(0 0 0 / 0.12);
  font-size: 0.8rem; white-space: nowrap; }
.aging-bars li:hover .aging-tip, .aging-bars li:focus-visible .aging-tip { display: flex; }
.aging-bars li:nth-child(n + 4) .aging-tip { left: auto; right: calc(50% + 20px); }
.aging-tip-row { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.aging-tip-row span:first-child { color: var(--muted); }
ol.aging-x { grid-column: 2; list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; }
.aging-x li { flex: 1 1 0; text-align: center; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.aging .muted.small { margin: 0; }
.movers-table th { white-space: nowrap; }

/* Bundles: the builder's two columns are the same height, and the search's matches float over the page below the box. */
.bundle-builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 21rem); gap: 1rem; align-items: stretch; }
.bundle-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.bundle-main > .panel, .bundle-builder > .panel { margin: 0; }
.bundle-cards { flex: 1 1 auto; }
.bundle-side { display: flex; flex-direction: column; gap: 1rem; }
.bundle-side > h2 { margin: 0; }
.bundle-search { margin-bottom: 0.75rem; }
.bundle-search p { margin: 0.35rem 0 0; }
.bundle-search-box { position: relative; }
.bundle-search-box input[type=search] { width: 100%; }
.bundle-results { position: absolute; top: calc(100% + 0.25rem); left: 0; right: 0; z-index: 30; }
.bundle-results-list { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); max-height: 22rem; overflow-y: auto; }
.bundle-results-list p { margin: 0; padding: 0.6rem 0.75rem; }
.bundle-results-list [role=option] { display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 2.75rem; padding: 0.45rem 0.75rem; border: 0; border-radius: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.bundle-results-list [role=option][aria-selected=true], .bundle-results-list [role=option]:hover:not(:disabled) { background: var(--badge-bg); }
.bundle-results-list [role=option]:disabled { color: var(--muted); opacity: 1; cursor: default; }
.bundle-result-title { font-weight: 600; }
.bundle-result-meta { margin-left: auto; white-space: nowrap; }
.bundle-empty { margin: 0.5rem 0; }
table.bundle-items td { vertical-align: middle; }
table.bundle-items th, table.bundle-items td { padding-left: 0.4rem; padding-right: 0.4rem; }
table.bundle-items .bundle-card { min-width: 9.5rem; }
/* Keeps the headers' hidden labels inside the scrolling table, so they don't widen the page on phones. */
table.bundle-items th { position: relative; }
table.bundle-items .on-hand { display: block; margin-top: 0.15rem; text-align: center; }
table.bundle-items td.thumb { width: 44px; padding: 0.25rem 0.5rem; }
table.bundle-items td.thumb img { width: 36px; display: block; border-radius: 3px; }
table.bundle-items tfoot td { font-weight: 600; border-bottom: none; }
table.bundle-items button.remove { width: 2rem; height: 2rem; min-height: 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1; }
table.bundle-items button.remove:hover { color: var(--error); border-color: var(--error); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; vertical-align: middle; }
.stepper button.step { width: 1.75rem; height: 1.9rem; min-height: 0; padding: 0; border: 0; border-radius: 0; background: var(--badge-bg); color: var(--text); }
.stepper > span { min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }
/* A Copies box you can type in, between − and +, with no spin buttons of its own. */
.stepper input[type=number] { width: 2.75rem; height: 1.9rem; min-height: 0; padding: 0 0.2rem; border: 0; border-radius: 0; text-align: center; font: inherit; font-variant-numeric: tabular-nums; background: var(--surface); color: var(--text); -moz-appearance: textfield; appearance: textfield; }
.stepper input[type=number]::-webkit-inner-spin-button, .stepper input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.bundle-picture { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.bundle-picture h2 { margin: 0 0 0.25rem; }
.bundle-picture p { margin: 0; }
.bundle-picture > div:last-child { flex: 1 1 15rem; }
.bundle-collage { width: 13rem; aspect-ratio: 1; flex: none; box-sizing: border-box; padding: 0.6rem; border-radius: 8px; background: var(--text); display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: 0.4rem; align-content: center; justify-items: center; }
.bundle-collage img { width: 100%; display: block; border-radius: 4px; }
.bundle-collage span { grid-column: 1 / -1; color: var(--surface); }
.panel form.bundle-form { display: flex; flex-direction: column; align-items: stretch; gap: 1rem; margin: 0; }
.bundle-field { display: flex; flex-direction: column; gap: 0.3rem; }
.bundle-field input, .bundle-field select { width: 100%; }
form .bundle-field label, .bundle-label { align-self: flex-start; margin: 0; font-size: 0.85rem; color: var(--muted); }
/* As tall as a "?" button, so the price fields are the same height with or without one. */
.bundle-label { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 1.4rem; }
.bundle-totals, .bundle-breakdown { margin: 0; display: flex; flex-direction: column; gap: 0.2rem; font-variant-numeric: tabular-nums; }
.bundle-totals { padding-top: 1rem; border-top: 1px solid var(--border); }
.bundle-totals > div, .bundle-breakdown > div { display: flex; justify-content: space-between; gap: 0.75rem; }
.bundle-totals dd, .bundle-breakdown dd { margin: 0; }
.bundle-totals p { margin: 0.2rem 0 0; }
fieldset.bundle-price { position: relative; border: 0; border-top: 1px solid var(--border); margin: 0; padding: 1rem 0 0; min-width: 0; display: flex; flex-direction: column; gap: 0.75rem; }
fieldset.bundle-price > legend { float: left; padding: 0; font-weight: 600; font-size: 1.05rem; }
.mode-cards { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
form .mode-cards label { flex-direction: row; align-items: center; gap: 0.5rem; margin: 0; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer; }
.mode-cards label:has(:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bundle-discount { display: flex; align-items: flex-end; gap: 0.6rem; }
.bundle-discount .bundle-field { flex: 1 1 auto; }
fieldset.segmented-picks { display: inline-flex; flex: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
form .segmented-picks label { position: relative; margin: 0; color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer; }
.segmented-picks input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented-picks span { display: flex; align-items: center; justify-content: center; height: 2.3rem; padding: 0 0.9rem; }
.segmented-picks label:has(:checked) span { background: var(--accent); color: var(--accent-text); }
.segmented-picks label:has(:focus-visible) span { outline: 2px solid var(--accent); outline-offset: -2px; }
/* On the Price heading's line, so a message doesn't move what's below it. */
#bundle-price-error { position: absolute; top: 1rem; left: 4rem; right: 0; margin: 0; line-height: calc(1.05rem * 1.5); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bundle-price-error:empty { display: none; }
.bundle-breakdown { padding: 0.75rem 0.9rem; border-radius: 8px; background: var(--bg); }
.bundle-breakdown .big { font-size: 1.1rem; font-weight: 700; }
.bundle-breakdown .total { margin-top: 0.2rem; padding-top: 0.3rem; border-top: 1px solid var(--border); font-weight: 700; }
.bundle-breakdown .total .up { color: var(--ok); }
.bundle-breakdown .total .down { color: var(--error); }
.bundle-breakdown .flash { margin: 0.4rem 0 0; }
#bundle-where { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
#bundle-where p { margin: 0; }
.bundle-actions { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.panel .bundle-actions form { display: block; margin: 0; }
.bundle-actions button { width: 100%; }
@media (max-width: 900px) {
  .bundle-builder { grid-template-columns: minmax(0, 1fr); }
}
dialog.publish-dialog { width: min(34rem, calc(100vw - 2rem)); }
.share-toggle { margin-left: 0.4rem; padding: 0.05rem 0.5rem; min-height: 0; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.share-toggle::after { content: " ▸"; }
.share-toggle[aria-expanded="true"]::after { content: " ▾"; }
tr.share-row td { padding-top: 0.25rem; padding-bottom: 0.25rem; font-size: 0.9rem; background: var(--bg); }
ol.publish-steps { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
ol.publish-steps li { display: flex; align-items: center; gap: 0.6rem; }
ol.publish-steps li.waiting { color: var(--muted); }
ol.publish-steps li.done .publish-mark { background: var(--ok); color: var(--surface); border-color: var(--ok); }
ol.publish-steps li.stopped .publish-mark { background: var(--error); color: var(--surface); border-color: var(--error); }
.publish-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 1.4rem; height: 1.4rem; border: 1px solid var(--border); border-radius: 50%; font-size: 0.8rem; font-weight: 700; }
.publish-mark .spinner { width: 0.9rem; height: 0.9rem; }
.publish-dialog .dialog-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.publish-dialog .dialog-buttons form { margin: 0; }

/* New Product (new-product.ts). It shares the bundle builder's two columns, fields, and breakdown. */
form.new-product { display: block; margin: 0; }
.new-product .bundle-main > .panel { display: flex; flex-direction: column; gap: 0.9rem; }
.new-product .panel h2 { margin: 0; }
.np-kinds { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.np-row { display: grid; gap: 0.75rem; }
.np-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.np-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.np-quantity { max-width: 12rem; }
fieldset.np-optional { margin: 0; padding: 0.75rem 0 0; border: 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
fieldset.np-optional legend { float: left; padding: 0; font-weight: 600; }
fieldset.np-optional .np-row { clear: both; }
.new-product p { margin: 0; }
.new-product textarea { font: inherit; }
.np-card-picked { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: flex-start; }
.np-card-image { width: 10rem; flex: none; }
.np-card-facts { flex: 1 1 16rem; display: flex; flex-direction: column; gap: 0.25rem; }
.np-card-name { font-size: 1.25rem; font-weight: 700; }
.np-card-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem 1rem; margin-top: 0.4rem; }
.np-card-actions details { flex: 1 1 100%; }
.np-card-actions details[open] { order: 2; }
.np-card-search { position: relative; display: flex; flex-direction: column; gap: 0.6rem; }
/* New Product's card and sealed product matches, floating over the page below the box, like the bundle searches'. */
.np-float-results { position: absolute; top: calc(100% + 0.25rem); left: 0; right: 0; z-index: 30; max-height: min(30rem, 60vh); overflow-y: auto; padding: 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); }
.np-float-results:empty, .np-float-results[hidden] { display: none; }
.np-float-results > p { margin: 0; }
.np-card-search input[type=search] { width: 100%; }
/* New Product's conditions: joined buttons like Live Shows', on one row at equal widths, each price under its name. */
.np-conditions { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
fieldset.np-condition-picks { display: flex; width: 100%; min-width: 0; }
.np-condition-picks label { flex: 1 1 0; min-width: 0; }
.np-condition-picks label + label span { border-left: 1px solid var(--border); }
.np-condition-picks span { flex-direction: column; height: 100%; min-height: 2.9rem; padding: 0.35rem 0.4rem; text-align: center; font-size: 0.9rem; line-height: 1.2; }
.np-condition-picks .condition-price { font-size: 0.85rem; font-weight: 500; }
.np-condition-picks em { font-style: normal; }
/* Too narrow for the names: the short forms, with the name as the tooltip. */
.np-conditions { container-type: inline-size; }
.np-condition-picks .pick-short { display: none; }
@container (max-width: 640px) {
  .np-condition-picks .pick-long { display: none; }
  .np-condition-picks .pick-short { display: inline; }
  .np-condition-picks span { padding-inline: 0.1rem; font-size: 0.85rem; }
  .np-condition-picks .condition-price { font-size: 0.78rem; }
}
.condition-price { font-weight: 700; font-variant-numeric: tabular-nums; }
/* The condition beside a market price that isn't Near Mint's ("$20.78 LP"), or NM where that needs saying. */
.condition-tag { margin-left: 0.3rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.np-label-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.np-label-row .icon-button { width: 1.9rem; height: 1.9rem; background: var(--surface); }
.np-label-row .icon-button:disabled { opacity: 0.4; cursor: default; color: var(--muted); border-color: var(--border); }
.np-label-row .icon-button svg { width: 1rem; height: 1rem; }
#np-sku-error { font-weight: 600; }
/* Edit Details (pages/edit-details.ts): New Product's pieces, plus the SKU with Regenerate SKU beside it and the stores it goes to. */
.ed-sku-row { display: flex; gap: 0.5rem; align-items: center; }
.ed-sku-row input { flex: 1; min-width: 0; }
.np-actions .button { text-align: center; }
/* Unchecking a store the product is live on asks how it comes off; shown only while unchecked. */
fieldset.ed-take-down { display: none; margin: 0; padding: 0.75rem; border: 0; border-top: 1px solid var(--border); flex-direction: column; gap: 0.4rem; }
fieldset.ed-take-down legend { float: left; padding: 0; font-weight: 600; }
fieldset.ed-take-down > label { clear: both; }
.np-store:not(:has([data-np-store]:checked)) fieldset.ed-take-down { display: flex; }
.np-photos { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.9rem; border: 2px dashed var(--border); border-radius: 10px; background: var(--bg); }
.np-photos.dragging { border-color: var(--accent); background: var(--surface); }
.np-photos.field-error { border-color: var(--error); }
ol.np-photo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
ol.np-photo-list:empty { display: none; }
.np-photo { position: relative; width: 7.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.np-photo img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 6px; background: var(--border); display: block; }
.np-photo-number { position: absolute; top: 0.35rem; left: 0.35rem; min-width: 1.4rem; height: 1.4rem; padding: 0 0.35rem; box-sizing: border-box; border-radius: 0.7rem; background: var(--text); color: var(--surface); font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.np-photo-remove { position: absolute; top: 0.25rem; right: 0.25rem; width: 1.75rem; height: 1.75rem; min-height: 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 1rem; line-height: 1; }
.np-photo-moves { display: flex; gap: 0.25rem; }
.np-photo-moves button { flex: 1; }
.np-catalog-photo img { width: 4.5rem; border-radius: 4px; opacity: 0.85; display: block; }
/* A bundle's collage, then its items' pictures, side by side. */
.np-catalog-photo.many { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.4rem; }
.np-catalog-photo .bundle-collage { width: 7.5rem; padding: 0.35rem; gap: 0.25rem; opacity: 0.85; }
.np-catalog-photo .bundle-collage img { width: 100%; opacity: 1; }
.np-photo-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.np-add-photos { position: relative; cursor: pointer; }
.np-add-photos input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.np-add-photos:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A box per store: its checkbox as the header, its listing details below while it's checked. */
.np-store { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
/* The header: the checkbox to list it, and a caret on the right to collapse its details. */
.np-store-head { display: flex; align-items: center; background: var(--bg); }
.panel label.np-store-toggle { flex: 1; display: flex; flex-direction: row; align-items: center; gap: 0.6rem; margin: 0; padding: 0.6rem 0.75rem; color: var(--text); font-weight: 600; cursor: pointer; }
button.np-store-caret { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; min-height: 0; margin-right: 0.35rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
button.np-store-caret:hover { background: var(--badge-bg); color: var(--text); }
button.np-store-caret .tab-icon { width: 1.1rem; height: 1.1rem; transition: transform 0.15s; }
.np-store.collapsed button.np-store-caret .tab-icon { transform: rotate(-90deg); }
.np-store:not(:has([data-np-store]:checked)) button.np-store-caret { visibility: hidden; }
.np-store.collapsed .np-store-options { display: none; }
.np-store-options { padding: 1rem 0.75rem; border-top: 1px solid var(--border); }
.np-store-options fieldset.bundle-price:first-child { border-top: 0; padding-top: 0; }
.np-store:not(:has([data-np-store]:checked)) .np-store-options { display: none; }
.np-whatnot, .np-wix { display: flex; flex-direction: column; gap: 1rem; }
.np-wix:has(input[name=wix_price_mode][value=recipe]:checked) .np-own-price { display: none; }
fieldset.np-where { margin: 0; padding: 1rem 0 0; border: 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
fieldset.np-where legend { float: left; padding: 0; font-weight: 600; font-size: 1.05rem; }
fieldset.np-where > label { clear: both; }
fieldset.np-where.field-error { box-shadow: inset 0 2px 0 var(--error); }
.np-shows { display: flex; flex-direction: column; gap: 0.5rem; }
fieldset.np-shows-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.np-shows-modes span { height: auto; min-height: 2.3rem; padding: 0.3rem 0.5rem; text-align: center; line-height: 1.25; font-size: 0.9rem; }
.np-shows-all, .np-show-list { display: none; }
.np-shows:has(input[name=shows_mode][value=all]:checked) .np-shows-all { display: block; }
.np-shows:has(input[name=shows_mode][value=pick]:checked) .np-show-list { display: flex; flex-direction: column; gap: 0.4rem; }
.panel label.np-show { align-items: flex-start; }
.np-whatnot:has(input[name=price_mode][value=recipe]:checked) .np-own-price { display: none; }
.np-stores:not(:has(input[name=store]:checked)) .np-actions-listed,
.np-stores:has(input[name=store]:checked) .np-actions-inventory,
.np-stores:has(input[name=store]:checked) .np-inventory-only { display: none; }
.np-actions { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.np-actions > div { display: flex; flex-direction: column; gap: 0.5rem; }
.np-actions button { width: 100%; }
.np-actions p { text-align: center; }
@media (max-width: 640px) {
  .np-kinds, .np-row-3, .np-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.item-actions { margin: 0.25rem 0 1rem; }

/* Line items in a confirmation and in New Product's listed popup. */
dl.confirm-items { margin: 0 0 1rem; display: flex; flex-direction: column; gap: 0.3rem; font-variant-numeric: tabular-nums; }
dl.confirm-items > div { display: flex; justify-content: space-between; gap: 1rem; }
dl.confirm-items dt { color: var(--muted); }
dl.confirm-items dd { margin: 0; text-align: right; }
.listing-dialog .review-head .icon-button { width: 2.25rem; height: 2.25rem; }
/* The picture is as tall as the details beside it. */
.listed-facts { display: flex; gap: 1rem; align-items: stretch; margin-bottom: 1rem; }
.listed-facts dl.confirm-items { flex: 1; margin: 0; }
.listed-picture { flex: none; width: 6rem; position: relative; }
.listed-picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.listed-stores { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.listed-store { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0; font-size: 1rem; }
.listed-picture img { object-position: top; }
.listing-dialog .review-head .icon-button { background: transparent; color: var(--muted); padding: 0; }
.listing-dialog .review-head .icon-button:hover { color: var(--accent); }

/* Options' New Wix Products: a row per kind, the profile beside its categories. */
.panel form.wix-kind-row + form.wix-kind-row { border-top: none; margin-top: -0.5rem; }
.wix-kind-row .auto-row-label { min-width: 7rem; }
.wix-categories { border: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }
.wix-categories legend { float: left; margin-right: 0.25rem; padding: 0; font-size: 0.9rem; color: var(--muted); }

/* Customers (pages/customers.ts). The search's dropdown reuses the buyer bundle builder's (.bundle-results). */
.customer-find { position: relative; width: min(26rem, 100%); }
/* A sale a link points to (a sold buyer bundle's), marked on Sales. */
.sales-table tr.sale-picked > td { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.sales-table tr.sale-picked > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* Actions that stay on the right when the heading and its description wrap them to their own line (Buyer Bundles). */
.page-head > .head-actions-end { margin-left: auto; }
/* The buyer under a buyer bundle's heading: one line, with its room kept while there's no buyer yet. */
.bundle-buyer-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; min-height: 2rem; margin: 0.25rem 0 0; }
/* Its message link: the customer page's icon at the size of the Accounts card's. */
.bundle-buyer-line > * + * { border-left: 1px solid var(--border); padding-left: 0.75rem; }
.bundle-buyer-line > span { display: inline-flex; align-items: center; height: 1.5rem; }
.bundle-buyer-line .badge { margin: 0 0 0 0.35rem; }
.bundle-buyer-line .icon-button { width: 2rem; height: 2rem; }
.bundle-buyer-line .icon-button svg { width: 1rem; height: 1rem; }
.page-head .head-actions:has(.customer-find) { flex: 1 1 20rem; justify-content: flex-end; }
.customer-find > .bundle-results { left: auto; width: max(100%, min(34rem, calc(100vw - 2rem))); }
.customer-find input[type=search] { width: 100%; }
.customer-find form { margin: 0; }
.merge-find { width: auto; display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.merge-find label { color: var(--muted); font-size: 0.9rem; }
.customer-results { max-height: 26rem; }
.customer-results-head { border-bottom: 1px solid var(--border); }
.bundle-results-list .customer-option { display: flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; }
.bundle-results-list .customer-option:focus-visible { outline: none; background: var(--badge-bg); }
.customer-option-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.customer-option-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-option-name { font-weight: 600; }
.customer-option-name .badge { margin: 0 0 0 0.25rem; font-weight: normal; }
.customer-option-facts { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-variant-numeric: tabular-nums; }
.customer-results mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; }
.customer-results-foot { display: block; margin: 0; padding: 0.55rem 0.75rem; border-top: 1px solid var(--border); text-align: left; }
.customer-results-foot .link-button { text-align: left; }
/* Regulars: 20 cards, of which whole rows show by the panel's width:
   10 in one or two columns, 15 in three, 20 in four or five. A column is
   added only when each card stays about 20rem, so a card's facts fit one line. */
/* Regulars and Leads on the Customers page: 3 whole rows of cards, as many columns as fit (CUSTOMER_CARDS is 5 columns' worth). */
.regulars { container-type: inline-size; }
.regulars > a:last-child { display: inline-block; margin-top: 0.75rem; }
.customer-cards { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.customer-cards > :nth-child(n+4) { display: none; }
@container (min-width: 42rem) { .customer-cards { grid-template-columns: repeat(2, 1fr); } .customer-cards > :nth-child(-n+6) { display: flex; } }
@container (min-width: 63rem) { .customer-cards { grid-template-columns: repeat(3, 1fr); } .customer-cards > :nth-child(-n+9) { display: flex; } }
@container (min-width: 84rem) { .customer-cards { grid-template-columns: repeat(4, 1fr); } .customer-cards > :nth-child(-n+12) { display: flex; } }
@container (min-width: 105rem) { .customer-cards { grid-template-columns: repeat(5, 1fr); } .customer-cards > :nth-child(-n+15) { display: flex; } }
.regular-sort a { white-space: nowrap; }
@media (max-width: 600px) {
  .regular-sort { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .regular-sort a { text-align: center; }
  .regular-sort a:nth-child(3) { border-left: 0; }
  .regular-sort a:nth-child(n+3) { border-top: 1px solid var(--border); }
}
.customer-card { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.customer-card:hover { border-color: var(--accent); text-decoration: none; }
.customer-card-head { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.customer-card-name { display: flex; flex-direction: column; min-width: 0; }
.customer-card-name > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-card-facts { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.customer-title { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
.customer-title .avatar { width: 3rem; height: 3rem; font-size: 1.05rem; }
.customer-title h1 { margin: 0; }
/* Lead: a customer who hasn't made a purchase yet (no orders but giveaways), beside their name. */
.customer-title h1 .customer-lead { margin: 0 0 0 0.35rem; vertical-align: 0.3em; font-weight: 600; }
.customer-handles { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin: 0.2rem 0 0; color: var(--muted); }
.customer-handles > span { display: inline-flex; align-items: center; gap: 0.35rem; }
.customer-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 1rem; align-items: start; margin-top: 1rem; }
.customer-layout .panel { margin-top: 0; }
.customer-main, .customer-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (max-width: 900px) { .customer-layout { grid-template-columns: minmax(0, 1fr); } }
.customer-breakdowns { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 0.5rem 1.5rem; margin-bottom: 1rem; }
.customer-breakdown h3, .customer-main h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.breakdown-row { display: grid; grid-template-columns: minmax(0, 8rem) 1fr auto; align-items: center; gap: 0.5rem; font-size: 0.9rem; padding: 0.1rem 0; }
.breakdown-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breakdown-bar { height: 0.45rem; border-radius: 999px; background: var(--badge-bg); overflow: hidden; }
.breakdown-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.month-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.3rem; height: 6rem; align-items: end; border-bottom: 1px solid var(--border); }
.month-bar { height: 100%; display: flex; align-items: flex-end; }
.month-bar > span { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--accent); }
.month-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.3rem; margin-top: 0.25rem; color: var(--muted); font-size: 0.75rem; text-align: center; }
.customer-accounts { display: flex; flex-direction: column; gap: 0.6rem; }
.customer-account { display: flex; align-items: center; gap: 0.6rem; }
.customer-account-text { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* A Whatnot account's link to the buyer's profile, small beside its name. */
.customer-account .account-link, .customer-notes .panel-head .icon-button { width: 2rem; height: 2rem; padding: 0; }
.customer-account .account-link svg, .customer-notes .panel-head .icon-button svg { width: 1rem; height: 1rem; }
/* Save Notes: off until the notes change (data-save-when-changed in app.js), then filled with the accent. */
.customer-notes .panel-head .notes-save, .customer-notes .panel-head .notes-save:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.customer-notes .panel-head .notes-save:disabled { background: var(--surface); color: var(--muted); border-color: var(--border); opacity: 0.5; cursor: default; }
.panel form.customer-notes { flex-direction: column; align-items: stretch; margin: 0; }
.customer-notes label { color: var(--text); }
.customer-notes h2 { margin: 0; }
@media (max-width: 600px) { .month-labels span:nth-child(even) { visibility: hidden; } }
.customer-notes textarea { width: 100%; box-sizing: border-box; font: inherit; }
/* The notes box is the page's background color with a light border until it's typed in, when it takes the panel's color and the accent outline. */
.customer-notes textarea { padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }
.customer-notes textarea:focus { background: var(--surface); border-color: var(--accent); outline: 1px solid var(--accent); }
dialog.merge-dialog { width: min(40rem, calc(100vw - 2rem)); max-width: none; overflow: visible; }
.merge-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.merge-side { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.merge-side li { display: flex; align-items: center; gap: 0.4rem; }
.merge-names { border: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.merge-names legend { padding: 0; margin-bottom: 0.3rem; color: var(--muted); font-size: 0.9rem; }

/* Interests (src/server/pages/interests.ts): the Add an Interest popup, with Or Browse beside the form on wide screens. */
dialog.interest-dialog { width: min(70rem, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 3rem); overflow: auto; padding: 0; }
.interest-form { display: flex; flex-wrap: wrap; margin: 0; }
.interest-form-main { flex: 999 1 34rem; min-width: 0; display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1.5rem; }
.interest-form-main > h2 { margin: 0; }
.interest-form-main > .interest-field { flex: none; }
.interest-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
form label.interest-field, .interest-field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1 1 9rem; min-width: 0; margin: 0; font-size: 0.85rem; color: var(--muted); }
.interest-row > .interest-customer, .interest-row > .customer-find { flex: 2 1 18rem; width: auto; }
.interest-label { font-size: 0.85rem; color: var(--muted); }
/* Every box in the popup is one height, so the picked customer, Asked During, Copies, and Up To line up. */
.interest-form { --interest-box: 2.5rem; }
.interest-field select, .interest-field input[type=text], .interest-field input[type=search], .interest-field input[type=number] { width: 100%; height: var(--interest-box); }
.interest-customer-card { display: flex; align-items: center; gap: 0.5rem; height: var(--interest-box); padding: 0 0.6rem 0 0.35rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.interest-customer-card .avatar { width: 1.75rem; height: 1.75rem; font-size: 0.75rem; }
.interest-customer-card .customer-option-text { flex: 1; flex-direction: row; align-items: baseline; gap: 0.5rem; overflow: hidden; white-space: nowrap; }
.interest-find { width: 100%; }
.interest-find .interest-chips { min-height: var(--interest-box); padding: 0.2rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.interest-find .interest-chips:focus-within { border-color: var(--accent); outline: 1px solid var(--accent); }
.interest-find .interest-chips input[type=search] { flex: 1 1 10rem; width: auto; height: auto; min-width: 8rem; border: 0; padding: 0.3rem 0.25rem; background: none; outline: none; }
.interest-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.interest-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--badge-bg); color: var(--text); font-size: 0.85rem; }
.interest-chip-remove { padding: 0 0.2rem; border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; }
.interest-chip-remove:hover { color: var(--text); background: none; }
.interest-suggestion-kind { flex: none; width: 6.5rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.interest-suggestion-name { flex: 1; min-width: 0; font-weight: 600; }
/* In Stock for a customer and Matched Interests: headers on one line and everything centered in its row; the interest
   pill centered in its column and kept whole; the buttons stack, one width, rather than squeeze the item. */
table.stock-table th { white-space: nowrap; vertical-align: middle; }
table.stock-table td { vertical-align: middle; }
table.stock-table td:first-child { min-width: 12rem; }
table.stock-table .stock-why { text-align: center; }
table.stock-table .stock-why .interest-chip { white-space: nowrap; }
.stock-actions { display: grid; justify-content: end; gap: 0.35rem; }
.stock-actions form { margin: 0; }
.stock-actions button { width: 100%; white-space: nowrap; }
/* A match they were told about: kept on the customer's page, muted (its other buttons are muted-button). */
table.stock-table tr.stock-told td, table.stock-table tr.stock-told a { color: var(--muted); }
table.stock-table tr.stock-told .interest-chip { background: none; border: 1px solid var(--border); color: var(--muted); }
/* Told Them pressed: filled with the accent, so it stands out on a muted row. */
button.told-toggle[aria-pressed=true] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
/* A card suggestion's picture, as tall as the row's text allows so the row keeps its height; hovering shows it larger (data-preview). */
.interest-suggestion { --suggestion-picture-height: 2rem; }
.interest-suggestion-picture { flex: none; display: flex; height: var(--suggestion-picture-height); aspect-ratio: 245 / 337; }
.interest-suggestion-picture img, .interest-suggestion-picture .no-image-art { width: 100%; height: 100%; object-fit: cover; border-radius: 2px; }
/* One line, a fixed height, empty until something's picked, so the popup doesn't grow or shrink as picks change what it
   says. A long summary is cut short with "…"; See Them in the Catalog stays whole beside it. */
.interest-preview { box-sizing: border-box; display: flex; align-items: center; gap: 0.75rem; height: 2.75rem; padding: 0 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.interest-preview p { flex: 1; min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.interest-preview > a { flex: none; white-space: nowrap; }
/* The Copies row is a grid of equal columns that stay put whichever copies are picked: Copies, their rules (Lowest
   Condition, or Grading Company and Lowest Grade sharing the column, or nothing for Sealed), Language, and Up To, a
   quarter each; a Master Set Goal has no Language, so a third each. Narrow, it's two columns. */
.interest-row.interest-copies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.interest-row.interest-copies.goal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.interest-rules-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; min-width: 0; }
/* Labels stay one line, so the row's height doesn't change with what's picked. */
.interest-copies .interest-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.interest-field-empty { visibility: hidden; }
@media (max-width: 640px) {
  .interest-row.interest-copies, .interest-row.interest-copies.goal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.interest-in-stock { color: var(--ok); }
.interest-browse { flex: 1 1 16rem; min-width: 0; padding: 1.25rem; border-left: 1px solid var(--border); background: var(--bg); border-radius: 0 10px 10px 0; }
.interest-browse h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.interest-browse-group { border-top: 1px solid var(--border); padding: 0.45rem 0; }
.interest-browse-group > summary { font-weight: 600; cursor: pointer; }
.interest-browse-group > summary .count { color: var(--muted); font-weight: normal; font-size: 0.8rem; }
.interest-browse-group .facet { margin-top: 0.4rem; }
/* Side by side (the popup is at least the two columns' 50rem wide, so they never wrap here), Or Browse is as tall as the
   form beside it and scrolls inside that, so opening a filter never makes the popup taller. Narrower, it goes under the form. */
@media (min-width: 52rem) {
  .interest-form { flex-wrap: nowrap; }
  .interest-browse { contain: size; overflow-y: auto; }
}
@media (max-width: 51.99rem) { .interest-browse { border-left: 0; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; } }
/* A customer's interests. */
.interest-list { display: flex; flex-direction: column; }
.interest-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.interest-item:first-child { border-top: 0; padding-top: 0; }
.interest-item-main { flex: 1 1 18rem; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.interest-item-stock { flex: none; text-align: right; }
.interest-item-actions { flex: none; display: flex; align-items: center; gap: 0.4rem; }
.interest-item-actions .icon-button { width: 2.1rem; height: 2.1rem; padding: 0; }
/* Master Set Goals (pages/interests.ts goalFields, pages/goals.ts). */
.interest-kind { align-self: flex-start; }
.interest-kind button { padding: 0.35rem 0.9rem; border: 0; border-radius: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.interest-kind button + button { border-left: 1px solid var(--border); }
.interest-kind button.active { background: var(--badge-bg); color: var(--text); font-weight: 600; }
.goal-grand { display: flex; align-items: center; gap: 0.5rem; }
.goal-grand label.check { margin: 0; color: var(--text); }
.help-terms { display: flex; flex-direction: column; gap: 0.7rem; }
.help-terms strong { display: block; margin-bottom: 0.15rem; }
.goal-cards { display: flex; flex-direction: column; gap: 0.6rem; }
.goal-cards h3 { margin: 0; font-size: 1rem; }
.goal-cards h3 .count { color: var(--muted); font-weight: normal; margin-left: 0.3rem; }
.goal-quick { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.goal-quick .count { color: var(--muted); margin-left: 0.25rem; }
.goal-quick button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.goal-quick button.active .count { color: inherit; }
.goal-cards-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.goal-ticks { display: flex; align-items: center; gap: 0.4rem; }
/* Select All acts on the cards, not on what's shown, so it looks unlike the quick filters: a soft fill, no border, a check. */
button.goal-select-all { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.7rem; font-size: 0.85rem; border: 0;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
button.goal-select-all:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
button.goal-select-all svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Pressed (every card shown is ticked): the active quick filter's look, and a checked box in place of the empty one. */
button.goal-select-all[aria-pressed=true] { background: var(--accent); color: var(--accent-text); }
/* One box for its state: empty (none ticked), a dash (some), or checked (all). */
button.goal-select-all .select-some, button.goal-select-all .select-on { display: none; }
button.goal-select-all[aria-pressed=mixed] .select-off, button.goal-select-all[aria-pressed=true] .select-off { display: none; }
button.goal-select-all[aria-pressed=mixed] .select-some, button.goal-select-all[aria-pressed=true] .select-on { display: inline; }
.goal-cards input[type=search] { width: 100%; height: var(--interest-box); }
/* Cards shrink to their column (min-width: 0), so a long name or printing is cut short rather than scrolling sideways.
   The box is a fixed height, so the search and quick filters change what's in it, never the popup's size. */
/* Set off like the preview box below it: a light border, its background, and a little room inside so cards don't touch the edge. */
.goal-picker { box-sizing: border-box; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); align-content: start; gap: 0.4rem; height: 22rem; overflow-y: auto; overflow-x: hidden;
  padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.goal-pick { min-width: 0; display: flex; flex-direction: row; gap: 0.5rem; align-items: flex-start; margin: 0; padding: 0.45rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 0.9rem; cursor: pointer; }
.goal-pick[hidden] { display: none; }
.goal-pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.goal-pick input { margin-top: 0.2rem; }
.goal-pick-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.goal-pick-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-pick-text .badge { margin: 0.2rem 0 0; align-self: flex-start; }
.interest-goal-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.interest-goal-name .badge { margin: 0; }
.goal-head .goal-facts { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0 0; }
.goal-head .goal-facts .badge { margin: 0; }
.goal-head .row-menu summary { padding: 0.4rem 0.8rem; }
.goal-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem; border-bottom: 1px solid var(--border); margin: 1rem 0; }
.goal-bar .tabs { border-bottom: 0; margin: 0; }
.goal-bar .view-toggle { margin-bottom: 0.4rem; }
.goal-bar .view-toggle a { padding: 0.3rem 0.75rem; font-size: 0.85rem; color: var(--text); background: var(--surface); text-decoration: none; }
.goal-bar .view-toggle a + a { border-left: 1px solid var(--border); }
.goal-bar .view-toggle a.active { background: var(--accent); color: var(--accent-text); }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.goal-tile { min-width: 0; display: flex; gap: 0.75rem; padding: 0.6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.goal-tile.goal-stock { border-color: var(--ok); }
.goal-tile-image { flex: none; width: 4rem; }
.goal-tile-image img, .goal-tile-image .no-image-art { display: block; width: 100%; border-radius: 4px; }
.goal-tile.goal-have .goal-tile-image { opacity: 0.55; }
.goal-tile-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; align-items: flex-start; }
.goal-tile-text > a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-tile-text .badge { margin: 0.15rem 0; }
table.goal-list td.thumb { width: 44px; padding: 0.25rem 0.5rem; }
table.goal-list td.thumb img, table.goal-list td.thumb .no-image-art { width: 36px; display: block; border-radius: 3px; }
table.goal-list td { vertical-align: middle; }
.goal-maybes { margin-top: 1.5rem; }
/* A customer's Orders section: its page size beside the heading. */
#purchases .panel-head form.head-actions { margin: 0; }
/* An artist's page (pages/artists.ts): the customers interested in them and who buys their cards. */
.artist-people li { display: flex; flex-direction: column; padding: 0.45rem 0; border-top: 1px solid var(--border); }
.artist-people li:first-child { border-top: 0; }
.artist-people li.artist-buyer { flex-direction: row; justify-content: space-between; gap: 0.5rem; }

/* Record a Sale's Customer: the search, or who's picked. */
.sale-customer-pick { width: 100%; margin-bottom: 0.75rem; }
.sale-customer-pick .interest-customer-card { height: 2.4rem; }
.sale-customer-pick .interest-customer-card[hidden] { display: none; }
/* Matches pinned to the window (data-pinned-results in app.js), so they float over a popup without being cut off at its edge. */
.bundle-results[data-pinned-results] { position: fixed; right: auto; }
/* It scrolls on its own: reaching its end doesn't scroll the popup behind it. */
.bundle-results[data-pinned-results] .bundle-results-list { overscroll-behavior: contain; }
.bundle-results[data-pinned-results]:not([style*="top"]) { visibility: hidden; }
/* Sales: an in-person sale's customer, with the pencil that changes it. */
.sale-customer-for { margin: -0.5rem 0 1rem; }
.sale-customer { display: inline-flex; align-items: center; gap: 0.4rem; }
/* A sale's item takes the room the other columns leave (at least 12rem; a narrower window scrolls the table in its box), on one line: a name too long for it ends in an ellipsis, with the whole name as its tooltip (itemName in sales.ts). */
.sales-table td { white-space: nowrap; }
/* A status's notes (cancelled from CableClub, copy out) wrap in a column of their own width, so the action column still fits. */
.sales-table td > div.small { white-space: normal; min-width: 7.5rem; max-width: 9.5rem; }
.sales-table td > button.small, .sales-table td > form > button.small { min-height: 0; padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.cancel-order-form fieldset.cancel-reasons { border: 0; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.35rem; }
.cancel-order-form legend { font-weight: 600; font-size: 0.85rem; color: var(--muted); padding: 0; margin-bottom: 0.25rem; }
.cancel-steps { margin: 0 0 0.75rem; padding-left: 1.25rem; display: grid; gap: 0.2rem; }
.sales-table td > form { margin: 0; }
.sale-item { width: 100%; max-width: 0; min-width: 12rem; }
.sale-item-line { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.sale-item-line > * { flex: none; }
.sale-item-line > .sale-item-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-item-line .condition-tag { margin-left: 0; }
.sale-item-line .icon-button { width: 1.75rem; height: 1.75rem; padding: 0; background: transparent; border-color: transparent; }
.sale-item-line .icon-button svg { width: 0.95rem; height: 0.95rem; }
.sale-item-line .share-toggle { margin-left: 0; }
.sale-customer .icon-button { width: 1.75rem; height: 1.75rem; padding: 0; background: transparent; border-color: transparent; }
.sale-customer .icon-button svg { width: 0.95rem; height: 0.95rem; }
.interest-item-actions .small-button { height: 2.1rem; }
.customer-card .interest-chips { margin-top: 0.1rem; }
.suggested-interests li { display: flex; align-items: center; gap: 0.75rem; padding: 0.35rem 0; }
.suggested-interests li > span:first-child { flex: 1; }

/* Changed on Whatnot in a push review (connections.ts changedCard): a card per listing, each change on a line, and Use Whatnot's or Send CableClub's beside it. */
.changed-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.changed-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; }
.changed-what { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; flex: 1 1 26rem; }
.changed-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.changed-actions button { min-height: 0; padding: 0.3rem 0.75rem; font-size: 0.85rem; }
/* What the store's listing gets (edit-details.ts storeGets), under its name, gone with its options when it's unchecked. */
.np-store-gets { margin: 0; padding: 0 0.75rem 0.65rem; background: var(--bg); line-height: 1.4; }
.np-store:not(:has([data-np-store]:checked)) .np-store-gets { display: none; }
/* A store sale's Cancel Order, shipping, or Put Back at the end of its history line (copies.ts saleAction). */
ul.history li > .history-action { margin-left: auto; flex: none; }
ul.history li > form.history-action { margin-bottom: 0; }
/* Inventory's Listing Titles (listing-titles.ts): a title to look at, as a card; Ready and Kept as a table. */
.title-reviews { display: flex; flex-direction: column; gap: 0.75rem; }
.title-reviews .panel + .panel, td > .title-review { margin: 0; }
.panel form.title-review-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; margin: 0; }
.title-review-text { flex: 1 1 26rem; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.title-review-text input { width: 100%; }
.title-review-text p { margin: 0; }
.title-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
.title-review-side { flex: none; margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.title-review-buttons { display: flex; gap: 0.4rem; }
.title-extra { color: var(--accent); font-weight: 600; }
.title-table td.title-actions { white-space: nowrap; text-align: right; }
.title-table td.title-actions form { margin: 0; }
.button.small-button { font-size: 0.8rem; padding: 0.15rem 0.5rem; border: 1px solid var(--accent); }
