:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --bg-2: #fdf7ef;
  --surface: #ffffff;
  --surface-2: #f5f2ec;
  --card: #ffffff;
  --text: #1e1a16;
  --muted: #6d5f54;
  --accent: #ffb347;
  --accent-2: #ff6b6b;
  --accent-3: #60a5fa;
  --accent-4: #f472b6;
  --danger: #f07b6c;
  --line: #e6dccf;
  --shadow: 0 18px 40px rgba(28, 24, 20, 0.12);
  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 8px;
  --glass: rgba(255, 255, 255, 0.82);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 8% 12%, rgba(255, 214, 165, 0.45), transparent 42%),
    radial-gradient(circle at 92% 10%, rgba(94, 234, 212, 0.28), transparent 46%),
    radial-gradient(circle at 20% 88%, rgba(255, 163, 196, 0.32), transparent 50%),
    radial-gradient(circle at 84% 78%, rgba(251, 191, 36, 0.25), transparent 52%),
    linear-gradient(160deg, #fff7f0 0%, #f3fbff 55%, #fff1f7 100%);
  background-size: 140% 140%;
  animation: auroraShift 18s ease-in-out infinite;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
      120deg,
      rgba(0, 0, 0, 0.03) 0,
      rgba(0, 0, 0, 0.03) 1px,
      transparent 1px,
      transparent 16px
    );
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
  animation: shimmerGrid 14s linear infinite;
  background-size: 260% 260%;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 70% 60%, rgba(56, 189, 248, 0.14), transparent 55%),
    radial-gradient(circle at 30% 30%, rgba(251, 191, 36, 0.14), transparent 60%);
  opacity: 0.4;
  pointer-events: none;
  z-index: -1;
  animation: orbFloat 20s ease-in-out infinite;
}

h1,
h2,
h3,
h4 {
  font-family: "Cormorant Garamond", serif;
  margin: 0 0 0.6rem;
  letter-spacing: 0.01em;
}

p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(253, 247, 239, 0.86));
  border-bottom: 1px solid rgba(255, 179, 71, 0.22);
  backdrop-filter: blur(18px);
}

.app-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #ffb347, #60a5fa);
  font-weight: 700;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.logo-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
}

.logo-sub {
  font-size: 0.75rem;
  color: var(--muted);
  display: none;
}

.nav-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  overflow: visible;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 179, 71, 0.2);
  max-width: 100%;
}

.nav-chips::-webkit-scrollbar {
  height: 4px;
}

.nav-chips::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.chip {
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 179, 71, 0.08);
  border: 1px solid transparent;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.admin-nav .chip {
  font-size: 0.78rem;
}

.chip:hover,
.chip.active {
  border-color: rgba(255, 179, 71, 0.5);
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.25), rgba(244, 114, 182, 0.18));
}

.actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-shell {
  display: grid;
  gap: 1.5rem;
}

.admin-quick .admin-link {
  display: grid;
  gap: 0.4rem;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.admin-quick .admin-link:hover {
  border-color: rgba(242, 180, 81, 0.4);
  transform: translateY(-2px);
}

.admin-panel {
  display: grid;
  gap: 1rem;
}

.admin-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
  max-height: 60vh;
  overflow: auto;
  padding-right: 0.25rem;
}

.admin-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.admin-item.active {
  border-color: rgba(242, 180, 81, 0.6);
}

.admin-item-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface);
  display: grid;
  place-items: center;
}

.admin-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-item-body {
  display: grid;
  gap: 0.25rem;
}

.admin-item-title {
  font-weight: 600;
}

.admin-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.admin-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.admin-item-actions .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.checkbox-row input {
  margin: 0;
}

@media (max-width: 560px) {
  .admin-item {
    grid-template-columns: 48px 1fr;
  }

  .admin-item-thumb {
    width: 48px;
    height: 48px;
  }

  .admin-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

.search {
  position: relative;
}

.search input {
  padding: 0.65rem 2.6rem 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-width: 160px;
  width: min(220px, 70vw);
}

.search span {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.8rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
  background: linear-gradient(135deg, #ffb347, #ff6b6b);
  color: #1c150c;
  box-shadow: 0 16px 32px rgba(255, 179, 71, 0.22);
}

.btn.secondary {
  background: linear-gradient(135deg, #60a5fa, #f472b6);
  color: #0f1017;
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 179, 71, 0.2);
  color: var(--text);
}

.btn.small {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1rem 5.2rem;
}

.section {
  margin: 1.8rem 0;
  padding: 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 179, 71, 0.14);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 240, 224, 0.85));
  box-shadow: 0 14px 26px rgba(28, 24, 20, 0.12);
  backdrop-filter: blur(6px);
}

.section + .section {
  padding-top: 0;
  border-top: none;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.section-header .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.38), var(--line));
}

.hero {
  padding: 1.6rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    140deg,
    rgba(255, 235, 205, 0.9),
    rgba(255, 247, 239, 0.98)
  );
  border: 1px solid rgba(255, 179, 71, 0.28);
  box-shadow: var(--shadow);
  display: grid;
  gap: 1.2rem;
  position: relative;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(0px);
  opacity: 0.7;
  pointer-events: none;
}

.hero::before {
  width: 180px;
  height: 180px;
  right: -60px;
  top: -60px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.4), transparent 70%);
}

.hero::after {
  width: 200px;
  height: 200px;
  left: -80px;
  bottom: -80px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.35), transparent 70%);
}

.hero h1 {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hero-grid {
  display: grid;
  gap: 1rem;
}

.hero-search {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hero-note {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.home-auto-import-panel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.home-auto-import-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.home-auto-import-status.success {
  color: #7ddc9c;
}

.home-auto-import-status.error {
  color: var(--danger);
}

.hero-search input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 71, 0.25);
  background: rgba(255, 255, 255, 0.9);
}

.stat-grid {
  display: grid;
  gap: 0.8rem;
}

.stat-card {
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 179, 71, 0.18);
  background: linear-gradient(160deg, rgba(255, 250, 244, 0.95), rgba(255, 244, 232, 0.92));
}

.stat-card strong {
  font-size: 1.2rem;
}

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 239, 0.95));
  border-radius: var(--radius);
  padding: 0.95rem;
  border: 1px solid rgba(255, 179, 71, 0.14);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  animation: floatUp 0.6s ease both;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 60%;
  background: radial-gradient(circle, rgba(255, 214, 165, 0.45), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translateY(12px);
  pointer-events: none;
}

.card:hover::after {
  opacity: 0.45;
  transform: translateY(0);
}

.card.soft {
  background: rgba(255, 179, 71, 0.08);
}

.card.outline {
  background: transparent;
  border: 1px dashed rgba(243, 197, 107, 0.35);
}

.sync-warning {
  margin: 0.85rem 0 0;
  padding: 0.85rem 0.95rem;
  border-left: 4px solid rgba(255, 143, 0, 0.85);
  background: linear-gradient(120deg, rgba(255, 245, 225, 0.9), rgba(255, 255, 255, 0.92));
  color: #5b3a0d;
  line-height: 1.4;
  font-size: 0.95rem;
}

.sync-warning strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.flow-grid {
  display: grid;
  gap: 0.9rem;
}

.guide-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.guide-card {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 179, 71, 0.18);
  background: linear-gradient(160deg, rgba(255, 251, 245, 0.95), rgba(255, 245, 233, 0.92));
  overflow: hidden;
}

.guide-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  font-weight: 600;
}

.guide-card summary::-webkit-details-marker {
  display: none;
}

.guide-card[open] summary {
  border-bottom: 1px solid rgba(255, 179, 71, 0.18);
}

.guide-card p {
  margin: 0;
  padding: 0 1rem 0.85rem;
  color: var(--muted);
}

  letter-spacing: 0.05em;
}

.sync-metadata {
  font-size: 0.8rem;
  opacity: 0.75;
  text-align: center;
}


.guide-step {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #1c150c;
  background: var(--accent);
}

.flow-step {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 179, 71, 0.18);
  background: rgba(255, 255, 255, 0.9);
}

.flow-step .step-index {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: #1c150c;
  background: linear-gradient(135deg, var(--accent), var(--accent-4));
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(96, 165, 250, 0.18);
  color: var(--accent-3);
}

.hidden {
  display: none !important;
}

.grid-2 {
  display: grid;
  gap: 0.9rem;
}

.grid-3 {
  display: grid;
  gap: 0.9rem;
}

.status-summary-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-insight-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.admin-insight-card strong {
  font-size: 1.6rem;
  line-height: 1.2;
}

.admin-insight-card p {
  margin: 0;
  font-weight: 600;
}

.admin-insight-card .hint {
  font-size: 0.75rem;
  color: var(--muted);
}

#productThumbs {
  grid-template-columns: repeat(3, 1fr);
}

#productThumbs .card {
  padding: 0;
  border-radius: var(--radius-sm);
}

#productMain {
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 240px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

#productMain img {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
}

.thumb {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.active {
  border-color: rgba(255, 179, 71, 0.6);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(96, 165, 250, 0.18);
  color: var(--accent-3);
}

.badge.orange {
  background: rgba(255, 179, 71, 0.2);
  color: var(--accent);
}

.badge.red {
  background: rgba(240, 123, 108, 0.15);
  color: var(--danger);
}

.tag {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 71, 0.16);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 179, 71, 0.08);
}

.feature-card {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 179, 71, 0.18);
  background: linear-gradient(150deg, rgba(255, 252, 246, 0.95), rgba(255, 245, 233, 0.92));
}

.feature-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.35), rgba(96, 165, 250, 0.3));
  color: #1e1a16;
  font-weight: 700;
}

.product-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-grid[data-view="compact"] {
  gap: 0.4rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-grid[data-view="list"] {
  grid-template-columns: 1fr;
}

.product-card {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 0;
  aspect-ratio: 1 / 1;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 25px 40px rgba(6, 15, 50, 0.25);
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 40px 65px rgba(6, 15, 50, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.product-card.is-wish {
  border-color: rgba(255, 179, 71, 0.55);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.4);
}

.wish-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 71, 0.2);
  background: rgba(255, 255, 255, 0.95);
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: calc(var(--radius) * 0.8);
  overflow: hidden;
  background: linear-gradient(140deg, rgba(242, 180, 81, 0.3), rgba(82, 192, 169, 0.2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.product-image-inner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, filter 0.6s ease;
  filter: saturate(0.9);
}

.product-card:hover .product-image-inner {
  transform: scale(1.04);
  filter: saturate(1.2) brightness(1.05);
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.product-card:hover::before {
  opacity: 1;
}

.product-highlight-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.4));
  color: #1d1d1d;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.product-image-gloss {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
  pointer-events: none;
}

.product-meta-overlay {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  padding: 0.45rem 0.6rem;
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(18px);
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: center;
}

.product-meta-overlay .product-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-meta-overlay .price {
  font-size: 0.85rem;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.8);
}

.product-meta-overlay .price-main {
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}

.wish-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.wish-btn.active {
  color: var(--accent-2);
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.14);
}

.product-meta {
  display: grid;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid rgba(255, 179, 71, 0.18);
  background: rgba(255, 255, 255, 0.92);
}

.product-title {
  margin: 0;
  font-size: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.product-card:hover,
.product-card:focus {
  border-color: rgba(255, 179, 71, 0.45);
  box-shadow: var(--shadow);
  transform: translateY(-4px) scale(1.01);
}

.product-card:focus {
  outline: 2px solid rgba(255, 179, 71, 0.35);
  outline-offset: 2px;
}

.product-grid[data-view="list"] .product-card {
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
}

.product-grid[data-view="list"] .product-meta {
  padding: 0;
  border-top: none;
  background: transparent;
}

.product-grid[data-view="grid"] .product-thumb,
.product-grid[data-view="compact"] .product-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.product-grid[data-view="grid"] .product-meta,
.product-grid[data-view="compact"] .product-meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.45rem 0.45rem 0.8rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.85) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  text-align: center;
}

.product-meta .product-desc,
.product-meta .product-tags {
  display: none;
}

.product-meta .price span:not(:first-child) {
  display: none;
}

.product-thumb {
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: var(--radius-sm);
  background: linear-gradient(140deg, rgba(242, 180, 81, 0.3), rgba(82, 192, 169, 0.2));
  overflow: hidden;
}

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

.product-grid[data-view="list"] .product-thumb {
  position: static;
  width: 110px;
  height: 110px;
}

.product-compact-layout {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.product-compact-thumb {
  position: relative;
  flex: 0 0 95px;
  height: 95px;
  border-radius: calc(var(--radius) * 0.8);
  background-size: cover;
  background-position: center;
  filter: brightness(0.85);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.product-compact-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.35), transparent 60%);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.product-compact-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45));
}

.product-compact-badge {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: absolute;
  bottom: 0.35rem;
  left: 0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.product-compact-meta {
  flex: 1;
  min-width: 0;
}

.product-compact-meta .product-title {
  font-size: 1.05rem;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.empty-state {
  text-align: center;
  color: var(--muted);
}

@media (min-width: 720px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .product-grid[data-view="compact"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (min-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-grid[data-view="compact"] {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.price {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
}

.price strong {
  font-size: 1rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 0.9rem;
  align-items: center;
}

.cart-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-thumb-fallback {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--muted);
}

.cart-info {
  display: grid;
  gap: 0.6rem;
}

.stepper {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.step {
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.step.active {
  color: var(--accent);
  border-color: rgba(242, 180, 81, 0.5);
  background: rgba(242, 180, 81, 0.08);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label {
  font-weight: 600;
  font-size: 0.85rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.image-preview {
  height: 120px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.85rem;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  width: 100%;
}

.image-stack img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.panel,
.filter-panel {
  padding: 0.85rem 0.95rem;
}

.panel.compact {
  padding: 0.6rem 0.75rem;
}

.panel summary,
.filter-panel summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text);
}

.panel summary::-webkit-details-marker,
.filter-panel summary::-webkit-details-marker {
  display: none;
}

.panel summary::after,
.filter-panel summary::after {
  content: "+";
  font-weight: 700;
  color: var(--accent);
}

.panel[open] summary::after,
.filter-panel[open] summary::after {
  content: "−";
}

.panel > .form-grid,
.filter-panel > .form-grid,
.panel > .panel-body {
  margin-top: 0.85rem;
}

.panel.compact > .form-grid,
.panel.compact > .panel-body {
  margin-top: 0.6rem;
}

.panel.compact summary {
  font-size: 0.85rem;
}

.filter-panel summary {
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.2rem;
  position: relative;
  padding-right: 1.6rem;
}

.filter-panel summary::after {
  position: absolute;
  right: 0;
  top: 0.1rem;
}

.filter-panel .summary-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.filter-panel .summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.filter-panel .summary-dot {
  opacity: 0.4;
}

.filter-actions {
  margin-top: 0.6rem;
  display: flex;
  justify-content: flex-end;
}

.filter-status {
  margin-top: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.1rem;
}

.filter-status.success {
  color: #0d6e43;
}

.filter-status.error {
  color: #c94c4c;
}

@media (min-width: 640px) {
  .filter-panel .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .filter-panel .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.panel.compact .form-grid {
  gap: 0.6rem;
}

.panel.compact .field label {
  font-size: 0.75rem;
}

.panel.compact .field input,
.panel.compact .field select {
  padding: 0.55rem 0.7rem;
}

.panel.compact .segment button {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
}

.segment {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.segment button {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.segment button.active {
  border-color: rgba(242, 180, 81, 0.6);
  color: var(--accent);
}

.segment button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.auto-import-controls {
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-start;
}

.auto-import-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.2rem;
}

.log-panel {
  width: 100%;
  min-height: 140px;
  margin: 0;
  font-family: "Plus Jakarta Sans", "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 19, 32, 0.85);
  color: #d7ddea;
  padding: 0.9rem;
  overflow: auto;
}

.helper {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.status {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}

.status.orange {
  color: var(--accent);
}

.status.green {
  color: #7ddc9c;
}

.status.red {
  color: var(--danger);
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(240, 123, 108, 0.1);
  border: 1px solid rgba(240, 123, 108, 0.4);
  color: var(--danger);
  font-size: 0.9rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap .table {
  min-width: 640px;
}

.order-items {
  display: grid;
  gap: 0.5rem;
}

.order-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.6rem;
  align-items: center;
}

.order-item-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.order-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.order-item-meta {
  display: grid;
  gap: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.order-item-meta a {
  color: var(--accent);
  font-weight: 600;
}

.statement {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
}

.statement h4 {
  margin: 0;
}

.timeline {
  display: grid;
  gap: 0.6rem;
}

.timeline-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 179, 71, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 179, 71, 0.22);
  border-radius: 999px;
  padding: 0.4rem;
  display: flex;
  gap: 0.4rem;
  z-index: 25;
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 30px rgba(28, 24, 20, 0.18);
}

.sticky-bar {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 4.6rem;
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 179, 71, 0.2);
  box-shadow: var(--shadow);
  z-index: 26;
}

.sticky-bar.hidden {
  display: none;
}

.sticky-buy {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 4.6rem;
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 179, 71, 0.24);
  box-shadow: 0 18px 36px rgba(28, 24, 20, 0.16);
  z-index: 26;
}

.sticky-buy.hidden {
  display: none;
}

.sticky-buy .sticky-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.sticky-buy .sticky-actions {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bottom-nav a {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid transparent;
}

.bottom-nav a.active {
  background: rgba(255, 179, 71, 0.22);
  color: var(--text);
  border-color: rgba(255, 179, 71, 0.45);
}

.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.25rem 5rem;
  background: rgba(255, 255, 255, 0.85);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}

.footer-cat {
  display: flex;
  justify-content: flex-end;
}

.cat-btn {
  min-width: 64px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  padding: 0 0.5rem;
}

.emergency {
  position: fixed;
  right: 1rem;
  bottom: calc(5.4rem + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  padding: 0;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid rgba(255, 179, 71, 0.3);
  box-shadow: 0 12px 22px rgba(28, 24, 20, 0.18);
  opacity: 0.6;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  text-indent: -999px;
  overflow: hidden;
}

.emergency::before {
  content: "☎";
  text-indent: 0;
  font-size: 1rem;
  line-height: 1;
}

.emergency:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.45);
  opacity: 0.95;
}

body[data-page="cart"] .emergency {
  bottom: calc(10.7rem + env(safe-area-inset-bottom, 0px));
}

body[data-page="product"] .emergency {
  bottom: calc(10.7rem + env(safe-area-inset-bottom, 0px));
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.6s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

@keyframes floatUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auroraShift {
  0% {
    background-position: 0% 20%;
  }
  50% {
    background-position: 100% 80%;
  }
  100% {
    background-position: 0% 20%;
  }
}

@keyframes shimmerGrid {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 100%;
  }
  100% {
    background-position: 0% 0%;
  }
}

@keyframes orbFloat {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-2%, 2%, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes cartPulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.fly-to-cart {
  position: fixed;
  z-index: 999;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.85), rgba(255, 179, 71, 0.35));
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 32px rgba(30, 24, 20, 0.2);
  pointer-events: none;
  transition: transform 0.75s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.75s ease;
}

.fly-to-cart.image {
  background-color: #fff;
  border-radius: 18px;
}

.cart-pulse {
  animation: cartPulse 0.6s ease;
}

@media (max-width: 720px) {
  .app-bar {
    padding: 0.7rem 0.9rem;
  }

  .app-bar-inner {
    gap: 0.6rem;
  }

  .logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .logo-title {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
  }

  .logo-sub {
    font-size: 0.72rem;
  }

  .nav-chips,
  .actions {
    display: none;
  }

  .app-bar-inner {
    justify-content: center;
  }

  .logo-sub {
    display: none;
  }

  .section {
    margin: 1.4rem 0;
    padding: 0.95rem;
  }

  .bottom-nav {
    width: calc(100% - 1.5rem);
    justify-content: space-between;
  }

  .bottom-nav a {
    flex: 1;
    text-align: center;
  }

  .emergency {
    right: 0.8rem;
    width: 40px;
    height: 40px;
    font-size: 0;
  }

  .emergency::before {
    font-size: 0.9rem;
  }
}

@media (max-width: 520px) {
  .cart-item {
    grid-template-columns: 64px 1fr;
  }

  .cart-thumb {
    width: 64px;
    height: 64px;
  }
}

@media (min-width: 768px) {
  .app-shell {
    padding: 2rem 2.5rem 4rem;
  }

  .admin-list {
    max-height: 70vh;
  }

  .hero {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }

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

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

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .stepper {
    grid-template-columns: repeat(3, 1fr);
  }

  .bottom-nav {
    display: none;
  }

  .sticky-bar {
    display: none;
  }

  .sticky-buy {
    display: none;
  }

  .footer {
    padding-bottom: 2.5rem;
  }
}

@media (min-width: 900px) {
  .app-bar-inner {
    flex-wrap: nowrap;
  }

  .nav-chips {
    background: transparent;
    border: none;
    padding: 0;
  }

  .chip {
    background: transparent;
    border-color: rgba(255, 179, 71, 0.2);
    padding: 0.2rem 0.5rem;
    font-size: 0.68rem;
  }

  .actions .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .card,
  .reveal {
    transition: none;
    animation: none;
  }
}

/* ---- SAFETY: grid luôn có layout ---- */
.product-grid {
  display: grid;
  gap: 12px;
  width: 100%;
}

/* Desktop/tablet */
.product-grid[data-view="grid"]{
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Mobile */
@media (max-width: 768px){
  .product-grid[data-view="grid"]{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Card không bị tràn gây “mất” */
.product-card{ 
  min-width: 0; 
}

/* Ảnh luôn co đúng */
.product-thumb img{
  display: block;
  width: 100%;
  height: auto;
}

/* ---- FIX lỗi reveal ẩn trên mobile ---- */
/* Nếu reveal đang set opacity/transform mà JS không add class active -> sẽ ẩn mãi */
@media (max-width: 768px){
  .section.reveal{
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  /* nếu bạn có rule kiểu .reveal .product-grid {opacity:0} thì chặn luôn */
  .section.reveal .product-grid,
  .section.reveal .product-card{
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}

/* Nếu có trường hợp parent bị overflow/height làm “cắt” */
.section,
.section-header,
.product-grid{
  height: auto;
  overflow: visible;
}
