/* Theme colours and fonts come from Admin → Design (a <style data-theme-vars> in the page head sets --fg, --bg,
   --btn …); these are the defaults, which are the original Moss & marigold look. Every colour below is built from
   them, so a new theme reaches the whole shop. */
:root {
  --fg: #1e2a26; --bg: #ffffff; --bg-alt: #e6efe9; --btn: #2f6b4f; --btn-fg: #ffffff; --accent: #e9a93b;
  --font: 'Atkinson Hyperlegible', system-ui, sans-serif; --font-heading: 'Fraunces', Georgia, serif; --heading-weight: 600;
  --radius: 6px; --field-bg: #ffffff;
  --header-bg: var(--bg); --header-fg: var(--fg); --header-btn: var(--btn); --header-btn-fg: var(--btn-fg); --header-field-bg: var(--field-bg); --header-field-fg: var(--fg); --header-link: var(--moss-deep);
  --paper: var(--bg);
  --ink: var(--fg);
  --ink-soft: color-mix(in srgb, var(--fg) 74%, var(--bg));
  --moss: var(--btn);
  --moss-deep: color-mix(in srgb, var(--btn) 70%, #000);
  --leaf: var(--bg-alt);
  --marigold: var(--accent);
  --line: color-mix(in srgb, var(--fg) 18%, var(--bg));
  --danger: #b2382e;
  --serif: var(--font-heading);
  --sans: var(--font);
  --r: var(--radius);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.5; }
a { color: var(--moss-deep); }
h1, h2, h3 { font-family: var(--serif); font-weight: var(--heading-weight, 600); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: 2rem; font-variation-settings: 'SOFT' 60; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; font-weight: 600; }
h2 small, h1 small { font-family: var(--sans); color: var(--ink-soft); font-weight: 400; font-size: .8rem; margin-left: .4em; }
p { margin: 0 0 1em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.fine { color: var(--ink-soft); font-size: .92rem; }
.pre { white-space: pre-line; }
.empty { padding: 3rem 0; text-align: center; color: var(--ink-soft); }
.warn { background: #fbecea; border-left: 4px solid var(--danger); padding: .6rem .9rem; border-radius: var(--r); }
.flash { position: fixed; top: 4rem; left: 50%; transform: translateX(-50%); background: var(--moss-deep); color: #fff; padding: .55rem 1.1rem; border-radius: 999px; z-index: 50; transition: opacity .4s; }
.flash.gone { opacity: 0; pointer-events: none; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* buttons & inputs */
.btn { display: inline-block; background: var(--moss); color: var(--btn-fg); border: 2px solid var(--moss); border-radius: var(--r); padding: .6rem 1.2rem; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--moss-deep); border-color: var(--moss-deep); }
.btn.ghost { background: transparent; color: var(--moss-deep); }
.btn.ghost:hover { background: var(--leaf); }
.btn[disabled] { opacity: .45; cursor: default; }
button.link, a.link { background: none; border: 0; padding: 0; font: inherit; color: var(--moss-deep); text-decoration: underline; cursor: pointer; }
button.link.danger { color: var(--danger); }
input, select, textarea { font: inherit; color: inherit; border: 1.5px solid var(--line); border-radius: var(--r); padding: .55rem .7rem; background: var(--field-bg); width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--moss); outline: none; box-shadow: 0 0 0 3px var(--leaf); }
label { display: block; margin: 0 0 .9rem; font-weight: 700; font-size: .95rem; }
label small { font-weight: 400; color: var(--ink-soft); }
label input, label select, label textarea { margin-top: .3rem; font-weight: 400; }
label.check, label.radio { font-weight: 400; display: flex; gap: .6rem; align-items: flex-start; }
label.check input, label.radio input { width: auto; margin: .3rem 0 0; }
form.inline { display: inline-flex; gap: .5rem; align-items: center; }
form.inline input { width: auto; }

/* shop header */
.shop-head { background: var(--header-bg); color: var(--header-fg); }
.shop-bar { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: .9rem 1.25rem; max-width: 1120px; margin: 0 auto; border-bottom: 1px solid color-mix(in srgb, var(--header-fg) 18%, var(--header-bg)); }
.shop-bar .brand { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--header-fg); text-decoration: none; white-space: nowrap; }
.shop-bar .search { display: flex; max-width: 460px; justify-self: center; width: 100%; }
.shop-bar .search input { border-radius: var(--r) 0 0 var(--r); }
.shop-bar .search button { border: 1.5px solid var(--header-btn); border-left: 0; background: var(--header-btn); color: var(--header-btn-fg); border-radius: 0 var(--r) var(--r) 0; padding: 0 .9rem; font: inherit; cursor: pointer; }
.shop-bar .bag { font-weight: 700; text-decoration: none; white-space: nowrap; color: var(--header-link); }
.shop-bar .bag b { background: var(--marigold); color: var(--ink); border-radius: 999px; padding: 0 .5em; }
.hero { padding: 1.5rem 0 .5rem; max-width: 620px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
.hero p { color: var(--ink-soft); }
.cats { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.cats a { text-decoration: none; border: 1.5px solid var(--line); border-radius: 999px; padding: .3rem .8rem; font-size: .92rem; color: var(--ink); }
.cats a small { color: var(--ink-soft); }
.cats a.on { background: var(--moss-deep); border-color: var(--moss-deep); color: var(--btn-fg); }
.cats a.on small { color: color-mix(in srgb, var(--btn-fg) 78%, var(--moss-deep)); }
.listbar { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.sort label { display: inline-flex; gap: .4rem; align-items: center; margin: 0; font-weight: 400; }
.sort select { width: auto; padding: .35rem .5rem; }

/* book grid */
.grid { list-style: none; margin: 1rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.4rem 1rem; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.card a { text-decoration: none; color: inherit; display: block; }
.cover { aspect-ratio: 2 / 3; background: var(--leaf); border-radius: 3px 8px 8px 3px; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; box-shadow: inset 6px 0 6px -6px rgba(0,0,0,.25), 0 1px 2px rgba(30,42,38,.15); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover span { font-family: var(--serif); text-align: center; padding: .8rem; color: var(--moss-deep); font-size: .95rem; }
.cover em { position: absolute; bottom: .5rem; left: .5rem; background: var(--ink); color: #fff; font-style: normal; font-size: .75rem; padding: .15rem .5rem; border-radius: 999px; }
.card.reserved .cover img { opacity: .55; }
.card h3 { margin: .6rem 0 .1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .author { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.price { font-weight: 700; margin: .25rem 0 0; }
.price span { font-weight: 400; color: var(--ink-soft); font-size: .85rem; margin-left: .35em; }
.price.big { font-size: 1.6rem; font-family: var(--serif); margin: .3rem 0 .8rem; }
.pager { display: flex; gap: .3rem; justify-content: center; margin: 2rem 0; }
.pager a { padding: .3rem .7rem; border-radius: var(--r); text-decoration: none; }
.pager a.on { background: var(--moss-deep); color: var(--btn-fg); }

/* detail */
.crumbs { color: var(--ink-soft); font-size: .9rem; }
.crumbs a.back { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .4rem .9rem .4rem .7rem;
  border: 1.5px solid var(--moss); border-radius: 999px; background: var(--moss); color: #fff;
  text-decoration: none; font-size: .95rem; font-weight: 700; }
.crumbs a.back:hover { background: var(--moss-deep); border-color: var(--moss-deep); }
.crumbs a.back .arw { font-size: 1.1em; line-height: 1; }
.is-admin .crumbs { margin: .9rem 0 .2rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .9rem 0 .2rem; }
.crumbs a.back.soft { font-weight: 400; background: #fff; color: var(--ink-soft); border-color: var(--line); padding-left: .9rem; }
.crumbs a.back.soft:hover { background: var(--leaf); color: var(--moss-deep); border-color: var(--moss); }
.detail { display: grid; grid-template-columns: minmax(220px, 380px) 1fr; gap: 2.5rem; align-items: start; margin-bottom: 3rem; }
.gallery img#mainphoto { width: 100%; border-radius: 3px 8px 8px 3px; box-shadow: 0 1px 3px rgba(30,42,38,.2); }
.thumbs { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.thumbs button { border: 2px solid transparent; border-radius: 4px; padding: 0; width: 64px; height: 64px; overflow: hidden; background: none; cursor: pointer; }
.thumbs button.on { border-color: var(--moss); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.cover.big { max-width: 380px; }
.info h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.info .author { font-size: 1.1rem; color: var(--ink-soft); margin-top: -.3rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1.2rem; font-size: .95rem; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; }
.soldtag { display: inline-block; background: var(--leaf); padding: .5rem .9rem; border-radius: var(--r); font-weight: 700; }
.desc { margin-top: 1.5rem; max-width: 62ch; }
.bundle { padding-left: 1.2rem; }
.bundle span { color: var(--ink-soft); }
.more h2 { margin-top: 1rem; }

/* cart / checkout / order */
.cartlist { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.cartlist li { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 1rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.cartlist.plain li { grid-template-columns: 1fr auto; }
.cartlist li.grand { font-size: 1.15rem; font-weight: 700; border-bottom: 0; }
.cover.mini { width: 56px; aspect-ratio: 2 / 3; border-radius: 2px 5px 5px 2px; flex: none; }
.totals { max-width: 380px; margin-left: auto; }
.totals p { display: flex; justify-content: space-between; margin: .3rem 0; }
.totals .grand { font-size: 1.3rem; font-weight: 700; font-family: var(--serif); margin: .8rem 0; border-top: 1px solid var(--line); padding-top: .6rem; }
.totals .btn { width: 100%; margin: .5rem 0; }
.totals .link { display: block; text-align: center; }
form/* Address autocomplete: the list has to sit over the fields below it, and each row needs to be
   comfortably tappable on a phone rather than a dense menu. */
#addr { position: relative; }
#addr .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
#addr label.short input { max-width: 10rem; }
.addy-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: -.7rem 0 0; padding: 0;
  list-style: none; background: #fff; border: 1.5px solid var(--moss); border-top: 0;
  border-radius: 0 0 var(--r) var(--r); box-shadow: 0 8px 20px rgba(0,0,0,.12); max-height: 16rem; overflow-y: auto; }
.addy-list li { padding: .7rem .8rem; cursor: pointer; border-bottom: 1px solid var(--line); font-size: .95rem; }
.addy-list li:last-child { border-bottom: 0; }
.addy-list li.on, .addy-list li:hover { background: var(--leaf); }
.checkout { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; align-items: start; }
form.checkout section { margin-bottom: 1.5rem; }
form.checkout aside { background: var(--leaf); padding: 1.2rem; border-radius: 10px; position: sticky; top: 1rem; }
.summary ul { list-style: none; padding: 0; margin: 0 0 .8rem; }
.summary li, .summary p { display: flex; justify-content: space-between; gap: 1rem; margin: .3rem 0; }
.summary .grand { font-weight: 700; font-size: 1.2rem; border-top: 1px solid rgba(0,0,0,.1); padding-top: .5rem; }
.summary .btn { width: 100%; margin-top: .6rem; }
.bankbox { background: var(--leaf); padding: 1.2rem 1.4rem; border-radius: 10px; max-width: 520px; margin-bottom: 1.5rem; }
.bankbox .acct { font-size: 1.4rem; font-family: var(--serif); letter-spacing: .02em; }
.shop-foot { border-top: 1px solid var(--line); margin-top: 2rem; color: var(--ink-soft); font-size: .92rem; }
.shop-foot .wrap { display: flex; gap: 3rem; flex-wrap: wrap; padding-top: 1.5rem; }

/* ---------- admin */
.is-admin { background: #f6f8f6; }
.adm-bar { position: sticky; top: 0; z-index: 20; background: var(--moss-deep); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; }
.adm-bar .brand { color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; }
.adm-bar .brand span { font-family: var(--sans); font-weight: 400; opacity: .7; font-size: .9rem; }
.adm-bar nav { display: flex; gap: .2rem; margin-left: auto; }
.adm-bar nav a { color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: var(--r); opacity: .85; }
.adm-bar nav a.on, .adm-bar nav a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.adm-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.adm-head h1 { margin: 0; }
.adm-head .btn { margin-left: auto; }
.stats { list-style: none; padding: 0; display: flex; gap: .8rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.stats li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem 1rem; min-width: 140px; }
.stats li b { font-family: var(--serif); font-size: 1.6rem; display: block; line-height: 1.1; }
.stats li.hot { border-color: var(--marigold); background: #fff8e8; }
.stats li a { text-decoration: none; color: inherit; }
.stats li small { color: var(--ink-soft); }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 1.5rem; }
.tbl th, .tbl td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
/* A table that genuinely has to stay a table scrolls inside its own box, never taking the page with it. */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl th { font-size: .85rem; color: var(--ink-soft); font-weight: 700; }
.pill { display: inline-block; font-size: .75rem; padding: .1rem .55rem; border-radius: 999px; background: var(--leaf); color: var(--moss-deep); font-weight: 700; vertical-align: middle; }
.pill.sold, .pill.shipped { background: #e4e7e5; color: var(--ink-soft); }
.pill.reserved, .pill.pending { background: #fff1d6; color: #8a5a00; }
.pill.paid { background: var(--moss-deep); color: #fff; }
.pill.draft, .pill.cancelled, .pill.expired { background: #eee; color: #666; }
.booklist { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.booklist li { display: grid; grid-template-columns: 1fr auto auto auto; gap: .9rem; align-items: center; padding: 0 .9rem; border-bottom: 1px solid var(--line); }
.booklist .open { display: grid; grid-template-columns: 44px 1fr auto; gap: .9rem; align-items: center;
  padding: .7rem 0; margin: 0 -.9rem 0 0; text-decoration: none; color: inherit; border-radius: 8px; min-height: 62px; }
.booklist .open:hover, .booklist .open:focus-visible { background: #eef3ef; outline: none; }
.booklist .open:active { background: #e4ebe5; }
.booklist .meta b { display: block; font-weight: 700; }
.booklist .meta small { color: var(--ink-soft); }
.booklist .chev { color: var(--ink-soft); font-size: 1.5rem; line-height: 1; padding-right: .2rem; }
.booklist li:last-child { border-bottom: 0; }
.booklist .cover.mini { width: 44px; }
.booklist form { display: flex; gap: .4rem; align-items: center; }
.booklist form select { width: auto; padding: .25rem .4rem; font-size: .85rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; flex: 1 1 140px; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { text-decoration: none; padding: .35rem .8rem; border-radius: 999px; border: 1.5px solid var(--line); color: var(--ink); font-size: .92rem; }
.tabs a.on { background: var(--moss-deep); border-color: var(--moss-deep); color: #fff; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.two section { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.actions { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, #f6f8f6 30%); padding: 1rem 0 .5rem; }
/* sales ledger */
.saleform { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; max-width: 640px; }
.saleform .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.saleform label.big-money input { font-size: 1.4rem; font-family: var(--serif); padding: .5rem .6rem; }
.saleform .extras { margin: .4rem 0 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.saleform .extras summary { cursor: pointer; color: var(--ink-soft); font-weight: 700; padding: .4rem 0; }
.saleform .actions.sticky { background: linear-gradient(transparent, #fff 30%); margin-bottom: 0; }
.saleform .pair { gap: 1rem; }
.saleform .implied { margin: -.4rem 0 1rem; color: var(--ink-soft); }
.saleform .implied b { color: var(--ink); }
.listkey { color: var(--ink-soft); margin: 0 0 .3rem; text-align: right; }
.tabs.kinds { margin-bottom: 1rem; }
.warn { background: #fff8e8; border: 1px solid var(--marigold); border-radius: 8px; padding: .6rem .9rem; margin: -.4rem 0 1.2rem; font-size: .92rem; }
.salelist li.is-period { background: #fbfdfb; }
.salelist .pill, .orderlist .pill { vertical-align: 2px; font-weight: 400; }
.chanline { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.8rem 0 1.2rem; }
.chanline.lines .chan { font-size: .95rem; text-decoration: none; color: var(--ink); }
.chanline.lines .chan.on { background: var(--moss-deep); border-color: var(--moss-deep); color: #fff; }
.chan { font-size: .9rem; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .8rem; }
.chan b { color: var(--ink); }
.salelist li, .orderlist li { grid-template-columns: 1fr auto; }
.salelist strong, .orderlist strong { text-align: right; }
.salelist strong small.gross { display: block; font-weight: 400; font-size: .75rem; color: var(--ink-soft); }
/* No cover on a sale row: without this the link keeps the book list's 44px cover column
   and the title is crushed into it. */
.salelist .open, .orderlist .open { grid-template-columns: 1fr auto; }
.login { max-width: 380px; margin: 3rem auto; background: #fff; padding: 2rem; border: 1px solid var(--line); border-radius: 12px; }
.login .btn { width: 100%; }

/* finder */
.finder { background: var(--moss-deep); color: #fff; border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.finder-row { display: flex; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.finder-row input { flex: 1 1 160px; border-color: transparent; }
.finder .btn { background: var(--marigold); border-color: var(--marigold); color: var(--ink); }
.finder .btn.ghost { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }
.finder .fine { color: #d7e6dc; margin: .3rem 0 0; }
.finder .link { color: #fff; opacity: .85; font-size: .92rem; }
.finder input[type=search] { -webkit-appearance: none; appearance: none; }
#coverpick { background: var(--leaf); border-radius: 10px; padding: .7rem; margin-bottom: .8rem; }
#coverpick .fine { margin: 0 0 .5rem; }
#coverpick-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.coverop { width: 84px; padding: 2px; border: 2px solid transparent; border-radius: 8px; background: none; font: inherit; color: var(--ink); text-align: center; cursor: pointer; }
.coverop img { display: block; width: 76px; height: 106px; object-fit: cover; border-radius: 4px; background: rgba(0,0,0,.08); }
.coverop span { display: block; font-size: .76rem; line-height: 1.25; margin-top: .25rem; min-height: 1.25em; }
.coverop.on { border-color: var(--moss); }
.coverop.on span { font-weight: 700; color: var(--moss-deep); }
.coverop:focus-visible { outline: 2px solid var(--moss-deep); outline-offset: 2px; }
.coverop[disabled] { cursor: default; }
.defects { border: 1.5px solid var(--line); border-radius: var(--r); padding: .5rem .7rem .7rem; margin: 0 0 .8rem; }
.defects legend { font-weight: 700; padding: 0 .3rem; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: .3rem .7rem; cursor: pointer; font-size: .92rem; }
.chip input { width: auto; margin: 0; }
.chip:has(input:checked) { background: var(--leaf); border-color: var(--moss); font-weight: 700; }
#reader { max-width: 480px; margin: .5rem 0; background: #000; border-radius: 8px; overflow: hidden; }
#reader video { width: 100% !important; }
.results { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .4rem; }
.results li { display: grid; grid-template-columns: 44px 1fr auto; gap: .8rem; align-items: center; background: rgba(255,255,255,.1); border-radius: 8px; padding: .5rem .7rem; }
.results img { width: 44px; height: 60px; object-fit: cover; border-radius: 3px; background: rgba(255,255,255,.15); }
.results small { color: #cfe3d6; }
.brow { display: grid; grid-template-columns: 2fr 1.5fr 1fr; gap: .4rem; margin-bottom: .4rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.photos figure { margin: 0; position: relative; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--leaf); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos button { position: absolute; top: .3rem; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1rem; cursor: pointer; }
.photos button[data-del] { right: .3rem; }
.photos button[data-first] { left: .3rem; }
.photos figure:first-child button[data-first] { background: var(--marigold); color: var(--ink); }
.filebtn { display: inline-block; margin-bottom: .3rem; }
.listing { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; margin-top: 1.5rem; }
.listing input, .listing textarea { margin-bottom: .6rem; font-family: var(--sans); }
.copyrow { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.settings .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.settings label.short input { max-width: 10rem; }
.settings section { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; margin-bottom: 1.2rem; }
/* Install / alerts / updates. The buttons here are the filled kind on purpose: an outline pill
   does not read as something you press. The ntfy topic is typed into a phone by hand, so it is
   big, monospaced and selectable. */
.steps { margin: .4rem 0 0; padding-left: 1.2rem; color: var(--ink-soft); font-size: .95rem; }
.checks { list-style: none; padding: 0; margin: .6rem 0 .8rem; font-size: .95rem; }
.checks li { padding: .2rem 0; }
.steps li { margin: .35rem 0; }
.settings h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.settings section > p:first-of-type { margin-top: 0; }
#installcard p, #pushcard p { margin: 0 0 .8rem; }
#installcard .btn, #pushcard .btn { width: 100%; }
.ok { color: var(--moss-deep); }
.warnline { background: #fff8e8; border: 1px solid var(--marigold); border-radius: 8px; padding: .6rem .9rem; font-size: .92rem; }
#notifications input[name="ntfy_topic"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; letter-spacing: .02em; }
#notifications details, #updates details { margin-top: .8rem; }
#notifications summary, #updates summary { cursor: pointer; color: var(--ink-soft); font-weight: 700; padding: .4rem 0; }
.devlist { list-style: none; padding: 0; margin: .2rem 0 .8rem; }
.devlist li { display: flex; justify-content: space-between; gap: .8rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.devlist li > span { min-width: 0; overflow-wrap: anywhere; }
.devlist li:last-child { border-bottom: 0; }
.devlist small { display: block; color: var(--ink-soft); font-weight: 400; }
.commits { list-style: none; padding: 0; margin: .2rem 0 .8rem; font-size: .9rem; color: var(--ink-soft); }
.commits li { padding: .2rem 0; overflow-wrap: anywhere; }
.afterform { display: grid; gap: .6rem; margin: -.4rem 0 1.5rem; }
.afterform .btn { width: 100%; }
.afterform .fine { margin: .2rem 0 0; }
/* Logo: the header keeps its height, so the image is bounded rather than the row growing. */
/* Shop header only. The admin bar keeps its text brand: a wide wordmark plus six nav links does
   not fit a phone, and it pushed the menu off the side of the screen. */
.shop-bar .brand.haslogo { display: flex; align-items: center; padding: .2rem 0; }
.shop-bar .brand.haslogo img { height: 44px; width: auto; max-width: 240px; display: block; object-fit: contain; }
.logopreview { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .9rem; margin: 0 0 .8rem; text-align: center; }
.logopreview img { height: 80px; width: auto; max-width: 100%; object-fit: contain; }
.logoform { display: grid; gap: .6rem; margin: -.4rem 0 1.5rem; }
.logoform .btn { width: 100%; }
#stripekeys code { background: #eef3ef; border-radius: 4px; padding: .1rem .3rem; font-size: .9em; word-break: break-all; }
.tiers { border-collapse: collapse; margin-bottom: .4rem; }
.tiers th { text-align: left; font-size: .85rem; color: var(--ink-soft); padding: 0 .5rem .2rem 0; }
.tiers td { padding: .2rem .5rem .2rem 0; }
.tiers input { width: 110px; }
.mapping label { max-width: 420px; }
.catlist { list-style: none; padding: 0; }
.catlist li form { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.catlist li input { max-width: 300px; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: .8rem 1rem 3rem; }
  .shop-bar { grid-template-columns: 1fr auto; padding: .7rem 1rem; }
  .shop-bar .search { grid-column: 1 / -1; max-width: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1.1rem .8rem; }
  .detail, form.checkout, .two { grid-template-columns: 1fr; }
  form.checkout aside { position: static; }
  .totals { max-width: none; }
  /* Six nav links will not fit beside the brand on a phone. nav is a flex item, so with the
     default min-width:auto it refused to shrink and took the whole page sideways with it. Give it
     its own row across the full width; overflow-x is the backstop if the labels ever grow again,
     and it confines the scroll to the nav rather than the page. */
  .adm-bar { padding: .5rem .8rem; gap: .5rem; flex-wrap: wrap; row-gap: .35rem; }
  .adm-bar .brand { font-size: 1.05rem; }
  .adm-bar nav { width: 100%; margin-left: 0; gap: 0; min-width: 0; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .adm-bar nav::-webkit-scrollbar { display: none; }
  .adm-bar nav a { padding: .45rem .45rem; font-size: .88rem; white-space: nowrap; }
  /* 110px + 110px + a Remove button does not fit in the ~282px a 360px phone actually offers. */
  .tiers { width: 100%; table-layout: fixed; }
  .tiers input { width: 100%; min-width: 0; }
  .tiers td:last-child { width: 4.6rem; }
  .tiers td:last-child .link { font-size: .85rem; }
  /* Two of these side by side came to 293px in a 282px box. */
  .stats li { min-width: 0; flex: 1 1 8.5rem; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .booklist li { grid-template-columns: auto 1fr; padding: 0 .7rem .6rem; row-gap: .4rem; }
  .saleform .row2 { grid-template-columns: 1fr; }
  .booklist .open { grid-column: 1 / -1; margin: 0 -.7rem; padding: .7rem; min-height: 68px; }
  .booklist li strong { grid-column: 1; }
  /* After the .booklist overrides, not before, or they lose the tie and the money is thrown
     onto a row of its own. A sale stays one row: title and date left, profit right. */
  .salelist li, .orderlist li { grid-template-columns: 1fr auto; padding-bottom: .2rem; align-items: center; }
  .salelist .open, .orderlist .open { grid-column: 1; grid-template-columns: 1fr auto; margin: 0; padding: .7rem 0; }
  .salelist li strong, .orderlist li strong { grid-column: 2; align-self: center; text-align: right; }
  .booklist li .pill { grid-column: 2; justify-self: start; }
  .booklist li form { grid-column: 1 / -1; }
  .brow { grid-template-columns: 1fr; }
  .cartlist li { grid-template-columns: 48px 1fr auto; }
  .cartlist li form { grid-column: 2 / -1; }
  .settings .row2, #addr .row2 { grid-template-columns: 1fr; gap: 0; }
  .shop-bar .brand.haslogo img { height: 34px; max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Live postage options at checkout */
.postopts { border: 0; padding: 0; margin: .4rem 0 1rem; }
.postopts legend { font-weight: 700; margin-bottom: .5rem; }
.postopt { display: flex; align-items: center; gap: .7rem; border: 1.5px solid var(--line); border-radius: var(--r); padding: .7rem .8rem; margin: 0 0 .5rem; cursor: pointer; font-weight: 400; }
.postopt span { flex: 1; }
.postopt span i { font-style: normal; color: var(--ink-soft); }
.postopt:has(input:checked) { border-color: var(--moss); background: var(--leaf); }

/* Policy pages and footer links */
.policy { max-width: 70ch; margin: 1rem 0 2rem; }
.rte h2 { font-size: 1.2rem; margin: 1.6rem 0 .5rem; }
.rte ul, .rte ol { padding-left: 1.3rem; }
.rte li { margin: .25rem 0; }
.rte a { color: var(--moss-deep); }
.rte table { border-collapse: collapse; } .rte td, .rte th { border: 1px solid var(--line); padding: .4rem .6rem; }
.shop-foot .policies { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; padding-top: .8rem; padding-bottom: 1.2rem; font-size: .88rem; }
.shop-foot .policies a { color: var(--ink-soft); }
.summary .agree { margin-top: .6rem; font-size: .8rem; }

/* Settings → Backup & restore */
.big-btn { width: 100%; max-width: 420px; padding: .9rem 1.2rem; margin: .4rem 0; }
.backuplist { list-style: none; padding: 0; margin: 0 0 1rem; }
.backuplist li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid #e3e0d6; }
.backuplist li > span:first-child { display: flex; flex-direction: column; }
.backupbtns { display: flex; gap: .5rem; }
.backupbtns form { margin: 0; }
.restore-counts { border-collapse: collapse; margin: .6rem 0 1rem; }
.restore-counts th, .restore-counts td { padding: .4rem .9rem .4rem 0; text-align: left; }

/* ---- Design editor additions: header band, menu links, announcement bar, logo size, home sections ---- */
.shop-bar .search input { background: var(--header-field-bg); color: var(--header-field-fg); }
.shop-head.logo-small .brand.haslogo img { height: 32px; }
.shop-head.logo-large .brand.haslogo img { height: 64px; max-width: 320px; }
@media (max-width: 719px) { .shop-head.logo-small .brand.haslogo img { height: 26px; } .shop-head.logo-large .brand.haslogo img { height: 46px; max-width: 200px; } }
.shop-menu { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; max-width: 1120px; margin: 0 auto; padding: .55rem 1.25rem; }
.shop-menu a { color: var(--header-link); text-decoration: none; font-weight: 700; padding: .25rem 0; border-bottom: 2px solid transparent; }
.shop-menu a:hover, .shop-menu a[aria-current] { border-bottom-color: currentColor; }
.announce { background: var(--announce-bg, var(--btn)); color: var(--announce-fg, var(--btn-fg)); text-align: center; padding: .5rem 1.25rem; font-size: .95rem; }
.announce a { color: inherit; }
.shop-foot { background: var(--header-bg); color: color-mix(in srgb, var(--header-fg) 74%, var(--header-bg)); }
.shop-foot a { color: var(--header-link); }
.shop-foot .policies a { color: color-mix(in srgb, var(--header-fg) 74%, var(--header-bg)); }

.sec { margin: 1.2rem 0; }
.sec-banner.sec-space-normal.sec-bg-none { margin: 0; }   /* the welcome banner sits exactly where the old intro did */
.sec-space-compact { margin: .5rem 0; }
.sec-space-roomy { margin: 2.6rem 0; }
.sec-bg-tint, .sec-bg-dark, .sec-bg-accent { padding: 1.6rem 1.4rem; border-radius: calc(var(--r) * 2); }
.sec-bg-tint { background: var(--leaf); }
.sec-bg-dark { background: var(--ink); color: var(--paper); }
.sec-bg-dark :is(h1, h2, h3, a, .hero p) { color: var(--paper); }
.sec-bg-accent { background: var(--moss); color: var(--btn-fg); }
.sec-bg-accent :is(h1, h2, h3, a, .hero p) { color: var(--btn-fg); }
.sec-bg-accent .btn, .sec-bg-dark .btn { background: var(--btn-fg); color: var(--moss); border-color: var(--btn-fg); }
@media (max-width: 719px) { .sec-show-desktop { display: none; } }
@media (min-width: 720px) { .sec-show-phone { display: none; } }
.hero--center { margin-inline: auto; text-align: center; }
.hero--img { position: relative; max-width: none; min-height: 18rem; display: flex; align-items: flex-end; padding: 2rem 1.6rem; border-radius: calc(var(--r) * 2); overflow: hidden; color: #fff; }
.hero--img .hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero--img::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,.15)); z-index: 1; }
.hero--img .hero-text { position: relative; z-index: 2; max-width: 620px; }
.hero--img.hero--center { justify-content: center; text-align: center; }
.hero--img h1, .hero--img p { color: #fff; }
.listbar .see-all { font-weight: 700; text-decoration: none; }
.promises { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 1rem; }
.promises li { display: flex; gap: .7rem; align-items: flex-start; }
.promises svg { flex: none; color: var(--moss); }
.sec-bg-accent .promises svg, .sec-bg-dark .promises svg { color: inherit; }
.promises strong { display: block; }
.promises span { color: var(--ink-soft); font-size: .92rem; }
.sec-bg-dark .promises span, .sec-bg-accent .promises span { color: inherit; opacity: .85; }
@media (max-width: 719px) { .promises { grid-template-columns: 1fr; } }
.imgtext { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; }
.imgtext img, .imgtext-blank { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: calc(var(--r) * 2); background: var(--leaf); }
.imgtext--right img, .imgtext--right .imgtext-blank { order: 2; }
@media (max-width: 719px) { .imgtext { grid-template-columns: 1fr; gap: 1rem; } .imgtext--right img, .imgtext--right .imgtext-blank { order: 0; } }
.textsec { max-width: 680px; }
.textsec--center { margin-inline: auto; text-align: center; }
.contactsec { max-width: 680px; }
.grid.row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); grid-template-columns: none; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .4rem; }
.grid.row > li { scroll-snap-align: start; }
@media (max-width: 719px) { .grid.row { grid-auto-columns: 42%; } }
