:root {
  color-scheme: light;
  --ink: #182034;
  --muted: #697386;
  --line: #dce3ef;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --primary: #116bff;
  --primary-dark: #0b48be;
  --accent: #15a36d;
  --warning: #e59528;
  --danger: #d94b4b;
  --shadow: 0 18px 45px rgba(28, 42, 68, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

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

button {
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(220, 227, 239, 0.86);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #116bff, #15a36d);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.header-actions a,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.icon-button {
  width: 40px;
  padding: 0;
  color: var(--ink);
  font-size: 22px;
}

main {
  width: min(1220px, calc(100% - 36px));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  min-height: min(720px, calc(100vh - 86px));
  gap: clamp(30px, 6vw, 76px);
  align-items: center;
  padding: clamp(54px, 8vw, 96px) 0 40px;
}

.hero::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--line);
  content: "";
}

.hero-content {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 36px);
}

.hero-content > p:not(.eyebrow) {
  max-width: 640px;
  color: #4d5a70;
  font-size: 18px;
  line-height: 1.75;
}

.hero-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: white;
  background: var(--primary);
  box-shadow: 0 12px 26px rgba(17, 107, 255, 0.25);
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.ghost {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.button.compact {
  min-height: 38px;
  padding: 0 12px;
}

.hero-media {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 28%, rgba(21, 163, 109, 0.35), transparent 30%),
    radial-gradient(circle at 70% 68%, rgba(17, 107, 255, 0.35), transparent 34%),
    linear-gradient(135deg, #162033 0%, #263d60 55%, #f3f7ff 56%, #ffffff 100%);
  box-shadow: var(--shadow);
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.hero-console {
  position: absolute;
  right: 10%;
  bottom: 12%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 220px;
  height: 220px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.hero-console span {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.hero-console span:nth-child(1) {
  background: #15a36d;
}

.hero-console span:nth-child(2) {
  background: #116bff;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 38px 0 22px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(140px, 190px) minmax(140px, 190px);
  gap: 12px;
}

.filters label,
.field,
.admin-search {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 110px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(17, 107, 255, 0.12);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 52px;
}

.product-card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(26, 41, 66, 0.08);
}

.product-link {
  color: inherit;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.product-link:hover {
  border-color: rgba(17, 107, 255, 0.45);
  box-shadow: 0 18px 36px rgba(26, 41, 66, 0.13);
  transform: translateY(-2px);
}

.product-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8edf6;
}

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

.status-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: white;
  background: rgba(21, 163, 109, 0.92);
  font-size: 12px;
  font-weight: 800;
}

.product-body {
  padding: 18px;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #43516a;
  background: #f8faff;
  font-size: 12px;
  font-weight: 800;
}

.product-card h3 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.35;
}

.product-card p {
  color: var(--muted);
  line-height: 1.65;
}

.product-specs {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border-radius: 8px;
  background: #f6f8fc;
}

.product-specs div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.product-specs strong {
  color: var(--ink);
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-hint {
  display: inline-flex;
  margin-top: 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.price {
  color: var(--primary);
  font-size: 24px;
  font-weight: 900;
}

.stock {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  margin: 40px 0 64px;
  padding: 44px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  background: white;
}

.hidden {
  display: none !important;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px clamp(18px, 4vw, 54px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: white;
  font-size: 14px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(21, 163, 109, 0.18), transparent 34%),
    radial-gradient(circle at 82% 70%, rgba(17, 107, 255, 0.18), transparent 32%),
    #f5f7fb;
}

.login-shell {
  width: min(100% - 32px, 460px);
}

.login-card {
  display: grid;
  gap: 22px;
  padding: clamp(24px, 5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-bottom: 12px;
  font-size: 34px;
  line-height: 1.18;
}

.login-card p:not(.eyebrow):not(.form-message) {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.detail-shell {
  width: min(1220px, calc(100% - 36px));
  padding: 34px 0 58px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(22px, 4vw, 46px);
  align-items: start;
}

.detail-loading {
  grid-column: 1 / -1;
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.detail-gallery,
.detail-info {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 34px rgba(26, 41, 66, 0.08);
}

.detail-gallery {
  position: sticky;
  top: 96px;
  overflow: hidden;
  padding: 14px;
}

.detail-main-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
  background: #edf2fb;
}

.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.detail-thumbs button {
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #edf2fb;
}

.detail-thumbs button.active {
  border-color: var(--primary);
}

.detail-thumbs img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.detail-info {
  padding: clamp(20px, 4vw, 34px);
}

.detail-info h1 {
  margin-bottom: 16px;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.12;
}

.detail-description {
  color: #4d5a70;
  font-size: 17px;
  line-height: 1.8;
  white-space: pre-line;
}

.detail-buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-buy-row .price {
  font-size: 34px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-section {
  margin-top: 28px;
}

.detail-section h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.detail-section p {
  color: var(--muted);
  line-height: 1.75;
}

.admin-page {
  background:
    linear-gradient(180deg, #eef5ff 0, transparent 360px),
    var(--soft);
}

.admin-shell {
  width: min(1440px, calc(100% - 32px));
  padding-bottom: 42px;
}

.admin-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 38px 0 24px;
}

.admin-intro h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(32px, 3.4vw, 46px);
  line-height: 1.12;
}

.admin-intro h1 span {
  display: block;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 118px);
  gap: 10px;
}

.stat-row article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.stat-row span {
  display: block;
  color: var(--primary);
  font-size: 28px;
  font-weight: 900;
}

.stat-row small {
  color: var(--muted);
  font-weight: 800;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.manager-panel,
.product-admin {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 34px rgba(26, 41, 66, 0.08);
}

.manager-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
  padding: 20px;
}

.product-admin {
  min-height: 520px;
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  font-size: 24px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid.three {
  grid-template-columns: 1fr 0.8fr 0.7fr;
}

.upload-box {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #b9c7db;
  border-radius: 8px;
  background: #f8fbff;
}

.upload-box label {
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.upload-box label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.upload-box label strong {
  color: var(--primary);
}

.upload-box small {
  color: var(--muted);
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-box img {
  width: 112px;
  height: 88px;
  border-radius: 8px;
  object-fit: cover;
  background: #edf2fb;
}

.image-gallery-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.image-gallery-editor p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcff;
  font-size: 13px;
  font-weight: 800;
}

.image-thumb {
  position: relative;
  overflow: hidden;
  min-height: 82px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2fb;
}

.image-thumb.cover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17, 107, 255, 0.12);
}

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

.image-thumb span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  color: white;
  background: rgba(24, 32, 52, 0.78);
  font-size: 11px;
  font-weight: 900;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.form-message.success {
  color: var(--accent);
}

.form-message.error {
  color: var(--danger);
}

.admin-search {
  width: min(280px, 100%);
}

.admin-table {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.admin-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.admin-item img {
  width: 92px;
  height: 76px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8edf6;
}

.admin-item h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.admin-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-item .price {
  display: inline-block;
  margin-top: 8px;
  font-size: 18px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
  min-width: 266px;
}

.mini-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.mini-button.danger {
  color: var(--danger);
}

.mini-button.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: white;
  background: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.badge.draft {
  background: var(--warning);
}

.badge.soldout {
  background: var(--danger);
}

@media (max-width: 980px) {
  .hero,
  .admin-layout,
  .admin-intro,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-media {
    min-height: 360px;
    order: -1;
  }

  .toolbar,
  .admin-intro {
    display: grid;
    align-items: start;
  }

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

  .manager-panel {
    position: static;
  }

  .detail-gallery {
    position: static;
  }
}

@media (max-width: 680px) {
  .site-header,
  .site-footer,
  .panel-heading,
  .admin-item {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    position: static;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions a,
  .icon-button {
    flex: 1;
  }

  main,
  .admin-shell {
    width: min(100% - 24px, 1220px);
  }

  .hero {
    padding-top: 28px;
  }

  h1 {
    font-size: 40px;
  }

  .filters,
  .product-grid,
  .field-grid,
  .field-grid.three,
  .stat-row,
  .admin-item {
    grid-template-columns: 1fr;
  }

  .stat-row {
    display: grid;
  }

  .admin-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .item-actions {
    min-width: 0;
    justify-content: start;
  }

  .upload-box {
    grid-template-columns: 1fr;
  }

  .upload-box img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  .image-gallery-editor,
  .detail-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-shell {
    width: min(100% - 24px, 1220px);
    padding-top: 20px;
  }

  .detail-buy-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
