:root {
  --bg: #f3f7fd;
  --bg-soft: #ffffff;
  --line: #dbe7f7;
  --line-strong: #c5d9f4;
  --text: #183153;
  --muted: #6983a6;
  --primary: #1f79ff;
  --primary-2: #0d5fe0;
  --accent: #ffb11f;
  --success: #19b46b;
  --danger: #ee4b5a;
  --shadow-1: 0 8px 30px rgba(52, 93, 168, 0.08);
  --shadow-2: 0 14px 40px rgba(31, 121, 255, 0.12);
  --shadow-3: inset 0 1px 0 rgba(255,255,255,.9);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31,121,255,.10), transparent 22%),
    radial-gradient(circle at top right, rgba(255,177,31,.12), transparent 18%),
    linear-gradient(180deg, #f7faff 0%, #eff4fb 100%);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.site-shell { min-height: 100vh; }
.page {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}
.page--wide { padding-top: 120px; }
.page--detail { padding-top: 110px; }


.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 14px 14px 16px;
  background: rgba(245, 249, 255, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(205, 220, 242, 0.95);
  box-shadow: 0 14px 32px rgba(43, 92, 170, 0.08);
}
.topbar__inner {
  width: min(1440px, calc(100% - 10px));
  margin: 0 auto;
}
.topbar__inner--stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.topbar__row {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.topbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar__searchrow {
  display: flex;
  justify-content: flex-start;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand--stack {
  align-items: center;
}
.brand__logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #277fff, #0d5fe0);
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  box-shadow: var(--shadow-2), var(--shadow-3);
  flex: 0 0 54px;
}
.brand__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.brand__title {
  display: block;
  font-size: clamp(18px, 2vw, 30px);
  line-height: 1.05;
  color: #236ee8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__desc {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}
.searchbar {
  min-height: 58px;
  width: min(760px, 100%);
  background: rgba(255,255,255,.98);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-1), var(--shadow-3);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 8px 18px;
}
.searchbar--wide {
  width: min(760px, 100%);
}
.searchbar i { color: #6f89af; font-size: 16px; }
.searchbar input {
  border: 0;
  background: transparent;
  min-width: 0;
  color: var(--text);
  height: 42px;
}
.searchbar input::placeholder { color: #7e96b7; }
.searchbar button {
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 26px rgba(31, 121, 255, 0.24);
  cursor: pointer;
  transition: .22s ease;
}
.searchbar button:hover,
.btn:hover,
.quicknav a:hover,
.parent-card:hover,
.child-item:hover,
.product-card:hover,
.glow-panel:hover,
.userchip:hover,
.info-item:hover,
.section-card:hover,
.sidebar-card:hover,
.products-card:hover,
.detail-main-card:hover,
.purchase-card:hover {
  transform: translateY(-2px);
}
.quicknav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.quicknav a,
.userchip {
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  min-height: 54px;
  padding: 0 16px;
  box-shadow: var(--shadow-1), var(--shadow-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  transition: .22s ease;
}
.quicknav a i { color: #5f7fb6; }
.quicknav a.is-primary {
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 12px 26px rgba(31, 121, 255, 0.22);
}
.quicknav a.is-primary i { color: #fff; }
.userchip { padding-right: 20px; }
.userchip__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fefefe, #ddeafb);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #2c6de5;
}
.userchip__meta strong, .userchip__meta small { display: block; }
.userchip__meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip__meta small { color: var(--primary); font-size: 12px; margin-top: 3px; white-space: nowrap; }

.page--wide { padding-top: 170px; }
.page--detail { padding-top: 170px; }

.hero-card,
.section-card,
.sidebar-card,
.products-card,
.detail-main-card,
.purchase-card {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1), var(--shadow-3);
  transition: .25s ease;
}
.hero-card {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 320px;
  gap: 22px;
  margin-bottom: 22px;
}
.hero-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(31,121,255,.08);
  color: var(--primary);
  font-weight: 700;
}
.hero-card h1 { margin: 18px 0 10px; font-size: 32px; }
.hero-card p { margin: 0; color: var(--muted); max-width: 860px; line-height: 1.7; }
.hero-card__stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.hero-card__stats span {
  padding: 12px 14px;
  border-radius: 16px;
  background: #f7fbff;
  border: 1px solid #deebfb;
  font-weight: 700;
  color: #45668e;
}
.glow-panel {
  height: 100%;
  border-radius: 24px;
  padding: 24px;
  background: linear-gradient(155deg, rgba(31,121,255,.95), rgba(13,95,224,.86));
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 20px 45px rgba(31, 121, 255, 0.22);
  transition: .25s ease;
}
.glow-panel__label {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  font-weight: 700;
  font-size: 12px;
}
.glow-panel strong { font-size: 26px; margin: 16px 0 8px; }
.glow-panel small { line-height: 1.7; color: rgba(255,255,255,.9); }

.section-card,
.sidebar-card,
.products-card,
.purchase-card,
.detail-main-card { padding: 22px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
}
.section-head h2 i { color: var(--primary); }
.section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.section-head--compact { margin-bottom: 14px; }

.parent-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.parent-card,
.child-item {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(71, 109, 173, 0.08);
  display: flex;
  gap: 14px;
  align-items: center;
  transition: .22s ease;
}
.parent-card.is-active,
.child-item.is-active {
  border-color: rgba(31,121,255,.58);
  box-shadow: 0 15px 34px rgba(31,121,255,.18);
}
.parent-card__icon,
.child-item__thumb {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(145deg, #f8fbff, #e3efff);
  border: 1px solid #d8e6fb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 60px;
}
.parent-card__icon img,
.child-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.parent-card__icon i,
.child-item__thumb i { color: var(--primary); font-size: 22px; }
.parent-card__body,
.child-item__body { min-width: 0; }
.parent-card__body strong,
.child-item__body strong {
  display: block;
  font-size: 15px;
  line-height: 1.4;
}
.parent-card__body small,
.child-item__body small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.child-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 980px;
  overflow: auto;
  padding-right: 6px;
}
.empty-note,
.empty-state {
  text-align: center;
  padding: 28px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fcfdff, #f4f8ff);
  border: 1px dashed #d2e3fb;
  color: var(--muted);
}
.empty-state i { font-size: 36px; color: var(--primary); margin-bottom: 10px; display: block; }
.empty-state strong { display: block; font-size: 18px; color: var(--text); margin-bottom: 6px; }
.empty-state p { margin: 0 0 14px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.product-grid--related { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.product-card {
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(68, 109, 176, 0.08);
  transition: .22s ease;
}
.product-card__thumb {
  aspect-ratio: 16 / 10;
  background: linear-gradient(145deg, #f8fbff, #e8f2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card__thumb i { font-size: 34px; color: var(--primary); }
.product-card__body { padding: 16px; }
.product-card__top,
.product-card__bottom,
.detail-price-row,
.detail-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.product-chip,
.product-stock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.product-chip {
  background: rgba(255,177,31,.16);
  color: #946200;
  border: 1px solid rgba(255,177,31,.28);
}
.product-chip.is-soft {
  background: rgba(31,121,255,.09);
  color: var(--primary);
  border-color: rgba(31,121,255,.18);
}
.product-stock { background: rgba(25,180,107,.10); color: #11854f; border: 1px solid rgba(25,180,107,.22); }
.product-stock.is-out { background: rgba(238,75,90,.10); color: #cb3244; border-color: rgba(238,75,90,.22); }
.product-card h3 { margin: 14px 0 8px; font-size: 18px; line-height: 1.45; }
.product-card h3 a:hover { color: var(--primary); }
.product-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; min-height: 44px; }
.pricebox strong,
.detail-price-row strong { font-size: 28px; color: #ef3f3f; font-weight: 800; }
.pricebox small,
.detail-price-row small { color: #8ca1bc; text-decoration: line-through; font-weight: 600; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: .22s ease;
}
.btn--detail,
.btn--buy {
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 24px rgba(31,121,255,.22);
}
.btn--ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-1);
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.alert-box {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  font-weight: 700;
}
.alert-box--danger { background: rgba(238,75,90,.08); border: 1px solid rgba(238,75,90,.20); color: #c83549; }
.breadcrumb-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 700;
}
.breadcrumb-line a:hover { color: var(--primary); }
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}
.detail-main-card {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 24px;
}
.detail-main-card__media {
  min-height: 360px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(145deg, #f8fbff, #e5efff);
  border: 1px solid #d7e4f9;
}
.detail-main-card__media img { width: 100%; height: 100%; object-fit: cover; }
.detail-placeholder {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 42px;
}
.detail-main-card__content h1 { margin: 14px 0 12px; font-size: 30px; line-height: 1.45; }
.detail-summary {
  margin: 14px 0 18px;
  color: #4d688e;
  line-height: 1.8;
  font-size: 14px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.info-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid #dbe7f7;
  background: linear-gradient(180deg, #fff, #f8fbff);
  transition: .22s ease;
}
.info-item span,
.info-item strong { display: block; }
.info-item span { color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.info-item strong { color: var(--text); line-height: 1.5; }
.purchase-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.purchase-form label {
  font-weight: 800;
  color: var(--text);
}
.purchase-form input {
  height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: #fbfdff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.purchase-price {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff8e7, #fff2c8);
  border: 1px solid rgba(255,177,31,.28);
  color: #8d6400;
  font-weight: 700;
}
.purchase-price strong { color: #e04545; }
.purchase-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f7fbff;
  border: 1px solid #dbe7f7;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}
.related-section { margin-top: 22px; }
.empty-detail { margin-top: 110px; }

@media (max-width: 1280px) {
  .topbar__row { grid-template-columns: 1fr; align-items: stretch; }
  .topbar__right { justify-content: flex-start; }
  .parent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-main-card { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .quicknav, .quicknav--detail { justify-content: flex-start; }
  .page--wide, .page--detail { padding-top: 196px; }
  .hero-card,
  .content-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .parent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .page { width: min(100% - 16px, 100%); }
  .topbar { padding: 12px 8px; }
  .topbar__inner { width: 100%; }
  .topbar__inner--stack { gap: 10px; }
  .brand__logo { width: 48px; height: 48px; border-radius: 14px; font-size: 24px; flex-basis: 48px; }
  .brand__title { font-size: 22px; }
  .brand__desc { font-size: 11px; }
  .topbar__right { gap: 10px; }
  .searchbar { min-height: 52px; width: 100%; padding: 6px 8px 6px 12px; gap: 8px; }
  .searchbar input { height: 38px; font-size: 14px; }
  .searchbar button { height: 38px; min-width: 84px; padding: 0 14px; border-radius: 12px; }
  .quicknav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .quicknav a { justify-content: center; min-height: 46px; padding: 0 12px; border-radius: 14px; font-size: 13px; }
  .userchip { width: 100%; justify-content: flex-start; min-height: 46px; border-radius: 14px; padding: 6px 12px 6px 8px; }
  .userchip__avatar { width: 34px; height: 34px; }
  .page--wide, .page--detail { padding-top: 250px; }
  .hero-card { padding: 20px; }
  .hero-card h1 { font-size: 24px; }
  .section-card, .sidebar-card, .products-card, .detail-main-card, .purchase-card { padding: 16px; border-radius: 22px; }
  .parent-grid,
  .product-grid,
  .product-grid--related,
  .info-grid { grid-template-columns: 1fr; }
  .product-card__bottom { align-items: flex-start; }
  .detail-main-card__media, .detail-placeholder { min-height: 260px; }
}
