:root {
  color-scheme: light;
  --brand-blue: #0152ea;
  --brand-navy: #001542;
  --white: #ffffff;
  --paper: #f6f8fc;
  --ink: var(--brand-navy);
  --muted: #485772;
  --line: #dce5f4;
  --control-line: #b9c9e5;
  --blue-tint: #e8f0ff;
  --focus: var(--brand-blue);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
h1, h2, p { margin: 0; }
a { color: var(--brand-blue); }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input, select, textarea { color: var(--ink); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { margin-bottom: .65rem; padding: 0; font-weight: 700; }
img { display: block; width: 100%; height: 100%; object-fit: contain; }
[hidden] { display: none !important; }

.shell { width: min(1296px, calc(100% - 64px)); margin-inline: auto; }
.mast { background: var(--white); border-bottom: 1px solid var(--line); }
.mast-inner { min-height: 93px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.wordmark { display: inline-flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.wordmark img { width: clamp(140px, 19vw, 184px); max-width: 100%; height: auto; }
.top-actions { display: flex; align-items: center; gap: 1rem; }
.top-link { font-size: .88rem; text-decoration: none; font-weight: 650; }
.top-link:hover { text-decoration: underline; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .48rem;
  min-height: 43px; border: 1px solid transparent; border-radius: 8px; padding: .56rem .92rem;
  text-decoration: none; font-size: .9rem; font-weight: 700; line-height: 1.2;
}
.dark { color: white; background: var(--brand-blue); }
.dark:hover { background: var(--brand-navy); }
.outline { color: var(--brand-blue); border-color: var(--control-line); background: var(--white); }
.outline:hover, .browse:hover { background: var(--blue-tint); }
.cart-button span { background: var(--blue-tint); color: var(--brand-navy); min-width: 22px; border-radius: 12px; padding: .12rem .32rem; text-align: center; }
.catalog-intro { padding: 2.8rem 0 1.65rem; border-bottom: 1px solid var(--line); }
.demo-note { font-size: .78rem; color: var(--muted); font-weight: 650; letter-spacing: .02em; margin-bottom: .52rem; }
h1 { font: 400 clamp(2.1rem, 5vw, 3.9rem)/1.04 Georgia, "Times New Roman", serif; letter-spacing: -.048em; }
.search-row { display: flex; gap: .65rem; margin-top: 1.35rem; width: min(100%, 740px); }
.search-wrap {
  display: flex; align-items: center; gap: .85rem; flex: 1; min-width: 0;
  min-height: 50px; padding: 0 .95rem; background: var(--white); border: 1px solid var(--control-line); border-radius: 9px;
}
.search-wrap:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.search-wrap input { border: 0; background: transparent; width: 100%; min-width: 0; padding: .8rem 0; outline: none; }
.loupe { width: 15px; height: 15px; border: 1.75px solid var(--brand-blue); border-radius: 50%; position: relative; flex: 0 0 auto; }
.loupe::after { content: ""; position: absolute; width: 7px; height: 1.75px; background: var(--brand-blue); bottom: -2px; right: -5px; transform: rotate(45deg); }
.catalog-menu { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; margin-top: 1rem; }
.catalog-menu button {
  background: transparent; border: 1px solid transparent; border-radius: 7px; padding: .54rem .69rem;
  min-height: 42px; font-weight: 700; font-size: .91rem; color: var(--brand-navy);
}
.catalog-menu button span { margin-left: .08rem; color: var(--muted); }
.catalog-menu button:hover, .catalog-menu button[aria-expanded="true"], .catalog-menu button.selected { background: var(--blue-tint); }
.catalog-menu-panel {
  display: flex; flex-wrap: wrap; gap: .35rem; background: var(--white); border: 1px solid var(--line);
  padding: .45rem; margin-top: .45rem; width: fit-content; max-width: 100%; border-radius: 8px;
}
.menu-choice {
  background: var(--white); border: 1px solid var(--line); padding: .48rem .66rem; border-radius: 6px;
  color: var(--brand-navy); font-weight: 650; font-size: .86rem; min-height: 42px;
}
.menu-choice:hover { background: var(--blue-tint); }
.menu-choice span { color: var(--muted); margin-left: .25rem; font-size: .77rem; }
.menu-all { text-decoration: underline; border-color: transparent; }
.filter-count { background: var(--blue-tint); padding: .13rem .39rem; border-radius: 5px; }
.catalog-content { padding: 1.5rem 0 3rem; }
.home-section + .home-section { margin-top: 1.75rem; }
.home-section h2, .result-bar h2 {
  font: 400 clamp(1.55rem, 3.5vw, 2.15rem)/1.08 Georgia, serif; letter-spacing: -.032em;
}
.home-section h2 { margin-bottom: .78rem; }
.home-section-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: .78rem; }
.home-section-head h2 { margin: 0; }
.home-section-head button { flex: 0 0 auto; }

.check { display: flex; align-items: center; gap: .5rem; min-height: 32px; font-size: .88rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand-blue); margin: 0; }
.control { display: grid; gap: .35rem; align-content: start; min-width: 0; font-weight: 650; font-size: .86rem; }
.control input, .control select, .control textarea, .sort select, .message-panel textarea {
  width: 100%; min-width: 0; border: 1px solid var(--control-line); border-radius: 7px; background: var(--white);
  min-height: 41px; padding: .53rem .63rem; font-weight: 450; font-size: .91rem;
}
.control textarea, .message-panel textarea { resize: vertical; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 41px; margin-bottom: .42rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; justify-content: flex-end; }
#result-count { color: var(--muted); font-size: .91rem; margin: 0 0 .63rem; }
.sort select { font-size: .85rem; }
.active-filters { display: flex; flex-wrap: wrap; gap: .45rem; }
.active-filters:not(:empty) { margin-bottom: .8rem; }
.active-filter, .plain { border: 0; background: var(--blue-tint); color: var(--brand-blue); border-radius: 6px; padding: .4rem .55rem; font-size: .81rem; }
.plain { background: none; text-decoration: underline; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--white); }
.card-image, .detail-image {
  position: relative; width: 100%; border: 0; display: grid; place-items: center; aspect-ratio: 1.16;
  background: var(--blue-tint); padding: .75rem; overflow: hidden;
}
.card-image:focus-visible { outline-offset: -4px; }
.card-image img { transition: transform .2s ease; }
.card-image:hover img { transform: scale(1.035); }
.placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: var(--brand-navy); }
.placeholder-card {
  display: grid; place-items: center; width: 44%; aspect-ratio: .72; max-height: 100%; border-radius: 6px;
  background: linear-gradient(155deg, #ffffff, #cfe0fd); border: 1px solid #a7bde2;
  box-shadow: inset 0 0 0 4px #f6faff, inset 0 0 0 5px #c0d1ec, 0 6px 14px #0015421e; transform: rotate(-5deg);
}
.card:nth-child(4n+2) .placeholder-card { background: linear-gradient(155deg, #ffffff, #d4e5fd); color: #0d4299; transform: rotate(4deg); }
.card:nth-child(4n+3) .placeholder-card { background: linear-gradient(155deg, #f8faff, #cfdefa); color: #234e8c; }
.card:nth-child(4n) .placeholder-card { background: linear-gradient(155deg, #ffffff, #dce7fc); color: #25437b; transform: rotate(5deg); }
.placeholder-mark { font: 400 clamp(1rem, 3vw, 2.75rem) Georgia, serif; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: .84rem .8rem; }
.card-kicker { color: var(--muted); font-size: .74rem; font-weight: 700; }
.card h3 { font-size: 1.06rem; line-height: 1.19; margin: .28rem 0 .18rem; }
.title-button { text-align: left; padding: 0; border: 0; background: none; font: inherit; font-weight: 750; }
.title-button:hover { text-decoration: underline; }
.card-set { color: var(--muted); font-size: .79rem; line-height: 1.35; overflow-wrap: anywhere; }
.card-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin: .56rem 0; }
.card-tag { padding: .26rem .45rem; border-radius: 4px; background: var(--blue-tint); color: var(--brand-navy); font-size: .75rem; font-weight: 650; overflow-wrap: anywhere; }
.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; width: 100%; gap: .44rem; margin-top: auto; padding-top: .2rem; }
.card-footer > strong { font-size: 1.06rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.add { border: 1px solid var(--control-line); background: var(--white); color: var(--brand-navy); font-size: .79rem; min-height: 39px; padding: .48rem .55rem; }
.add:hover, .add.added { background: var(--blue-tint); }
#pagination { text-align: center; margin-top: 1.2rem; }
.empty { grid-column: 1 / -1; text-align: center; border: 1px dashed var(--control-line); padding: 2rem 1rem; border-radius: 10px; background: var(--white); }
.empty > p { margin-top: .4rem; color: var(--muted); font-size: .9rem; }
.empty .button { margin: .75rem auto 0; display: table; }

dialog {
  border: 1px solid var(--line); border-radius: 13px; width: min(500px, calc(100% - 24px)); max-height: 90dvh;
  overflow: auto; padding: 1.15rem; background: var(--white); color: var(--ink); box-shadow: 0 14px 48px #00154238;
}
dialog::backdrop { background: #00154265; }
.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .85rem; }
.overlay-head h2 { font: 400 1.85rem/1.1 Georgia, serif; letter-spacing: -.028em; }
.icon-close { min-height: 38px; width: 38px; padding: 0; background: var(--blue-tint); color: var(--brand-blue); font-size: 1.45rem; }
.detail { width: min(730px, calc(100% - 24px)); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; }
.detail-image { border-radius: 8px; aspect-ratio: .88; padding: .7rem; }
.photo-picker { display: flex; gap: .45rem; margin-top: .5rem; }
.photo-picker button[aria-pressed="true"] { background: var(--blue-tint); }
.share-product { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.share-photo { flex: 0 0 70px; height: 82px; padding: .25rem; border-radius: 6px; background: var(--blue-tint); overflow: hidden; }
.share-product .muted { margin: .2rem 0 0; }
.share-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.share-feedback:empty { display: none; }
.detail-set { color: var(--muted); line-height: 1.35; }
.detail-comment { margin: .7rem 0; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-info { display: grid; grid-template-columns: auto 1fr; gap: .52rem .75rem; font-size: .86rem; }
.detail-info dt { color: var(--muted); }
.detail-info dd { font-weight: 650; margin: 0; overflow-wrap: anywhere; }
.detail-price { font-size: 1.6rem; font-weight: 750; margin-bottom: .65rem; }
.cart { width: min(650px, calc(100% - 24px)); }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-list li { border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .7rem; padding: .8rem 0; }
.cart-list p, .cart-list small { color: var(--muted); font-size: .82rem; }
.cart-line-price { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.qty { display: flex; gap: .4rem; align-items: center; }
.qty button { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; width: 40px; height: 42px; font-size: 1.05rem; }
.cart-total { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.muted { color: var(--muted); font-size: .86rem; line-height: 1.45; margin: .65rem 0; }
.full { width: 100%; }
.message-panel { margin-top: .8rem; font-size: .85rem; }
.message-panel summary { cursor: pointer; margin-bottom: .45rem; }
.message-panel textarea { font-size: .84rem; }
.form-error { color: #862f27; font-size: .89rem; margin: .65rem 0; }
.form-error:empty, #fill-status:empty { display: none; }

.admin-intro > p:not(.demo-note) { color: var(--muted); max-width: 61ch; margin-top: .9rem; line-height: 1.5; }
.admin-intro-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.inventory { padding: 1.3rem 0 3rem; }
.inventory-filters { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr) minmax(125px, .45fr); max-width: 650px; margin-bottom: .8rem; }
.inventory-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--white); overflow: hidden; }
.inventory-list li { display: grid; grid-template-columns: 46px minmax(0, 1fr) minmax(140px, .6fr) auto; align-items: center; gap: .7rem; border-bottom: 1px solid var(--line); padding: .68rem .8rem; }
.inventory-list li:last-child { border: 0; }
.inventory-list p, .inventory-list small { color: var(--muted); font-size: .82rem; margin-top: .14rem; }
.inventory-stock { display: grid; gap: .1rem; }
.row-actions, .sale-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.row-actions .button { min-height: 40px; padding: .45rem .65rem; font-size: .81rem; }
.inventory-list .featured-label { color: var(--brand-blue); font-weight: 700; }
.inventory-photo { width: 46px; height: 51px; background: var(--blue-tint); border-radius: 5px; overflow: hidden; padding: .17rem; }
.inventory-photo .placeholder-mark { font-size: .64rem; }
.editor { width: min(790px, calc(100% - 24px)); }
.paste-panel { padding: .85rem; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; margin-bottom: .9rem; }
.paste-panel .button { margin-top: .44rem; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-bottom: .95rem; }
.field-grid.uploads { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.uploads input { font-size: .81rem; }
.tag-edit { display: flex; flex-wrap: wrap; gap: .3rem .85rem; padding-bottom: .75rem; }
.editor-phase { max-width: 270px; margin-top: .8rem; }
.editor-more { margin: .5rem 0; border: 1px solid var(--line); border-radius: 7px; }
.editor-more summary { padding: .6rem .7rem; cursor: pointer; color: var(--brand-blue); font-size: .9rem; font-weight: 700; }
.editor-more .field-grid { padding: 0 .7rem; margin: .35rem 0 .75rem; }
.featured-check { margin-top: .55rem; }
#comment-help, #featured-help { margin: .25rem 0 .7rem; }
.editor-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .48rem; margin-top: .8rem; }
#toast {
  position: fixed; z-index: 10; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--brand-navy); color: white; border-radius: 8px; padding: .68rem .9rem; font-size: .9rem;
  width: max-content; max-width: calc(100% - 2rem); opacity: 0; pointer-events: none;
}
#toast.visible { opacity: 1; }
.visually-hidden { position: absolute; height: 1px; width: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1170px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { width: calc(100% - 38px); }
  .grid { gap: .65rem; }
}
@media (max-width: 779px) {
  .catalog-content { padding-top: 1rem; }
  .row-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .catalog-intro { padding: 1.7rem 0 1rem; }
  .top-actions { gap: .6rem; }
  .mast-inner { min-height: 72px; }
}
@media (max-width: 560px) {
  .shell { width: calc(100% - 26px); }
  .search-row { flex-wrap: wrap; margin-top: .9rem; gap: .45rem; }
  .search-row .button { font-size: .74rem; padding-inline: .48rem; }
  .search-wrap { padding-inline: .6rem; gap: .55rem; }
  .search-wrap input { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-body { padding: .65rem .56rem; }
  .card-footer > strong { font-size: .97rem; }
  .card-footer .add { width: 100%; min-height: 42px; }
  .card h3 { font-size: .96rem; }
  .top-link { font-size: .77rem; }
  .detail-layout { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  .detail-image { max-height: 42dvh; aspect-ratio: 1.08; }
  .cart-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .cart-line-price { text-align: right; }
  .qty { grid-column: 2; justify-content: flex-end; }
  .inventory-list li { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .inventory-photo { width: 36px; height: 44px; }
  .inventory-stock { grid-column: 2; grid-row: 2; }
  .row-actions { grid-column: 2 / -1; grid-row: 3; }
  .catalog-menu { gap: .08rem; margin-top: .65rem; }
  .catalog-menu button { padding-inline: .48rem; font-size: .85rem; }
  .result-actions { gap: .17rem; }
  .result-actions select { max-width: 145px; }
  .field-grid, .field-grid.uploads { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor input:not([type=checkbox], [type=file]), .editor textarea, .editor select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .card-image img { transition: none; } }

.shelf-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 3rem) / 4);
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: .5rem;
  scrollbar-width: thin;
}
.shelf-scroll > .card { scroll-snap-align: start; }
.shelf-empty { color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: .94rem 1rem; }
.product-kind { max-width: 250px; margin-bottom: .9rem; }
.editor-photos { margin-bottom: .8rem; }
.editor-photos .muted { margin-top: 0; }
.editor-preview { max-width: 140px; width: auto; max-height: 134px; margin-top: .25rem; border-radius: 5px; }
.visibility-options { margin-top: 1rem; }
.visibility-choice {
  display: flex; align-items: flex-start; gap: .6rem; padding: .68rem .76rem;
  border: 1px solid var(--line); border-radius: 7px; margin: .38rem 0; cursor: pointer;
}
.visibility-choice:has(input:checked) { background: var(--blue-tint); border-color: var(--control-line); }
.visibility-choice input { margin: .22rem 0 0; accent-color: var(--brand-blue); }
.visibility-choice small { display: block; margin-top: .15rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 950px) {
  .shelf-scroll { grid-auto-columns: calc((100% - 1.4rem) / 3); gap: .7rem; }
}
@media (max-width: 560px) {
  .shelf-scroll { grid-auto-columns: calc((100% - .65rem) / 2.06); gap: .65rem; }
}
