:root {
  color-scheme: light;
  --ink: #000;
  --muted: #525252;
  --paper: #f6f6f6;
  --surface: #fff;
  --line: #dedede;
  --panel: #eee;
  --accent: #fe0000;
  --accent-hover: #ff3832;
  --accent-tint: #fff0f0;
  --radius: 14px;
  --shadow: 0 16px 60px #0003;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.shell { width: min(1360px, 100% - 88px); margin-inline: auto; }
.topbar { background: var(--ink); color: var(--surface); }
.admin-header, .shop-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 69px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.header-link { color: #fff; font-size: .9rem; font-weight: 650; text-underline-offset: 4px; }
.brand { display: flex; gap: 10px; align-items: center; justify-self: start; text-decoration: none; font-size: 1.55rem; font-weight: 800; letter-spacing: -.065em; }
.brand img { border-radius: 9px; }
.brand-dot { color: var(--accent); }
.topbar nav { display: flex; min-height: 47px; align-items: stretch; flex-wrap: wrap; gap: 0 26px; border-top: 1px solid #363636; }
.topbar nav a { display: grid; place-items: center; position: relative; color: #c9c9c9; text-decoration: none; font-size: .94rem; font-weight: 600; }
.topbar nav a[aria-current="page"] { color: white; }
.topbar nav a[aria-current="page"]::after { position: absolute; bottom: 0; height: 3px; inset-inline: 0; content: ""; background: var(--accent); }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border: 1px solid transparent; border-radius: 9px; padding: 0 17px; font-size: .92rem; font-weight: 750; text-align: center; }
.primary { background: var(--accent); color: var(--ink); }
.primary:not(:disabled):hover { background: var(--accent-hover); }
.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.secondary:not(:disabled):hover { background: var(--panel); }
.upload-icon { display: inline-block; position: relative; width: 16px; height: 14px; border: 1.6px solid; border-top: 0; border-radius: 0 0 3px 3px; margin-top: 3px; }
.upload-icon::before { content: ""; position: absolute; width: 7px; height: 7px; border-left: 1.6px solid; border-top: 1.6px solid; transform: rotate(45deg); left: 3px; top: -3px; }
.upload-icon::after { content: ""; position: absolute; width: 1.6px; height: 9px; background: currentColor; left: 5.7px; top: -3px; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 36px; padding-block: 56px 34px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.intro h1 { margin: 0; max-width: 900px; font-size: clamp(2.55rem, 5.4vw, 5.2rem); line-height: .96; font-weight: 830; letter-spacing: -.055em; text-wrap: balance; }
.intro h1 span { color: var(--accent); }
.intro p { margin: 18px 0 0; color: var(--muted); line-height: 1.55; }
.overview { display: grid; grid-template-columns: repeat(3, minmax(74px, 1fr)) minmax(124px, 1.4fr) minmax(76px, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 13px 2px; }
.overview > * { text-align: left; background: transparent; border: 0; padding: 0 9px; display: grid; gap: 5px; align-content: center; }
.overview > * + * { border-left: 1px solid var(--line); }
.overview strong { font-size: 1.9rem; line-height: 1; letter-spacing: -.075em; font-variant-numeric: tabular-nums; }
.overview span { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.overview button:hover span { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.filters { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(135px, 170px) minmax(155px, 215px) minmax(115px, 139px); gap: 10px; }
.search, .select { position: relative; }
.search input, .select select { width: 100%; height: 46px; padding: 0 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; min-width: 0; }
.search input { padding-left: 42px; }
.search-icon { position: absolute; left: 16px; top: 14px; width: 15px; height: 15px; border: 1.6px solid currentColor; border-radius: 50%; color: var(--muted); pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 7px; height: 1.5px; background: currentColor; transform: rotate(48deg); top: 12px; left: 10px; }
.select select { appearance: none; padding-right: 30px; text-overflow: ellipsis; font-size: .92rem; }
.select::after { content: ""; position: absolute; right: 15px; top: 18px; width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); pointer-events: none; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block: 20px 17px; }
.segments { display: flex; flex-wrap: wrap; gap: 5px; }
.segments button { border: 1px solid transparent; border-radius: 20px; padding: 7px 14px; min-height: 40px; background: transparent; color: var(--muted); font-size: .9rem; font-weight: 650; white-space: nowrap; }
.segments button:not([aria-pressed="true"]):hover { border-color: var(--line); background: var(--surface); }
.segments button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.count { margin: 0; color: var(--muted); font-size: .88rem; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 0; text-align: left; width: 100%; overflow: hidden; transition: box-shadow .14s ease, transform .14s ease; }
.card:hover { box-shadow: 0 7px 22px #0002; transform: translateY(-2px); }
.card-media { position: relative; display: grid; overflow: hidden; width: 100%; aspect-ratio: 1.23; background: var(--panel); }
.card-media img { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.badge { position: absolute; top: 10px; left: 10px; max-width: calc(100% - 20px); font-size: .75rem; font-weight: 750; padding: 5px 8px; line-height: 1.2; border-radius: 5px; background: #f5f5f5; color: #383838; }
.badge.stock { background: #e1f3e7; color: #184b2c; }
.badge.review { background: #ffe9b5; color: #5a3b0a; }
.card-body { display: flex; flex: 1; flex-direction: column; gap: 7px; width: 100%; padding: 13px 15px 14px; }
.card-source { color: var(--muted); font-size: .77rem; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; overflow-wrap: anywhere; }
.card-name { font-weight: 770; font-size: 1.07rem; letter-spacing: -.023em; line-height: 1.2; overflow-wrap: anywhere; }
.card-sizes { color: var(--muted); font-size: .85rem; line-height: 1.35; min-height: 1.3em; }
.card-footer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; padding-top: 9px; margin-top: auto; border-top: 1px solid var(--panel); }
.card-price { font-weight: 800; font-size: .98rem; }
.card-units { color: var(--muted); font-size: .78rem; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 42px 20px; text-align: center; }
.empty h2 { margin: 0 0 10px; letter-spacing: -.03em; }
.empty p { margin: 0 0 18px; line-height: 1.4; color: var(--muted); }
.more { display: flex; justify-content: center; padding-top: 26px; }
main { padding-bottom: 52px; }
.notification { padding: 12px 15px; background: #e1f3e7; border: 1px solid #c0e0ca; border-radius: 9px; margin: 0 0 18px; }
.notification.error { background: var(--accent-tint); border-color: #f4c9c9; }

.import-entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.import-entry summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 16px; gap: 7px 20px; cursor: pointer; list-style: none; }
.import-entry summary::-webkit-details-marker { display: none; }
.import-entry summary strong { overflow-wrap: anywhere; }
.import-entry summary span { color: var(--muted); }
.import-entry summary::after { content: "+"; grid-column: 2; grid-row: 1; justify-self: end; font-size: 1.15rem; font-weight: 650; }
.import-entry[open] summary::after { content: "−"; }
.import-entry summary span { grid-column: 1; }
.import-report { padding: 0 16px 16px; }
.report-row { display: grid; grid-template-columns: minmax(100px, .8fr) minmax(140px, 1.2fr); gap: 8px 20px; padding: 10px 0; border-top: 1px solid var(--line); }
.report-row strong { overflow-wrap: anywhere; }
.report-row > span { color: var(--muted); }
.report-details { grid-column: 1 / -1; font-size: .9rem; color: var(--muted); }
.report-details summary { display: list-item; padding: 4px 0; list-style: revert; }
.report-details summary::after { display: none; }
.report-details li { margin: 5px 0; overflow-wrap: anywhere; }

dialog { width: min(600px, 100% - 28px); max-height: min(92dvh, 800px); padding: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #0009; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 20px; position: sticky; top: 0; z-index: 1; background: var(--surface); border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 1.25rem; line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
.close { flex: 0 0 auto; border: 0; color: var(--ink); background: var(--panel); width: 40px; height: 40px; border-radius: 50%; font-size: 1.45rem; line-height: 1; }
.close:hover { background: var(--line); }
.dialog-body { padding: 18px 20px; }
.dialog-body > p:first-child { margin-top: 0; }
.muted { color: var(--muted); line-height: 1.5; }
.dropzone { width: 100%; display: grid; place-items: center; gap: 12px; padding: 22px 12px; margin: 14px 0; border: 1px dashed #a3a3a3; border-radius: 10px; background: var(--paper); }
.dropzone:hover, .dropzone.dragover { background: var(--accent-tint); border-color: var(--accent); }
.dropzone > span:last-child { color: var(--muted); font-size: .88rem; }
.upload-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.upload-list li { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 5px; overflow-wrap: anywhere; }
.upload-list span { color: var(--muted); font-size: .88rem; }
.upload-list progress { height: 9px; width: 100%; accent-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 13px 20px; }
.error { color: #a12626; }
.product-dialog { width: min(820px, 100% - 28px); }
.product-layout { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); gap: 22px; }
.detail-image { width: 100%; max-height: 480px; object-fit: contain; background: var(--panel); border-radius: 10px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs button { border: 2px solid transparent; padding: 2px; border-radius: 8px; background: var(--panel); }
.thumbs button[aria-pressed="true"] { border-color: var(--accent); }
.thumbs img { width: 51px; height: 48px; border-radius: 4px; object-fit: cover; }
.thumbs.layered button { display: grid; gap: 4px; justify-items: center; width: 98px; padding: 3px; font-size: .73rem; font-weight: 650; text-wrap: balance; }
.thumbs.layered img { width: 100%; height: 55px; }
.photo-caption { margin: 8px 0 0; color: var(--muted); font-size: .87rem; }
.warning { border-radius: 9px; background: #fff1cf; padding: 10px 12px; color: #5b3e0e; margin: 0 0 14px; line-height: 1.4; }
.warning p { margin: 0 0 5px; }
.warning p:last-child { margin-bottom: 0; }
.detail-source { margin: 0 0 15px; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; line-height: 1.5; }
.prices { display: grid; margin: 0 0 12px; gap: 6px; }
.prices div { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.prices dt { color: var(--muted); font-size: .92rem; }
.prices dd { margin: 0; font-weight: 780; }
.variant-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.variant-table th, .variant-table td { padding: 7px 3px; border-bottom: 1px solid var(--line); text-align: left; }
.variant-table td:last-child, .variant-table th:last-child { text-align: right; }
.variant-table th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.no-image { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: .86rem; }
.source-details { margin-block: 13px; }
.source-details summary { color: var(--muted); cursor: pointer; padding: 6px 0; }
.source-details ul { margin: 5px 0; padding-left: 18px; font-size: .88rem; overflow-wrap: anywhere; }
.editor { display: grid; gap: 11px; }
.editor label { display: grid; gap: 5px; font-size: .89rem; font-weight: 650; }
.editor input, .editor select, .editor textarea { width: 100%; min-height: 42px; background: white; border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; }
.editor textarea { min-height: 78px; resize: vertical; }
.editor .pair { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.editor fieldset { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.editor legend { color: var(--muted); font-size: .9rem; }
.editor small { color: var(--muted); }
.edit-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.edit-row .close { width: 34px; height: 34px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 7px; }

.draft-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 8px; z-index: 2; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px #0001; padding: 11px 14px; margin-bottom: 17px; }
.draft-bar p { color: var(--muted); font-size: .86rem; margin: 3px 0 0; }
.draft-actions, .row-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.section-actions { margin-bottom: 14px; }
.section-actions:has(button[hidden]) { display: none; }
.import-actions { margin-bottom: 13px; }
.product-list { display: grid; gap: 8px; }
.product-row { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px; }
.row-photo { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; background: var(--panel); }
.product-row .no-image { min-height: 64px; font-size: .7rem; }
.row-info { display: grid; gap: 3px; overflow-wrap: anywhere; }
.row-info .muted, .row-meta { font-size: .84rem; }
.tier-edit { grid-template-columns: 1fr 1fr 1.25fr 34px; }
.access { max-width: 482px; margin-top: clamp(30px, 9vh, 88px); }
.access-card, .settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 4vw, 27px); }
.access-card h1, .settings-card h2 { margin: 0; letter-spacing: -.04em; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.access-card .primary { margin-top: 5px; }
.settings-grid { display: grid; align-items: start; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.settings-card form button { justify-self: start; }
.team-list { padding: 0; margin: 13px 0 0; list-style: none; }
.team-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line); }
.team-list li div { display: grid; overflow-wrap: anywhere; }
.invite-result { margin-top: 15px; }
.invite-result p { margin: 0; }
.shop-intro { grid-template-columns: minmax(0, 1fr); }
.shop-filters { grid-template-columns: minmax(200px,1fr) minmax(145px,220px) minmax(145px,195px); }
.shop-results { margin: 15px 0; white-space: normal; }
.shop-details > p { margin: 0 0 10px; }
.shop-price { font-size: 1.4rem; font-weight: 800; }
.tier-price { font-size: .9rem; }
.product-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.order-form { padding-top: 6px; }
.order-form .primary { justify-self: start; }

@media (max-width: 1050px) {
  .shell { width: calc(100% - 56px); }
  .intro { padding-top: 44px; column-gap: 20px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .admin-header, .shop-header { min-height: 59px; }
  .topbar nav { column-gap: 13px; }
  .topbar nav a { min-height: 42px; }
  .header-actions { gap: 10px; }
  .brand { font-size: 1.42rem; }
  .brand img { width: 32px; height: 32px; }
  .intro { grid-template-columns: 1fr; row-gap: 19px; padding: 27px 0 20px; margin-bottom: 16px; }
  .intro h1 { font-size: clamp(2.2rem, 7.7vw, 4rem); text-wrap: initial; }
  .intro p { margin-top: 10px; font-size: .95rem; }
  .overview { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 0; }
  .overview strong { font-size: 1.7rem; }
  .overview > * { grid-column: span 2; padding: 9px; }
  .overview > :nth-child(n+4) { grid-column: span 3; border-top: 1px solid var(--line); }
  .overview > :nth-child(4) { border-left: 0; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .search { grid-column: 1 / -1; }
  .grid { gap: 10px; }
  .shop-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .settings-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 540px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell { width: calc(100% - 26px); }
  .card-body { padding: 10px; }
  .card-name { font-size: .97rem; }
  .card-sizes { font-size: .79rem; }
  .card-source, .card-units { font-size: .74rem; }
  .badge { left: 7px; top: 7px; font-size: .71rem; }
  .toolbar { margin-block: 13px 12px; gap: 8px; flex-wrap: wrap; }
  .segments { gap: 2px; }
  .segments button { padding-inline: 10px; min-height: 42px; font-size: .85rem; }
  .count { font-size: .8rem; }
  .select select { font-size: .82rem; padding-left: 8px; padding-right: 24px; }
  .select::after { right: 10px; }
  .dialog-header, .dialog-body, .dialog-actions { padding-inline: 14px; }
  .product-layout { grid-template-columns: 1fr; gap: 16px; }
  .detail-image { max-height: 42dvh; }
  .header-actions .secondary { min-height: 36px; padding-inline: 7px; font-size: .78rem; }
  .header-link { font-size: .78rem; }
  .topbar nav a { font-size: .84rem; }
  .draft-bar { flex-wrap: wrap; }
  .product-row { grid-template-columns: 52px minmax(0,1fr); gap: 6px 9px; }
  .row-photo { width: 52px; height: 52px; }
  .product-row .row-actions { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
