:root {
  --bg: #faf8f5;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #e4572e;
  --accent-dark: #c94a24;
  --line: #e8e4de;
  --ok: #2e7d32;
  --err: #c62828;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 20px;
  max-width: 860px;
  margin: 0 auto;
}
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.logo::first-letter { color: var(--accent); }
.tagline { color: var(--muted); font-size: 0.85rem; }

main { max-width: 860px; margin: 0 auto; padding: 0 20px 120px; }

.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 1.9rem; line-height: 1.15; letter-spacing: -0.02em; max-width: 22ch; }
.hero p { color: var(--muted); margin-top: 10px; max-width: 46ch; }
.brand-logo {
  display: block;
  max-height: 80px;
  max-width: 240px;
  margin: 0 auto 18px;
  object-fit: contain;
}
.brand-logo[hidden] { display: none; }

/* Friend feedback (Alex 2026-08-28): curator logo upload in the builder.
   Lives above the numbered steps so it's prominent but doesn't compete
   with the actual curation flow. */
.brand-section {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.brand-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 10px;
}
.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.logo-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.logo-preview img {
  max-height: 36px;
  max-width: 120px;
  object-fit: contain;
}
.logo-preview[hidden] { display: none; }

.step { margin-top: 32px; }
.step h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.stepnum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 0.8rem; font-weight: 700;
  flex: none;
}
.opt { color: var(--muted); font-weight: 400; font-size: 0.9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 8px 14px; font-size: 0.9rem;
  cursor: pointer; transition: all 0.15s; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Friend feedback (Alex 2026-08-29): "search your own category" — a free-text
   input alongside the predefined chips. Submitted text becomes a custom
   category whose label is the typed text and whose UCP query is the same
   text (handled by the worker via a `custom:<text>` prefix). */
.custom-cat-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.custom-cat-row input {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--ink);
}
.custom-cat-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.chip.custom {
  background: var(--bg);
  border-style: dashed;
}
.chip.custom:hover {
  border-color: var(--err);
  color: var(--err);
}
.chip-x {
  display: inline-block;
  margin-left: 6px;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}

.regions-chips { margin-top: 10px; }
.regions-chips .chip { padding: 7px 12px; font-size: 0.85rem; }

.aud-sub { margin-top: 16px; }
.aud-label {
  display: block; font-size: 0.85rem; color: var(--muted);
  margin-bottom: 6px; font-weight: 500;
}
.price-row {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.price-row .curr { color: var(--muted); font-weight: 600; }
.price-row input {
  width: 90px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.95rem; background: var(--card); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.price-row input:focus {
  outline: none; border-color: var(--accent);
}
.price-row .dash { color: var(--muted); }

/* Friend feedback (Alex 2026-09-05): display-currency dropdown in the
   audience step. Sits below the price-range row; lets the curator pick
   what currency the audience sees. */
.ccy-select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  min-width: 220px;
}
.ccy-select:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-link {
  border: none; background: none; color: var(--muted);
  font-size: 0.85rem; cursor: pointer; padding: 6px 8px;
  text-decoration: underline;
}
.btn-link:hover { color: var(--accent); }

.status { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.status:not([hidden]) { display: block; }
.status.err { color: var(--err); }

.vis-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.vis-row input[type="url"] {
  flex: 1; min-width: 200px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 0.9rem;
  background: var(--card); color: var(--ink);
}
.or { color: var(--muted); font-size: 0.85rem; }

.previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.previews img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
}

.vis-status { margin-top: 10px; font-size: 0.9rem; padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.vis-status:not([hidden]) { display: block; }
.vis-status.ok { color: var(--ok); }
.vis-status.err { color: var(--err); }

.btn {
  border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

#step-find { margin-top: 36px; }

/* Friend feedback (Alex 2026-09-05): "Import by URL / ID" sub-section
   inside step-find. Pasted URLs/IDs get resolved server-side and the
   resolved products land in state.edit without going through the
   category-driven catalog search. */
.import-sub {
  margin-top: 22px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.import-sub .sub-h {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink);
}
.import-sub textarea {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
  min-height: 76px;
  line-height: 1.4;
}
.import-sub textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.import-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.import-row .status {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; }
.grid:not([hidden]) { display: grid; }
.empty { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 40px 0; }

.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.cardimg { aspect-ratio: 1; background: #f0ede8; }
.cardimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; }
.cardbody { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cardtitle { font-size: 0.92rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cardseller { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cardrow { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; margin-top: auto; gap: 8px; }
.cardprice { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.btn-add { padding: 7px 12px; font-size: 0.85rem; border-radius: 8px; }
.btn-add.added { background: var(--ok); color: #fff; }

/* Friend feedback (Alex 2026-08-28): share cards need explicit View + Buy
   buttons so the buyer chooses PDP vs checkout, instead of always landing
   in cart on click. */
.card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.btn-view, .btn-buy {
  padding: 7px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.btn-view {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-view:hover:not(.disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-buy {
  background: var(--accent);
  color: #fff;
}
.btn-buy:hover:not(.disabled) {
  background: var(--accent-dark);
}
.btn-view.disabled, .btn-buy.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.cardoos {
  font-size: 0.8rem;
  color: var(--err);
  font-weight: 600;
  margin-top: 4px;
}

.editbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; gap: 12px; z-index: 50;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}
.editcount { font-weight: 600; font-size: 0.95rem; }

.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card); border-radius: 18px; padding: 28px;
  max-width: 480px; width: 100%; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.modal-card h3 { font-size: 1.3rem; margin-bottom: 6px; }
.modal-card p { color: var(--muted); font-size: 0.9rem; }
.urlline { display: flex; gap: 8px; margin: 14px 0; }
.urlline input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 0.85rem; background: var(--bg); color: var(--ink);
}
.filtersummary {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--ink);
  border: 1px solid var(--line);
}
.filtersummary:not([hidden]) { display: block; }
#close-btn { margin-top: 18px; width: 100%; justify-content: center; }

.filterbadge {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink);
}
.filterbadge[hidden] { display: none; }

.emptyfiltered {
  margin-top: 28px;
  padding: 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.emptyfiltered p { color: var(--ink); font-size: 0.95rem; }
.emptyfiltered .hint { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
/* Friend feedback (Alex 2026-09-05 outage): the `.filterbadge`,
   `#grid`, and `#empty-filtered` rules above all set `display: ...`
   unconditionally, which overrides the browser default
   `[hidden] { display: none }` (same specificity, author rule wins).
   When JS crashed (the sp.get ReferenceError), the static HTML's
   hidden=true elements leaked through as empty pills / a blank grid
   area. Re-assert `display: none` for the hidden case so a JS crash
   doesn't leave visual debris on the page. */
.filterbadge[hidden],
.grid[hidden],
.emptyfiltered[hidden] { display: none; }

/* Friend feedback (Alex 2026-08-28): "Load more" pagination sits below
   the results grid, full-width-ish, centered. Hidden until the server
   signals more pages exist. */
.loadmore-row {
  max-width: 860px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.loadmore-row[hidden] { display: none; }
.loadmore-row .status { text-align: center; }

@media (max-width: 560px) {
  .hero h1 { font-size: 1.6rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .price-row input { width: 80px; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Friend feedback (Alex 2026-09-06): on-page controls for the share
   page (price filter UI, currency display, layout template, edit mode
   + add/remove/reorder). All classes prefixed so the share-page chrome
   doesn't collide with builder page rules (#catalog, #edit, etc.).
   ───────────────────────────────────────────────────────────────────────── */

/* Hero controls — wraps the price filter, currency pill, layout toggle
   and edit button. Flex-wrap so they stack on narrow screens. */
.hero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  margin-top: 18px;
  font-size: 0.9rem;
}
.hf-label {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-controls > div { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.edit-controls { margin-left: auto; }

/* Price sort — two pill toggles (↑ low→high / ↓ high→low). Friend feedback
   (Alex 2026-09-06): the original price-filter UI was min/max range; the
   real ask was simple ascending/descending sort. */
.price-sort { display: inline-flex; gap: 4px; align-items: center; }
.sort-pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s;
}
.sort-pill:hover { border-color: var(--accent); color: var(--accent); }
.sort-pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Compact button used inside the hero */
.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
  font-weight: 600;
}
.btn.btn-small { gap: 4px; }

/* Currency pill — "Showing in GBP · Change" */
.ccy-pill {
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
}
.ccy-pill #ccy-text { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Layout template toggle (3 / 4 / 5 wide) */
.tpl-toggle { gap: 4px; }
.tpl-pill {
  width: 32px; height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s;
  padding: 0;
}
.tpl-pill:hover { border-color: var(--accent); color: var(--accent); }
.tpl-pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Grid templates — explicit column counts for the 3/4/5 wide layouts.
   Same selector specificity as `.grid` (.grid--tpl-3col = .grid = 0,1,0)
   but later in the file, so when both apply, ours wins. */
.grid--tpl-3col {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}
.grid--tpl-4col {
  display: grid;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  gap: 14px;
}
.grid--tpl-5col {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
}
/* Mid screens: 5-col collapses to 3, 4-col collapses to 2 */
@media (max-width: 760px) {
  .grid--tpl-4col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--tpl-5col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Small screens: all templates collapse to 2 */
@media (max-width: 560px) {
  .grid--tpl-3col,
  .grid--tpl-4col,
  .grid--tpl-5col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* ─── Edit mode chrome ──────────────────────────────────────────────────── */

/* Card edit-mode adds an X button overlay + cursor:grab for drag-drop. */
.card.editing { position: relative; cursor: grab; }
.card.editing:active { cursor: grabbing; }
.card.editing.dragging { opacity: 0.4; }
.card.editing.drag-over { outline: 2px dashed var(--accent); outline-offset: -3px; }
.card-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  z-index: 3;
  transition: background 0.15s;
}
.card-remove:hover { background: var(--err); }
.drag-handle-hint {
  position: absolute;
  bottom: 8px; right: 8px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 3;
}

/* Edit bar — fixed bottom, dark, hidden by default */
.edit-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  z-index: 50;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}
.edit-bar[hidden] { display: none; }
.edit-bar-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.edit-bar-label { font-weight: 600; font-size: 0.95rem; }
.edit-bar-sub { color: rgba(255,255,255,0.6); font-weight: 400; font-size: 0.85rem; margin-left: 2px; }
.edit-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edit-bar .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}
.edit-bar .btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.edit-bar .btn-ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
}
.edit-bar .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* Edit toggle button — keep active state visible */
#edit-toggle.on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Modals ────────────────────────────────────────────────────────────── */

.modal-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

/* Add-product modal */
.add-modal-card { max-width: 580px; }
.add-search-row {
  display: flex;
  gap: 8px;
  margin: 14px 0 10px;
}
.add-search-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--ink);
}
.add-search-row input:focus { outline: none; border-color: var(--accent); }
.add-results {
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.add-result {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  align-items: center;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s;
}
.add-result:hover { border-color: var(--accent); }
.add-result.added { opacity: 0.5; cursor: not-allowed; }
.add-result img {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
  background: var(--line);
}
.add-result-body { flex: 1; min-width: 0; }
.add-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.add-result-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}
.add-result-tag {
  flex: none;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
}
.add-result.added .add-result-tag { background: var(--muted); }

/* Currency modal */
.ccy-modal-card { max-width: 360px; }
.ccy-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0 0;
}
.ccy-option {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  transition: all 0.15s;
}
.ccy-option:hover { border-color: var(--accent); color: var(--accent); }
.ccy-option.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Copy-link modal */
.copy-modal-card { max-width: 480px; }
.copylink-row {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
}
.copylink-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg);
  color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────────────────
   Friend feedback (Alex 2026-09-06, after testing v1 of the share page):
   the page frame (main + topbar + edit-bar-inner) didn't breathe with the
   3/4/5-col template choice — 5 cols squeezed cards into an 860px frame,
   3 cols left the same frame wider than needed. Fix: drive max-width via
   a CSS variable that's set by body:has(.grid--tpl-*). Supported in all
   evergreen browsers (Chrome 105+, Firefox 121+, Safari 15.4+, Dec 2022+).
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Default for the responsive (no-template) case. */
  --frame-max: 920px;
}
/* Widens the frame when the user picks a wider template, narrows it back
   when they pick a narrower one. `:has()` matches the grid container
   class that share.js toggles based on the active layout pill. */
body:has(.grid--tpl-3col) { --frame-max: 920px; }
body:has(.grid--tpl-4col) { --frame-max: 1200px; }
body:has(.grid--tpl-5col) { --frame-max: 1480px; }

/* Apply the variable to the three max-width: 860px rules already in the
   file. Same selector specificity as the original rules but later in
   source = wins. transition gives a subtle width animation when switching
   templates (don't trigger transition on initial load — small ergonomic
   win on page open with a saved template pref). */
.topbar,
main,
.edit-bar-inner {
  max-width: var(--frame-max);
  transition: max-width 0.25s ease-out;
}

/* On narrow viewports, the templates already collapse to 2-col, so the
   frame doesn't need to grow wide. Cap at 720px for tablet width and
   let mobile fall through to the natural width. */
@media (max-width: 760px) {
  body:has(.grid--tpl-3col),
  body:has(.grid--tpl-4col),
  body:has(.grid--tpl-5col) { --frame-max: 720px; }
}
@media (max-width: 560px) {
  :root { --frame-max: 100%; }
  body:has(.grid--tpl-3col),
  body:has(.grid--tpl-4col),
  body:has(.grid--tpl-5col) { --frame-max: 100%; }
}

/* Google sign-in: account widget in the top bar (both pages) and the
   signed-in curator's "Your edits" list on the builder. */
.account {
  margin-left: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.9rem;
}
.account[hidden] { display: none; }
.account-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.account-name {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-signin { text-decoration: none; white-space: nowrap; }
.account-who {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  border: none; background: none; padding: 0;
  font: inherit; color: var(--ink); cursor: pointer;
}
.account-who:hover .account-name { color: var(--accent); }
.account .btn-link { padding: 6px 0; }
@media (max-width: 480px) {
  .tagline, .account-name { display: none; }
}

.edit-controls[hidden] { display: none; }

.my-edits { margin-top: 20px; }
.my-edits[hidden] { display: none; }
.my-edits .sub-h { font-size: 1.05rem; }
.my-edits-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.my-edits-list:empty { display: none; }
.my-edit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.my-edit:hover { border-color: var(--accent); }
.my-edit img, .my-edit .noimg {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg);
  margin-bottom: 6px;
}
.my-edit-title {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.my-edit-meta { color: var(--muted); font-size: 0.8rem; }

/* Sign-in + profile modals (built by account.js) */
.account-modal { max-width: 420px; display: flex; flex-direction: column; gap: 10px; }
.account-modal h3 { margin-bottom: 0; }
.account-modal .modal-actions { margin-top: 8px; }
.account-modal .modal-actions .btn { flex: 1; justify-content: center; }
.google-btn { justify-content: center; text-decoration: none; margin-top: 6px; }
.google-btn svg { background: #fff; border-radius: 50%; padding: 2px; width: 20px; height: 20px; }
.modal-card .modal-note { font-size: 0.8rem; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.form-row label { font-size: 0.85rem; font-weight: 600; }
.form-row input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 0.95rem; background: var(--bg); color: var(--ink);
}
.form-row input:focus { outline: none; border-color: var(--accent); }
.ig-row { display: flex; align-items: center; gap: 6px; }
.ig-prefix { color: var(--muted); font-weight: 600; }

/* "Curated by …" credit on the share page */
.curator { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.curator[hidden] { display: none; }
.curator a { color: var(--ink); font-weight: 600; text-decoration: none; }
.curator a:hover { color: var(--accent); }
