:root {
  --bg: #222222;
  --bg-soft: #2c2c2c;
  --text: #f5f5f5;
  --muted: #aaaaaa;
  --accent: #ffd800;
  --brand-secondary: #222222;
  --border: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] {
  --bg: #f4f4f4;
  --bg-soft: #ffffff;
  --text: #1c1c1c;
  --muted: #666666;
  --border: rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: linear-gradient(180deg, #111, var(--bg)); color: var(--text); }
body[data-theme="light"] { background: linear-gradient(180deg, #ffffff, var(--bg)); }
a { color: inherit; }

/* Public catalog theme mapping:
   - background: always white
   - header background: primary color (--accent)
   - buttons + texts: secondary color (--brand-secondary)
   - button text: primary color (--accent)
*/
.public-layout {
  --bg: #ffffff;
  --bg-soft: #ffffff;
  --text: var(--brand-secondary);
  --muted: rgba(34, 34, 34, 0.72);
  --border: rgba(34, 34, 34, 0.16);
  background: #ffffff;
  color: var(--text);
}

.public-layout .public-shell {
  min-height: 100vh;
  background: #ffffff;
}

.public-layout .metric-card,
.public-layout .product-card,
.public-layout .product-detail {
  background: #ffffff;
}

.public-layout .catalog-section-head,
.public-layout .catalog-grid,
.public-layout .metric-card,
.public-layout .product-detail,
.public-layout .public-variation-block {
  width: min(100%, 1040px);
  margin-left: auto;
  margin-right: auto;
}

.public-layout .catalog-section-head,
.public-layout .catalog-grid,
.public-layout .public-variation-block {
  padding-left: 24px;
  padding-right: 24px;
}

.public-layout .catalog-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  justify-content: start;
}

.public-layout .catalog-grid.catalog-grid-single {
  grid-template-columns: minmax(220px, 260px);
  justify-content: start;
  justify-items: center;
}

.public-layout .product-card {
  width: 100%;
  max-width: 260px;
  padding: 16px;
}

.public-layout .product-card h3 {
  margin-top: 0;
}

.public-layout .product-card img,
.public-layout .product-card .product-carousel {
  width: 100%;
}

.public-layout .metric-card {
  max-width: 1040px;
}

.public-layout .product-detail {
  max-width: 1040px;
}

.public-layout .button,
.public-layout .auth-form button,
.public-layout .store-search button {
  background: var(--brand-secondary);
  color: var(--accent);
}

.public-layout .store-header-wrap {
  background: var(--accent);
  border-bottom-color: rgba(0, 0, 0, 0.1);
  backdrop-filter: none;
}

.public-layout .store-brand,
.public-layout .store-brand-name,
.public-layout .store-cart {
  color: var(--brand-secondary);
}

.public-layout .store-cart {
  background: var(--brand-secondary);
  color: var(--accent);
  border-color: transparent;
}

.public-layout .store-search input {
  background: #ffffff;
  color: var(--brand-secondary);
  border-color: rgba(34, 34, 34, 0.2);
}

.public-product-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--brand-secondary);
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.public-product-button:hover {
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.public-product-button-detail {
  width: auto;
  min-width: 220px;
  margin: 0 0 16px;
}
.auth-card, .metric-card, .product-card, .product-detail, .error-page { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px; }
.auth-card { width: min(420px, calc(100vw - 32px)); margin: 10vh auto; padding: 32px; }
.auth-form { display: grid; gap: 16px; }
.auth-form input, .auth-form select, .auth-form textarea { width: 100%; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); background: #181818; color: var(--text); }
.auth-form select { appearance: none; }
.auth-form button, .button { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #111; font-weight: 700; border: 0; border-radius: 10px; padding: 12px 16px; text-decoration: none; cursor: pointer; }
.admin-frame { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #171717; border-right: 1px solid var(--border); padding: 24px; }
body[data-theme="light"] .sidebar { background: #ffffff; }
.brand { font-size: 20px; font-weight: 800; margin-bottom: 24px; }
.menu { display: grid; gap: 8px; }
.menu a, .menu button { padding: 12px 14px; border-radius: 10px; text-decoration: none; color: var(--text); background: transparent; border: 0; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.menu a:hover { background: rgba(255, 216, 0, 0.08); }
.menu button:hover { background: rgba(255, 216, 0, 0.08); }
.admin-content { display: grid; grid-template-rows: auto 1fr; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; background: rgba(0, 0, 0, 0.18); border-bottom: 1px solid var(--border); }
.page-content { padding: 24px; }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.catalog-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
.metric-card, .product-card { padding: 18px; }
.metric-card span, .product-card p { color: var(--muted); }
.landing-hero { padding: 28px 24px; }
.landing-hero { text-align: center; max-width: 860px; margin: 12vh auto; }
.public-footer { text-align: center; padding: 24px 0 40px; color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert-error { background: rgba(255, 80, 80, .12); color: #ffb4b4; }

.products-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
}

.products-main {
  min-width: 0;
}

.products-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.products-toolbar h1 {
  margin: 0;
}

.products-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.resource-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.resource-page-head h1,
.resource-page-head p {
  margin: 0;
}

.resource-page-head p {
  margin-top: 6px;
  color: var(--muted);
}

.resource-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.resource-card {
  display: grid;
  gap: 8px;
}

.resource-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.resource-list-row {
  min-height: 62px;
  padding: 12px 14px;
}

.resource-list-row .product-row-thumb {
  width: 40px;
  height: 40px;
  font-size: 11px;
}

.resource-list-row .product-row-main strong {
  font-size: 16px;
}

.token-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 520px) auto;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--admin-surface));
}

.token-result p {
  margin: 4px 0 0;
  color: var(--admin-muted);
}

.token-result code {
  display: block;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-2);
  color: var(--admin-text);
  overflow: auto;
  white-space: nowrap;
}

.token-row {
  cursor: default;
}

.token-row:hover {
  transform: none;
}

.token-row-meta {
  gap: 7px;
}

.token-permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.token-permissions span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-2);
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.token-permission-grid {
  display: grid;
  gap: 10px;
}

.token-permission-option {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface);
}

.token-permission-option span {
  display: grid;
  gap: 3px;
}

.token-permission-option small {
  color: var(--admin-muted);
  font-weight: 700;
}

.api-docs {
  display: grid;
  gap: 16px;
}

.api-doc-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.10);
}

.api-doc-card h2,
.api-doc-card p {
  margin: 0;
}

.api-doc-card p {
  color: var(--admin-muted);
  line-height: 1.55;
}

.api-doc-card pre {
  margin: 0;
  max-width: 100%;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-bg-deep);
  color: var(--admin-text);
  font-size: 13px;
  line-height: 1.55;
}

.api-doc-card code {
  font-family: Consolas, Monaco, "Courier New", monospace;
}

.api-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.api-doc-grid > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface-2);
}

.api-doc-grid strong {
  display: block;
  margin-bottom: 5px;
}

.api-endpoint-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.api-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.api-method.get { background: rgba(85, 217, 121, 0.14); color: #55d979; }
.api-method.post { background: rgba(255, 216, 0, 0.14); color: #ffd800; }
.api-method.put,
.api-method.patch { background: rgba(86, 156, 255, 0.15); color: #8bbaff; }
.api-method.delete { background: rgba(240, 107, 107, 0.15); color: #f06b6b; }

.dashboard-date-filter {
  display: flex;
  align-items: end;
  gap: 8px;
}

.dashboard-date-filter label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-date-filter input {
  min-height: 42px;
  width: 150px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.product-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.product-row-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.product-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-row-thumb.is-subproduct {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.product-row-children {
  margin: -2px 0 8px 56px;
  display: grid;
  gap: 8px;
}

.product-variation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.015);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.product-row:hover,
.product-variation-row:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 216, 0, 0.35);
}

.product-row-main, .product-row-meta {
  display: grid;
  gap: 4px;
}

.product-row-main span,
.product-row-meta span {
  color: var(--muted);
  font-size: 14px;
}

.product-row-meta {
  justify-items: end;
}

.product-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
  background: rgba(255,255,255,0.06);
}

.status-active { color: #9bffad; }
.status-draft { color: #ffd86b; }
.status-inactive { color: #ff8f8f; }
.status-suspended { color: #ffb86b; }

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.button-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.button-ghost.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.product-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
}

.product-sidebar-action {
  width: 100%;
}

.sidebar-card {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-card p {
  color: var(--muted);
  margin-bottom: 0;
}

.product-modal {
  width: min(1180px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

.product-modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.product-modal-form {
  padding: 20px;
  max-width: none;
}

.product-modal-head,
.product-modal-footer,
.modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-modal-head h2,
.product-modal-head p,
.modal-section-head p {
  margin: 0;
}

.product-modal-head p,
.modal-help,
.modal-image-note,
.modal-section-head p,
.product-modal-footer {
  color: var(--muted);
}

.product-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 18px 0;
}

.modal-section {
  display: grid;
  gap: 12px;
}

.modal-section input,
.modal-section select,
.modal-section textarea,
.product-modal input,
.product-modal select,
.product-modal textarea {
  width: 100%;
}

.modal-image-note {
  font-size: 13px;
}

.product-existing-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.existing-image-thumb {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.existing-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.existing-image-thumb button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.76);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-section-head {
  margin-bottom: 14px;
}

.variation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.variation-actions-bottom {
  margin-top: 12px;
}

.variation-attributes {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.variation-attribute {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  display: grid;
  gap: 10px;
}

.variation-attribute-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.variation-chip-input {
  display: grid;
  gap: 8px;
}

.variation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variation-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 216, 0, 0.10);
  border: 1px solid rgba(255, 216, 0, 0.18);
}

.variation-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.variation-list {
  display: grid;
  gap: 12px;
}

.variation-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.variation-list-item:hover {
  border-color: rgba(255, 216, 0, 0.35);
}

.variation-list-item.is-product-style {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
  border-style: dashed;
}

.variation-item-main,
.variation-item-meta {
  display: grid;
  gap: 4px;
}

.variation-item-meta {
  justify-items: end;
}

.variation-item-main span,
.variation-item-meta span {
  color: var(--muted);
  font-size: 13px;
}

.variation-row {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  display: grid;
  gap: 14px;
}

.variation-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.variation-row-grid {
  display: grid;
  grid-template-columns: 1.1fr .7fr .7fr .55fr auto;
  gap: 10px;
  align-items: start;
}

.variation-images {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.variation-image-option {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}

.variation-image-option img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}

.variation-file-list {
  display: grid;
  gap: 8px;
  width: 100%;
}

.variation-image-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: inherit;
  text-align: left;
}

.variation-image-row.is-selectable {
  cursor: pointer;
}

.variation-image-row.is-selectable:hover {
  border-color: rgba(255, 216, 0, 0.35);
}

.variation-image-row.is-selected {
  border-color: rgba(255, 216, 0, 0.4);
  background: rgba(255,255,255,0.03);
}

.variation-image-row .product-row-left,
.variation-list-item .product-row-left {
  flex: 1 1 auto;
  min-width: 0;
}

.variation-image-row .product-row-thumb,
.variation-image-row .product-row-thumb.is-subproduct {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  border-radius: 8px;
}

.variation-image-row .variation-item-main,
.variation-list-item .product-row-main {
  min-width: 0;
}

.variation-image-row .variation-item-main strong,
.variation-image-row .variation-item-main span,
.variation-list-item .product-row-main strong,
.variation-list-item .product-row-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variation-image-row .variation-item-meta,
.variation-list-item .product-row-meta {
  flex: 0 0 auto;
}

.variation-image-action {
  white-space: nowrap;
}

.variation-image-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.72);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

body[data-theme="light"] .variation-image-remove {
  background: rgba(23, 32, 46, 0.74);
  color: #fff;
}

.variation-image-remove:hover,
.existing-image-thumb button:hover {
  background: #d62e2e;
  border-color: #d62e2e;
  transform: scale(1.04);
}

.variation-edit-modal {
  width: min(980px, calc(100vw - 24px));
}

.product-modal-footer {
  margin-top: 18px;
}

.button-danger {
  background: rgba(214, 46, 46, 0.18);
  color: #ffd7d7;
  border: 1px solid rgba(214, 46, 46, 0.55);
}

.button-danger:hover {
  background: rgba(214, 46, 46, 0.26);
}

dialog::backdrop {
  backdrop-filter: blur(2px);
}

.store-header-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.92), rgba(20, 20, 20, 0.8));
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

body[data-theme="light"] .store-header-wrap {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.88));
}

.store-header {
  width: min(1040px, calc(100vw - 48px));
  margin: 0 auto;
  min-height: 82px;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: minmax(170px, 240px) minmax(300px, 1fr) 64px;
  align-items: center;
  gap: 14px;
}

.store-brand {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  text-decoration: none;
}

.store-logo {
  max-height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}


.public-variation-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.public-variation-block {
  background: #ffffff;
  border: 0;
  border-radius: 12px;
  padding: 12px;
}

.public-variation-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--brand-secondary);
  background: #ffffff;
  color: var(--brand-secondary);
}

.public-variation-option.is-active {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 1px var(--brand-secondary) inset;
}

.public-layout .public-variation-option {
  background: #ffffff;
  color: var(--brand-secondary);
  border-color: var(--brand-secondary);
}

.variation-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.26);
  display: inline-block;
}
.store-brand-name {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.store-search {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 760px;
  justify-self: center;
}

.store-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #171717;
  color: var(--text);
}

body[data-theme="light"] .store-search input {
  background: #ffffff;
}

.store-search button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--accent);
  color: #151515;
  font-weight: 700;
  cursor: pointer;
}

.store-cart {
  justify-self: end;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  text-decoration: none;
}

body[data-theme="light"] .store-cart {
  background: #ffffff;
}

.catalog-section-head {
  padding: 0 24px 12px;
}

.catalog-categories-bar {
  width: 100%;
  margin-top: 0;
  padding: 6px 24px 10px;
  background: color-mix(in srgb, var(--accent) 82%, white 18%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.catalog-categories {
  width: min(100%, 1040px);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-category-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.55);
  color: var(--brand-secondary);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1px;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.catalog-category-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.catalog-category-link:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}

.product-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: block;
}

.product-carousel-large {
  max-width: 560px;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 12px;
}

.product-page-wrap {
  width: min(1200px, calc(100vw - 48px));
  margin: 0 auto 24px;
}

.product-marketplace-layout {
  padding: 20px;
}

.product-marketplace-top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.product-marketplace-media {
  min-width: 0;
}

.product-single-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.product-single-image.is-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.product-marketplace-info h1 {
  margin: 0 0 8px;
}

.product-short-description {
  margin: 0 0 14px;
  color: var(--muted);
}

.product-marketplace-price {
  display: inline-block;
  font-size: 30px;
  margin-bottom: 16px;
}

.variation-block-title {
  display: block;
  margin-bottom: 8px;
}

.product-marketplace-description {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

.product-marketplace-description h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.product-marketplace-description p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.carousel-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 380ms ease;
}

.carousel-image.is-active {
  opacity: 1;
}

@media (max-width: 1200px) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .public-layout .catalog-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  }
}

@media (max-width: 920px) {
  .admin-frame { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; }

  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-layout .catalog-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 250px));
  }

  .store-header {
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 64px;
    gap: 10px;
    padding: 12px 16px;
  }

  .store-brand {
    grid-column: 1;
  }

  .store-cart {
    grid-column: 3;
  }

  .store-search {
    grid-column: 2;
    max-width: 100%;
  }

  .catalog-categories-bar {
    padding: 5px 16px 8px;
  }

  .catalog-categories {
    justify-content: center;
  }

  .product-marketplace-top {
    grid-template-columns: 1fr;
  }

  .product-single-image,
  .product-carousel-large {
    aspect-ratio: 1 / 1;
    height: auto;
    max-width: 100%;
  }

  .variation-row-grid {
    grid-template-columns: 1fr;
  }

  .product-sidebar {
    position: static;
  }
}

@media (max-width: 620px) {
  .store-header {
    grid-template-columns: minmax(120px, 1fr) minmax(0, 1.2fr) 44px;
  }

  .store-search {
    grid-column: 2;
  }

  .store-brand {
    grid-column: 1;
  }

  .store-cart {
    grid-column: 3;
  }

  .store-brand-name {
    font-size: 20px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .public-layout .catalog-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-carousel-large {
    max-width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .product-page-wrap {
    width: min(1200px, calc(100vw - 24px));
  }

  .product-marketplace-layout {
    padding: 14px;
  }
}

/* Public catalog responsive header and grid */
.public-layout .store-search-toggle {
  display: none;
}

.public-layout .store-search button svg {
  display: none;
}

.public-layout .catalog-category-link.is-active {
  background: var(--brand-secondary);
  color: var(--accent);
  border-color: var(--brand-secondary);
}

.public-layout .catalog-categories-dropdown {
  display: none;
}

@media (max-width: 760px) {
  .public-layout .store-header-wrap {
    position: sticky;
    top: 0;
  }

  .public-layout .store-header {
    width: 100%;
    min-height: 66px;
    padding: 10px 14px;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    gap: 8px;
  }

  .public-layout .store-brand {
    grid-column: 1;
    min-width: 0;
    overflow: hidden;
  }

  .public-layout .store-logo {
    max-width: min(190px, 52vw);
    max-height: 42px;
  }

  .public-layout .store-brand-name {
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 20px;
  }

  .public-layout .store-search-toggle,
  .public-layout .store-cart {
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(34, 34, 34, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-secondary);
    color: var(--accent);
    cursor: pointer;
  }

  .public-layout .store-search-toggle {
    grid-column: 2;
  }

  .public-layout .store-cart {
    grid-column: 3;
  }

  .public-layout .store-search {
    position: absolute;
    left: auto;
    right: 58px;
    top: calc(100% + 8px);
    z-index: 40;
    display: none;
    width: min(320px, calc(100vw - 84px));
    max-width: 320px;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 8px;
    border: 1px solid rgba(34, 34, 34, 0.14);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  }

  .public-layout .store-search::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 16px;
    width: 12px;
    height: 12px;
    border-left: 1px solid rgba(34, 34, 34, 0.14);
    border-top: 1px solid rgba(34, 34, 34, 0.14);
    background: #ffffff;
    transform: rotate(45deg);
  }

  .public-layout .store-search.is-open {
    display: grid;
  }

  .public-layout .store-search input {
    min-height: 44px;
    padding-right: 44px;
    border-radius: 10px;
  }

  .public-layout .store-search button {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 38px;
    min-height: 44px;
    padding: 0;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: var(--brand-secondary);
    box-shadow: none;
  }

  .public-layout .store-search button:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
  }

  .public-layout .store-search button span {
    display: none;
  }

  .public-layout .store-search button svg {
    display: block;
  }

  .public-layout .catalog-categories-bar {
    padding: 8px 14px 10px;
    background: color-mix(in srgb, var(--accent) 86%, white 14%);
  }

  .public-layout .catalog-categories-desktop {
    display: none;
  }

  .public-layout .catalog-categories-dropdown {
    position: relative;
    display: block;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
  }

  .public-layout .catalog-categories-dropdown summary {
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(34, 34, 34, 0.18);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #ffffff;
    color: var(--brand-secondary);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
  }

  .public-layout .catalog-categories-dropdown summary::-webkit-details-marker {
    display: none;
  }

  .public-layout .catalog-categories-dropdown[open] summary svg {
    transform: rotate(180deg);
  }

  .public-layout .catalog-category-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    max-height: min(360px, 58vh);
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(34, 34, 34, 0.14);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
  }

  .public-layout .catalog-category-menu a {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--brand-secondary);
    text-decoration: none;
    font-weight: 750;
  }

  .public-layout .catalog-category-menu a:hover,
  .public-layout .catalog-category-menu a.is-active {
    background: color-mix(in srgb, var(--accent) 28%, white 72%);
  }

  .public-layout .catalog-grid,
  .public-layout .catalog-grid.catalog-grid-single {
    width: 100%;
    grid-template-columns: 1fr;
    justify-content: stretch;
    justify-items: stretch;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .public-layout .product-card {
    max-width: none;
    width: 100%;
  }
}

/* Internal admin panel */
.admin-layout {
  --admin-bg: #111318;
  --admin-bg-deep: #0c0e12;
  --admin-surface: #181b22;
  --admin-surface-2: #202530;
  --admin-surface-3: #262c38;
  --admin-text: #f8fafc;
  --admin-muted: #aeb7c7;
  --admin-border: rgba(226, 232, 240, 0.14);
  --admin-border-strong: rgba(255, 216, 0, 0.38);
  --admin-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --admin-hover: rgba(255, 216, 0, 0.11);
  --admin-danger: #ff6b6b;
  --bg: var(--admin-bg);
  --bg-soft: var(--admin-surface);
  --text: var(--admin-text);
  --muted: var(--admin-muted);
  --border: var(--admin-border);
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 216, 0, 0.12), transparent 32rem),
    linear-gradient(145deg, var(--admin-bg-deep), var(--admin-bg) 46%, #151923);
  color: var(--admin-text);
}

.admin-layout[data-theme="light"] {
  --admin-bg: #eef2f7;
  --admin-bg-deep: #dfe6f0;
  --admin-surface: #ffffff;
  --admin-surface-2: #f7f9fc;
  --admin-surface-3: #edf2f8;
  --admin-text: #17202e;
  --admin-muted: #5f6f84;
  --admin-border: rgba(23, 32, 46, 0.13);
  --admin-border-strong: rgba(198, 162, 0, 0.48);
  --admin-shadow: 0 22px 54px rgba(24, 38, 60, 0.13);
  --admin-hover: rgba(255, 216, 0, 0.22);
  background:
    radial-gradient(circle at top left, rgba(255, 216, 0, 0.22), transparent 30rem),
    linear-gradient(145deg, #ffffff, var(--admin-bg) 54%, #e6edf6);
}

.admin-layout a,
.admin-layout button,
.admin-layout input,
.admin-layout select,
.admin-layout textarea,
.admin-layout summary {
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.admin-layout button,
.admin-layout summary {
  font: inherit;
}

.admin-frame {
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 18px;
  background: color-mix(in srgb, var(--admin-surface) 88%, #000 12%);
  border-right: 1px solid var(--admin-border);
  box-shadow: 18px 0 44px rgba(0, 0, 0, 0.16);
}

.admin-layout[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 18px 0 44px rgba(24, 38, 60, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 22px;
  padding: 8px;
  color: var(--admin-text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: #151515;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(255, 216, 0, 0.18);
}

.menu {
  gap: 6px;
}

.menu a,
.menu button {
  position: relative;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--admin-muted);
  font-weight: 700;
}

.menu a:hover,
.menu button:hover,
.menu a.is-active {
  background: var(--admin-hover);
  border-color: var(--admin-border-strong);
  color: var(--admin-text);
  transform: translateX(2px);
}

.menu a.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.menu-logout {
  margin-top: 8px;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-footer .theme-toggle,
.sidebar-footer form,
.sidebar-footer .menu-logout {
  width: 100%;
}

.admin-content {
  min-width: 0;
}

.admin-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(3, 7, 18, 0.62);
  backdrop-filter: blur(4px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 72px;
  padding: 16px 28px;
  background: color-mix(in srgb, var(--admin-bg) 82%, transparent);
  border-bottom: 1px solid var(--admin-border);
  backdrop-filter: blur(16px);
}

.admin-menu-toggle,
.product-sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-text);
  cursor: pointer;
  font-weight: 800;
}

.admin-menu-toggle span,
.product-sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.product-sidebar-toggle {
  background: var(--accent);
  border-color: transparent;
  color: #151515;
  box-shadow: 0 10px 22px rgba(255, 216, 0, 0.13);
}

.admin-menu-toggle:hover,
.product-sidebar-toggle:hover {
  background: var(--admin-hover);
  border-color: var(--admin-border-strong);
}

.product-sidebar-toggle:hover {
  background: color-mix(in srgb, var(--accent) 84%, #ffffff 16%);
  border-color: transparent;
}

.topbar-user {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--admin-muted);
}

.topbar-user strong {
  color: var(--admin-text);
}

.theme-toggle {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-text);
  cursor: pointer;
  font-weight: 800;
}

.theme-toggle:hover,
.button-ghost:hover {
  background: var(--admin-hover);
  border-color: var(--admin-border-strong);
  transform: translateY(-1px);
}

.page-content {
  width: min(1480px, 100%);
  padding: 30px;
}

.page-content-wide {
  width: 100%;
  max-width: none;
}

.page-content > h1,
.products-toolbar h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.1;
}

.panel-card,
.metric-card,
.sidebar-card,
.product-row,
.product-variation-row,
.variation-row,
.variation-attribute,
.variation-list-item,
.variation-image-row,
.variation-image-option {
  background: color-mix(in srgb, var(--admin-surface) 94%, white 6%);
  border: 1px solid var(--admin-border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.10);
}

.admin-layout[data-theme="light"] .panel-card,
.admin-layout[data-theme="light"] .metric-card,
.admin-layout[data-theme="light"] .sidebar-card,
.admin-layout[data-theme="light"] .product-row,
.admin-layout[data-theme="light"] .product-variation-row,
.admin-layout[data-theme="light"] .variation-row,
.admin-layout[data-theme="light"] .variation-attribute,
.admin-layout[data-theme="light"] .variation-list-item,
.admin-layout[data-theme="light"] .variation-image-row,
.admin-layout[data-theme="light"] .variation-image-option {
  background: var(--admin-surface);
  box-shadow: 0 12px 28px rgba(24, 38, 60, 0.08);
}

.panel-card {
  border-radius: 8px;
}

.metric-card,
.sidebar-card {
  border-radius: 8px;
  padding: 20px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
}

.metric-card:hover,
.sidebar-card:hover {
  border-color: var(--admin-border-strong);
  transform: translateY(-2px);
}

.metric-card span,
.metric-card p,
.sidebar-card p,
.products-toolbar p {
  color: var(--admin-muted);
  line-height: 1.55;
}

.metric-card strong {
  font-size: 20px;
  line-height: 1.2;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.auth-form {
  gap: 15px;
}

.auth-form label,
.modal-section label {
  display: grid;
  gap: 8px;
  color: var(--admin-muted);
  font-size: 14px;
  font-weight: 700;
}

.auth-form input,
.auth-form select,
.auth-form textarea,
.dashboard-date-filter input,
.modal-section input,
.modal-section select,
.modal-section textarea,
.product-modal input,
.product-modal select,
.product-modal textarea {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface-2);
  color: var(--admin-text);
  outline: none;
}

.auth-form textarea,
.modal-section textarea,
.product-modal textarea {
  min-height: 118px;
  resize: vertical;
}

.auth-form input:hover,
.auth-form select:hover,
.auth-form textarea:hover,
.modal-section input:hover,
.modal-section select:hover,
.modal-section textarea:hover {
  border-color: color-mix(in srgb, var(--admin-border-strong) 70%, var(--admin-border));
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus,
.modal-section input:focus,
.modal-section select:focus,
.modal-section textarea:focus,
.product-modal input:focus,
.product-modal select:focus,
.product-modal textarea:focus {
  border-color: var(--admin-border-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.auth-form input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.auth-form input[type="color"] {
  cursor: pointer;
}

.auth-form button,
.button,
.admin-layout form button[type="submit"] {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #151515;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(255, 216, 0, 0.13);
}

.auth-form button:hover,
.button:hover,
.admin-layout form button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(255, 216, 0, 0.2);
  filter: saturate(1.04);
}

.menu form button[type="submit"],
.sidebar-footer form button[type="submit"] {
  background: transparent;
  color: var(--admin-muted);
  box-shadow: none;
}

.menu form button[type="submit"]:hover,
.sidebar-footer form button[type="submit"]:hover {
  background: color-mix(in srgb, var(--admin-danger) 13%, transparent);
  border-color: color-mix(in srgb, var(--admin-danger) 45%, transparent);
  color: var(--admin-text);
  box-shadow: none;
}

.sidebar-footer .theme-toggle {
  background: transparent;
  color: var(--admin-muted);
  box-shadow: none;
}

.sidebar-footer .theme-toggle:hover {
  background: var(--admin-hover);
  border-color: var(--admin-border-strong);
  color: var(--admin-text);
  box-shadow: none;
}

.button-ghost {
  background: var(--admin-surface-2);
  border-color: var(--admin-border);
  color: var(--admin-text);
  box-shadow: none;
}

.button-danger {
  background: color-mix(in srgb, var(--admin-danger) 18%, var(--admin-surface));
  color: #ffe8e8;
  border-color: color-mix(in srgb, var(--admin-danger) 58%, transparent);
  box-shadow: none;
}

.admin-layout[data-theme="light"] .button-danger {
  color: #8f1f1f;
}

.alert {
  border: 1px solid var(--admin-border);
  border-radius: 8px;
}

.products-shell {
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
}

.products-toolbar {
  min-height: 60px;
  margin-bottom: 20px;
}

.products-toolbar-actions,
.product-sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.products-toolbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.product-sidebar-head {
  display: none;
}

.product-row {
  border-radius: 8px;
  min-height: 78px;
  background: var(--admin-surface);
}

.product-row:hover,
.product-variation-row:hover,
.variation-list-item:hover,
.variation-image-row.is-selectable:hover {
  background: color-mix(in srgb, var(--admin-surface) 84%, var(--accent) 16%);
  border-color: var(--admin-border-strong);
  box-shadow: var(--admin-shadow);
  transform: translateY(-2px);
}

.admin-layout .token-row:hover {
  background: var(--admin-surface);
  border-color: var(--admin-border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.10);
  transform: none;
}

.product-row-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--admin-surface-3);
}

.product-row-thumb.is-subproduct {
  width: 40px;
  height: 40px;
}

.product-row-main strong,
.variation-item-main strong {
  color: var(--admin-text);
}

.product-status {
  min-width: 78px;
  border: 1px solid currentColor;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-weight: 800;
}

.status-active { color: #55d979; }
.status-draft { color: #d7a700; }
.status-inactive { color: #f06b6b; }
.status-suspended { color: #d98b31; }

.product-sidebar {
  top: 94px;
}

.product-modal {
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border-strong);
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
}

.product-modal::backdrop,
dialog::backdrop {
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(5px);
}

.product-modal-form {
  padding: 24px;
}

.product-modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -24px -24px 18px;
  padding: 22px 24px;
  background: color-mix(in srgb, var(--admin-surface) 90%, transparent);
  border-bottom: 1px solid var(--admin-border);
  backdrop-filter: blur(14px);
}

.product-modal-head h2 {
  line-height: 1.1;
}

.product-modal-grid {
  gap: 20px;
}

.modal-section,
.modal-variation-builder {
  padding: 18px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface-2);
}

.modal-section-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
}

.variation-chip {
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 18%, var(--admin-surface));
  color: var(--admin-text);
}

.variation-list-item,
.variation-row,
.variation-attribute,
.variation-image-row,
.product-variation-row {
  border-radius: 8px;
}

.existing-image-thumb {
  border-radius: 8px;
  background: var(--admin-surface-3);
}

.product-modal-footer {
  position: sticky;
  bottom: 0;
  margin: 18px -24px -24px;
  padding: 18px 24px;
  background: color-mix(in srgb, var(--admin-surface) 92%, transparent);
  border-top: 1px solid var(--admin-border);
  backdrop-filter: blur(14px);
}

.admin-layout details {
  border-top: 1px solid var(--admin-border);
  padding-top: 12px;
}

.admin-layout summary {
  width: fit-content;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--accent);
  font-weight: 800;
}

.admin-layout summary:hover {
  background: var(--admin-hover);
}

@media (max-width: 1100px) {
  body.is-admin-menu-open,
  body.is-product-sidebar-open {
    overflow: hidden;
  }

  .product-modal-grid {
    grid-template-columns: 1fr;
  }

  .products-shell {
    grid-template-columns: 1fr;
  }

  .product-sidebar-toggle,
  .product-sidebar-head {
    display: flex;
  }

  .product-sidebar-toggle {
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
  }

  .product-sidebar-head {
    justify-content: space-between;
  }

  .product-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 30;
    width: min(340px, calc(100vw - 52px));
    height: 100vh;
    padding: 18px;
    overflow: auto;
    align-content: start;
    align-items: start;
    background: var(--admin-surface);
    border-left: 1px solid var(--admin-border-strong);
    box-shadow: -18px 0 44px rgba(0, 0, 0, 0.24);
    transform: translateX(105%);
    transition: transform 180ms ease;
  }

  .product-sidebar .button,
  .product-sidebar-action {
    width: auto;
    min-height: 42px;
    height: auto;
    padding: 10px 14px;
    line-height: 1.2;
    white-space: nowrap;
    align-self: start;
    justify-self: start;
  }

  .product-sidebar .sidebar-card {
    width: 100%;
    min-height: 0;
    padding: 16px;
  }

  body.is-product-sidebar-open .product-sidebar {
    transform: translateX(0);
  }
}

@media (max-width: 920px) {
  .admin-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    width: min(300px, calc(100vw - 52px));
    height: 100vh;
    padding: 18px;
    overflow: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.is-admin-menu-open .sidebar {
    transform: translateX(0);
  }

  .menu {
    grid-template-columns: 1fr;
  }

  .menu a:hover,
  .menu button:hover,
  .menu a.is-active {
    transform: translateY(-1px);
  }

  .menu a.is-active::before {
    display: none;
  }

  .topbar {
    top: 0;
    padding: 14px 18px;
    gap: 10px;
  }

  .admin-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
  }

  .page-content {
    padding: 20px;
  }

  .admin-layout .auth-form > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .page-content {
    padding: 16px;
  }

  .resource-page-head,
  .token-result,
  .product-row,
  .product-variation-row,
  .variation-list-item,
  .product-modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-head-actions {
    justify-content: stretch;
  }

  .resource-head-actions .button {
    width: 100%;
  }

  .token-result {
    grid-template-columns: 1fr;
  }

  .products-toolbar-actions {
    justify-content: flex-end;
  }

  .dashboard-date-filter {
    align-items: end;
    flex-wrap: wrap;
  }

  .products-toolbar {
    align-items: flex-start;
  }

  .product-row-meta,
  .variation-item-meta {
    justify-items: start;
  }

  .product-row-left {
    align-items: flex-start;
  }

  .existing-image-thumb {
    width: 96px;
    height: 96px;
  }

  .variation-image-row .product-row-thumb,
  .variation-image-row .product-row-thumb.is-subproduct {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
  }

  .product-modal {
    width: calc(100vw - 16px);
  }

  .product-modal-form {
    padding: 18px;
  }

  .product-modal-head {
    margin: -18px -18px 16px;
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .product-modal-footer {
    margin: 16px -18px -18px;
    padding: 16px 18px;
  }
}
