:root {
  --accent: #1f8a4c;
  --bg: #f7f2e6;
  --wall: #fbf8f0;
  --ink: #23201b;
  --muted: #7a7368;
  --line: #e4dccb;
  --ledge: #cfe6d5;
  --ledge-edge: #b2d3bb;
  --card: #ffffff;
  --radius: 14px;
  --editor-w: 400px;
  color-scheme: light;
}
body[data-type='books'] { --bg: #f4ede2; --wall: #f8f2e8; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 Figtree, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: flex; align-items: center; gap: 14px;
  max-width: 1320px; margin: 0 auto; padding: 10px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--accent); min-width: 0; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: var(--accent);
  -webkit-mask: radial-gradient(circle at 50% 120%, transparent 38%, #000 39%);
          mask: radial-gradient(circle at 50% 120%, transparent 38%, #000 39%);
}
.brand-name { font: 600 22px/1 Fraunces, Georgia, serif; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  max-width: 460px; margin-left: 12px;
  background: #f3f0e8; border-radius: 999px; padding: 8px 14px; color: var(--muted);
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input { border: 0; background: none; outline: none; width: 100%; color: var(--ink); }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.cart-pill {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 7px 8px 7px 14px;
  background: var(--accent); color: #fff; font-weight: 700;
}
.cart-pill-label { font-size: 12px; font-weight: 600; opacity: 0.85; }
.cart-pill-count { background: #fff; color: var(--accent); border-radius: 999px; min-width: 24px; height: 24px; display: grid; place-items: center; font-size: 12px; padding: 0 6px; }
.cart-pill.bump { animation: bump 0.4s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.manage-btn {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600;
}
.manage-btn svg { width: 16px; height: 16px; }
.share-btn { border-color: var(--accent); color: var(--accent); }
.manage-btn { white-space: nowrap; }
/* With the manager open the header is narrow: keep both buttons as icons. */
@media (max-width: 1400px) {
  body.editing .manage-btn span { display: none; }
  body.editing .manage-btn { padding: 8px 10px; }
}
.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.manage-btn[aria-expanded='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- store ---------- */
.store { max-width: 1320px; margin: 0 auto; padding: 8px 20px 40px; transition: margin 0.25s ease; }
.tagline { margin: 6px 0 4px; color: var(--muted); font-size: 14px; }

.shelf { padding: 18px 0 6px; }
.shelf-head { display: flex; align-items: baseline; gap: 10px; padding: 0 2px 4px; }
.shelf-head h2 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.shelf-head .count { font-size: 12px; color: var(--muted); }
.shelf-head .nav { margin-left: auto; display: flex; gap: 6px; }
.shelf-head .nav button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 18px; line-height: 1;
}
.shelf-empty { color: var(--muted); padding: 30px 4px; margin: 0; }

/* The track scrolls sideways; the ledge is its background, attached to the
   scrolled content so it runs under every product. */
.track {
  --art-h: 150px;
  display: flex; gap: 0;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  padding: 14px 0 6px;
  background:
    linear-gradient(var(--ledge-edge), var(--ledge-edge)) 0 calc(14px + var(--art-h) + 14px) / 100% 3px no-repeat local,
    linear-gradient(var(--ledge), var(--ledge)) 0 calc(14px + var(--art-h)) / 100% 14px no-repeat local;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }

.item {
  position: relative; flex: none; width: 170px;
  display: flex; flex-direction: column; align-items: center;
  scroll-snap-align: start;
}
.item .art {
  width: 100%; height: var(--art-h, 150px);
  border: 0; background: none; padding: 0 14px;
  display: flex; align-items: flex-end; justify-content: center;
}
.art-svg, .art-img {
  max-width: 100%; max-height: 100%; display: block;
  filter: drop-shadow(0 6px 5px rgba(40, 30, 10, 0.18));
  transition: transform 0.2s ease;
}
.art-svg { height: 100%; width: auto; }
.art-img { object-fit: contain; object-position: bottom; }
.item .art:hover .art-svg, .item .art:hover .art-img { transform: translateY(-4px) scale(1.03); }
.item .art:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }

.qty { position: absolute; top: calc(var(--art-h, 150px) - 22px); right: 18px; z-index: 2; }
.add {
  width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: #fff; color: var(--ink); font-size: 20px; font-weight: 600; line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.add:hover { background: var(--accent); color: #fff; }
.stepper {
  display: flex; align-items: center; height: 30px; border-radius: 999px;
  background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); overflow: hidden;
}
.stepper button { width: 28px; height: 30px; border: 0; background: none; font-size: 17px; font-weight: 700; }
.stepper button:hover { background: #f0ece2; }
.stepper span { min-width: 18px; text-align: center; font-weight: 800; font-size: 13px; }

.tag { margin-top: 20px; text-align: center; padding: 0 8px; }
.price { display: block; font-weight: 800; font-size: 15px; }
.nm { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

/* Fridge: a glass door with a chrome frame */
.layout-fridge .shelf-body {
  border-radius: 18px; padding: 10px;
  background: linear-gradient(180deg, #dfe6ea, #c9d2d8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 6px 18px rgba(30, 50, 70, 0.12);
  position: relative;
}
.layout-fridge .shelf-body::after {
  content: ''; position: absolute; right: 18px; top: 30%; width: 8px; height: 40%;
  border-radius: 6px; background: linear-gradient(90deg, #f4f6f7, #a8b3ba); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.layout-fridge .track {
  border-radius: 10px;
  --ledge: #e9eef1; --ledge-edge: #b6c2ca;
  background-color: #eaf3f7;
  background-image:
    linear-gradient(var(--ledge-edge), var(--ledge-edge)),
    linear-gradient(var(--ledge), var(--ledge)),
    linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.45) 45%, rgba(255, 255, 255, 0) 60%);
  background-size: 100% 3px, 100% 14px, 100% 100%;
  background-position: 0 calc(14px + var(--art-h) + 14px), 0 calc(14px + var(--art-h)), 0 0;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll;
  padding-right: 34px;
}
.layout-fridge .tag { background: #fff; border-radius: 6px; padding: 2px 10px; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06); }

/* Bookcase, covers out */
.layout-covers .track, .layout-spines .track {
  --ledge: #b07a4a; --ledge-edge: #7c4f2b;
  background-color: #6b4428;
  background-image:
    linear-gradient(var(--ledge-edge), var(--ledge-edge)),
    linear-gradient(var(--ledge), var(--ledge)),
    linear-gradient(180deg, #4e2f1a, #5c3920 70%, #6b4428);
  background-size: 100% 6px, 100% 14px, 100% 100%;
  background-position: 0 calc(14px + var(--art-h) + 14px), 0 calc(14px + var(--art-h)), 0 0;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll;
  border-radius: 10px; border: 10px solid #7c4f2b; border-bottom-width: 0;
}
.layout-covers .track { --art-h: 170px; padding-bottom: 12px; }
.layout-covers .tag { color: #fdf3e6; }
.layout-covers .nm { color: #e9d4bb; }
.layout-covers .item { width: 150px; }

/* Bookcase, spines out */
.layout-spines .track {
  --art-h: 186px;
  align-items: flex-end; gap: 2px;
  height: calc(14px + 186px + 14px + 6px);
  padding: 14px 16px 20px;
}
.spine {
  position: relative; flex: none;
  width: var(--w); height: var(--h);
  border: 0; border-radius: 3px 3px 1px 1px; padding: 8px 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0.12) 18%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.2)),
    var(--c);
  color: var(--a);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  writing-mode: vertical-rl; transform-origin: bottom center;
  transition: transform 0.2s ease;
  box-shadow: inset 0 6px 0 -3px rgba(255, 255, 255, 0.25), inset 0 -10px 0 -6px rgba(0, 0, 0, 0.25);
}
.spine:hover, .spine:focus-visible { transform: translateY(-14px); outline: none; }
.spine-title { font: 600 13px/1.1 Fraunces, Georgia, serif; overflow: hidden; max-height: 76%; text-overflow: ellipsis; white-space: nowrap; }
.spine-author { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.85; white-space: nowrap; }
.spine-badge {
  writing-mode: horizontal-tb; position: absolute; top: -10px; right: -8px;
  background: var(--accent); color: #fff; font: 800 11px/20px Figtree, sans-serif;
  min-width: 20px; height: 20px; border-radius: 10px; text-align: center; padding: 0 5px;
}

/* End-cap: one hero product and a few around it */
.endcap-grid {
  display: grid; gap: 4px 0;
  grid-template-columns: 1.6fr repeat(2, 1fr);
  background: linear-gradient(180deg, #fff6df, #fbe9c4);
  border: 2px solid #f0d28b; border-radius: 18px; padding: 16px 10px 10px;
}
.endcap-grid .item { width: auto; --art-h: 120px; }
.endcap-grid .item.hero { grid-row: span 2; --art-h: 280px; justify-content: center; }
.endcap-grid .item.hero .price { font-size: 22px; }
.endcap-grid .item .tag { margin-top: 8px; }
.endcap-grid .item::before {
  content: ''; position: absolute; left: 10px; right: 10px; top: var(--art-h); height: 10px;
  background: #f0d28b; border-radius: 3px;
}
.endcap-grid .item.hero::after {
  content: 'Deal'; position: absolute; left: 14px; top: 0;
  background: #d8462b; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
body[data-type='books'] .endcap-grid .item.hero::after { content: 'Staff pick'; background: var(--accent); }

/* Simple grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 10px; }
.grid .item { width: auto; background: #fff; border-radius: var(--radius); padding: 14px 0 12px; border: 1px solid var(--line); --art-h: 140px; }
.grid .item .qty { top: calc(14px + 140px - 22px); }
.grid .item .tag { margin-top: 10px; }

.empty-search { text-align: center; color: var(--muted); padding: 40px 0; }
.foot { margin-top: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.foot a { color: inherit; }

/* Flying product */
.ghost { position: fixed; z-index: 80; pointer-events: none; }
.ghost svg, .ghost img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.25)); }

/* ---------- cart drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 16, 10, 0.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(420px, 100vw); background: #fff;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.25s ease;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
}
.drawer.open { transform: none; }
.drawer-head, .editor-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2, .editor-head h2 { margin: 0; font: 600 20px/1.2 Fraunces, Georgia, serif; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 18px; }
.drawer-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.cart-empty { text-align: center; padding: 60px 0; }
.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f1ece2; }
.line-art { width: 56px; height: 64px; display: flex; align-items: flex-end; justify-content: center; }
.line-art svg, .line-art img { max-height: 100%; max-width: 100%; }
.line-name { margin: 0; font-weight: 700; }
.line-info p { margin: 0 0 6px; font-size: 13px; }
.line-info .qty { position: static; display: inline-block; }
.line-total { margin: 0; font-weight: 800; }
.free-note { margin: 0 0 10px; font-size: 13px; color: var(--accent); font-weight: 600; }
.sum { display: flex; justify-content: space-between; padding: 3px 0; }
.sum.total { font-weight: 800; font-size: 17px; padding: 8px 0 12px; }

/* ---------- buttons & forms ---------- */
.primary, .secondary {
  border-radius: 999px; padding: 11px 20px; font-weight: 700; border: 1px solid transparent;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { filter: brightness(1.08); }
.secondary { background: #fff; border-color: var(--line); }
.secondary:hover { border-color: var(--ink); }
.wide { width: 100%; }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; }
.link.danger { color: #c0392b; }
.icon-btn { border: 0; background: #f3f0e8; width: 34px; height: 34px; border-radius: 50%; font-size: 14px; flex: none; }
.icon-btn.sm { width: 28px; height: 28px; font-size: 13px; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: #4a443b; margin-bottom: 12px; }
input:not([type='range']):not([type='file']):not([type='color']), select, textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; font-weight: 500; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type='color'] { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #fff; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-err { color: #c0392b; font-weight: 600; margin: 0 0 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }

/* ---------- modal ---------- */
.modal { border: 0; border-radius: 20px; padding: 0; width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
.modal::backdrop { background: rgba(20, 16, 10, 0.45); }
.modal-x { position: absolute; top: 14px; right: 14px; }
.qv { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 28px; }
.modal-art { background: var(--wall); border-radius: 16px; height: 300px; display: flex; align-items: flex-end; justify-content: center; padding: 24px; }
.modal-art svg, .modal-art img { height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 10px 8px rgba(40, 30, 10, 0.2)); }
.qv-info h2 { margin: 6px 0 2px; font: 600 26px/1.15 Fraunces, Georgia, serif; padding-right: 30px; }
.qv-info p { margin: 6px 0; }
.qv-price { font-size: 22px; font-weight: 800; }
.qv-price .muted { font-size: 14px; font-weight: 500; }
.qty.big { position: static; margin-top: 16px; }
.qty.big .add { width: auto; height: 44px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 16px; }
.qty.big .add::after { content: ' Add to cart'; font-size: 15px; font-weight: 700; }
.qty.big .stepper { height: 44px; display: inline-flex; }
.qty.big .stepper button { width: 44px; height: 44px; }
.co, .done { position: relative; padding: 28px; }
.co h2, .done h2 { margin: 0 0 8px; font: 600 26px/1.2 Fraunces, Georgia, serif; }
.test-note { background: #fff6df; border: 1px solid #f0d28b; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0 0 16px; }
.done { text-align: center; }
.done-tick { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }

/* ---------- store manager ---------- */
.editor {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 35;
  width: var(--editor-w); background: #fff; border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.25s ease;
}
.editor.open { transform: none; box-shadow: -10px 0 30px rgba(0, 0, 0, 0.08); }
body.editing .store { margin-right: var(--editor-w); }
body.editing .topbar-in { padding-right: calc(var(--editor-w) + 20px); }
body.editing .search { min-width: 160px; }
@media (max-width: 1240px) { body.editing .search { display: none; } }
.tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected='true'] { color: var(--ink); border-color: var(--accent); }
.editor-body { flex: 1; overflow-y: auto; padding: 14px 18px 40px; }
.editor-body h3 { margin: 4px 0 8px; font-size: 15px; }

.ed-shelves, .ed-items, .ed-products, .orders { list-style: none; margin: 0 0 14px; padding: 0; }
.ed-shelf { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: #fff; }
.ed-shelf.is-open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ed-row { display: flex; align-items: center; gap: 8px; }
.ed-row.sub { margin-top: 8px; justify-content: space-between; }
.ed-row.sub select { width: auto; flex: 1; }
.grip { color: #b3aa9b; cursor: grab; font-size: 16px; user-select: none; }
.pos { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; flex: none; }
.ed-title { flex: 1; font-weight: 700 !important; }
.ed-actions { display: flex; gap: 4px; }
.ed-items { margin: 10px 0 0; border-top: 1px dashed var(--line); padding-top: 8px; }
.ed-item { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 8px; }
.ed-item:hover { background: #faf7f0; }
.ed-item-name { flex: 1; font-weight: 600; font-size: 13px; min-width: 0; }
.mini { width: 34px; height: 40px; display: flex; align-items: flex-end; justify-content: center; flex: none; }
.mini svg, .mini img { max-width: 100%; max-height: 100%; }
.dragging { opacity: 0.4; }
.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.drop-after { box-shadow: 0 3px 0 var(--accent); }
.ed-product { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid #f1ece2; background: none; padding: 8px 2px; text-align: left; }
.ed-product:hover { background: #faf7f0; }

.pf-preview { display: flex; justify-content: center; margin: 4px 0 12px; }
.pf-art { width: 150px; height: 170px; background: var(--wall); border-radius: 14px; display: flex; align-items: flex-end; justify-content: center; padding: 12px; border-bottom: 10px solid var(--ledge); }
.pf-art svg, .pf-art img { max-width: 100%; max-height: 100%; filter: drop-shadow(0 6px 5px rgba(40, 30, 10, 0.18)); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 4px; margin: 0 0 14px; }
fieldset:disabled { opacity: 0.45; }
legend { font-weight: 800; font-size: 13px; padding: 0 6px; }
.photo input[type='file'] { margin-bottom: 10px; font-size: 13px; }
.cut-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cut-pair figure { margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); height: 140px; display: flex; flex-direction: column; }
.cut-pair img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.cut-pair figcaption { font-size: 11px; font-weight: 700; text-align: center; padding: 3px; background: #faf7f0; }
.checker { background: conic-gradient(#eee 25%, #fff 0 50%, #eee 0 75%, #fff 0) 0 0 / 14px 14px; }
.range { margin: 10px 0 6px; }
.cut-actions { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.pf-actions { display: flex; justify-content: space-between; align-items: center; }
.starter { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 14px; }

.order { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; font-size: 13px; }
.order p { margin: 2px 0; }
.order-top, .order-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-foot select { width: auto; }
.order-lines { list-style: none; padding: 8px 0; margin: 8px 0; border-block: 1px dashed var(--line); }
.order-lines li { display: flex; justify-content: space-between; }
.pill { background: #eef6f0; color: var(--accent); font-weight: 700; border-radius: 999px; padding: 2px 10px; font-size: 12px; }

/* account, share link, AI cut-out */
.sync-status { margin: 0; padding: 7px 18px; font-size: 12px; font-weight: 600; color: var(--muted); background: #faf7f0; border-bottom: 1px solid var(--line); }
.sync-status::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #c9bfae; margin-right: 7px; vertical-align: 1px; }
.sync-status[data-state='saved']::before { background: var(--accent); }
.sync-status[data-state='saving']::before { background: #e3a21a; }
.sync-status[data-state='error']::before, .sync-status[data-state='missing']::before { background: #c0392b; }
.acct, .share { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; background: #fff; }
.share.live { border-color: var(--accent); background: #f3faf5; }
.acct h3, .share h3 { display: flex; align-items: center; gap: 8px; }
.signed { margin-top: 0; }
.wide-link { display: block; text-align: center; text-decoration: none; }
a.secondary.center { display: grid; place-items: center; text-decoration: none; color: var(--ink); }
.link-box { background: #fff; border: 1px dashed var(--accent); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; word-break: break-all; font-weight: 700; font-size: 14px; }
.link-box a { color: var(--accent); }
.slug-field { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.slug-field:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.slug-pre { padding: 9px 0 9px 11px; color: var(--muted); font-weight: 500; white-space: nowrap; font-size: 13px; }
.slug-field input#slugIn { border: 0 !important; outline: none !important; padding-left: 1px !important; min-width: 60px; }
.sec { margin-top: 18px !important; display: flex; justify-content: space-between; align-items: baseline; }
.ai-btn {
  width: 100%; margin: 10px 0 4px; padding: 10px 14px; border-radius: 12px; font-weight: 800;
  border: 0; color: #fff; background: linear-gradient(120deg, #6d3df2, #c2389b 55%, #f07a2b);
  box-shadow: 0 4px 14px rgba(109, 61, 242, 0.25);
}
.ai-btn:disabled { opacity: 0.6; cursor: progress; }
.ai-note { margin-top: 4px; }
.loading { text-align: center; color: var(--muted); padding: 80px 0; }
.not-found { text-align: center; padding: 80px 16px; }
.not-found h1 { font: 600 28px/1.2 Fraunces, Georgia, serif; margin: 0 0 8px; }
.not-found .primary { display: inline-block; margin-top: 18px; text-decoration: none; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: all 0.25s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- small screens ---------- */
@media (max-width: 1000px) {
  body.editing .store { margin-right: 0; }
  body.editing .topbar-in { padding-right: 20px; }
  .editor { width: 100vw; z-index: 45; }
}
@media (max-width: 720px) {
  .topbar-in { flex-wrap: wrap; gap: 8px 10px; padding: 10px 16px; }
  .search { order: 5; flex-basis: 100%; max-width: none; margin: 0; }
  .brand-name { font-size: 19px; }
  .manage-btn span { display: none; }
  .manage-btn { padding: 8px 10px; }
  /* Brand, cart, share and manage on one row; the name gives way first. */
  .topbar-in { flex-wrap: wrap; }
  .brand { flex: 1 1 0; }
  .cart-pill, .manage-btn { flex: none; }
  .cart-pill-label { display: none; }
  .store { padding: 4px 16px 30px; }
  .item { width: 136px; }
  .track { --art-h: 124px; }
  .layout-covers .track { --art-h: 140px; }
  .layout-covers .item { width: 124px; }
  .layout-spines .track { --art-h: 160px; height: calc(14px + 160px + 14px + 6px); }
  .spine { height: calc(var(--h) * 0.85); }
  .endcap-grid { grid-template-columns: 1fr 1fr; }
  .endcap-grid .item.hero { grid-column: span 2; grid-row: auto; --art-h: 200px; }
  .qv { grid-template-columns: 1fr; padding: 20px; }
  .modal-art { height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
