:root {
  --green: #06c1ae;
  --green-dark: #049783;
  --ink: #1f2a2e;
  --muted: #7b858a;
  --line: #edf0f1;
  --bg: #f5f7f7;
  --card: #ffffff;
  --danger: #d64545;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
}

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

.site-shell {
  width: 100%;
  max-width: 512px;
  min-height: 100vh;
  margin: 0 auto;
  background: #fff;
}

.front-shell {
  display: grid;
  grid-template-rows: 3rem minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.site-title-bar {
  display: grid;
  place-items: center;
  height: 3rem;
  border-bottom: 1px solid #efefef;
  background: #fff;
  color: #222;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 7.45rem minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
  background: #f5f5f5;
}

.side-category {
  height: 100%;
  overflow-y: auto;
  background: #f5f5f5;
  scrollbar-width: none;
}

.side-category::-webkit-scrollbar {
  display: none;
}

.side-category-item {
  position: relative;
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0 0.42rem;
  border-bottom: 1px solid #ececec;
  background: #f5f5f5;
  color: #666;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 3rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-category-item.active {
  background: #fff;
  color: var(--green);
  font-weight: 800;
}

.side-category-item.active::before {
  content: "";
  position: absolute;
  top: 0.72rem;
  bottom: 0.72rem;
  left: 0;
  width: 3px;
  background: var(--green);
}

.product-pane {
  height: 100%;
  overflow-y: auto;
  background: #fff;
}

.category-banner {
  margin: 0.5rem 0.5rem 0;
  overflow: hidden;
  background: #f8f8f8;
}

.category-banner img {
  display: block;
  width: 100%;
  aspect-ratio: 2.9 / 1;
  object-fit: cover;
}

.empty-banner {
  display: grid;
  place-items: center;
  min-height: 4.6rem;
  color: #999;
  font-size: 0.82rem;
}

.product-list {
  display: grid;
  background: #fff;
}

.product-card {
  display: grid;
  grid-template-columns: 5.05rem minmax(0, 1fr);
  gap: 0.58rem;
  width: 100%;
  min-height: 5.8rem;
  padding: 0.58rem 0.55rem;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  text-align: left;
}

.product-thumb {
  width: 5.05rem;
  height: 5.05rem;
  background: #fafafa;
}

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

.product-info {
  min-width: 0;
  padding-top: 0.08rem;
}

.product-info h2 {
  display: -webkit-box;
  min-height: 2.1rem;
  margin: 0;
  overflow: hidden;
  color: #333;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-info p {
  min-height: 1rem;
  margin: 0.24rem 0 0.2rem;
  overflow: hidden;
  color: #999;
  font-size: 0.68rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-info strong {
  color: var(--green);
  font-size: 0.95rem;
  font-weight: 700;
}

.empty-state {
  padding: 2rem 0.8rem;
  color: #999;
  text-align: center;
  font-size: 0.82rem;
}

.hero {
  position: relative;
  overflow: hidden;
  aspect-ratio: 640 / 266;
  background: #eef5f4;
}

.hero-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 420ms ease;
}

.hero-slide {
  flex: 0 0 100%;
  height: 100%;
}

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

.hero-dots {
  position: absolute;
  right: 14px;
  bottom: 10px;
  display: flex;
  gap: 6px;
}

.hero-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.hero-dots button.active {
  width: 18px;
  background: #fff;
}

.category-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-tab {
  flex: 0 0 auto;
  min-width: 5.4rem;
  height: 2.6rem;
  padding: 0 0.74rem;
  color: #4f5b60;
  background: #fff;
  white-space: nowrap;
}

.category-tab.active {
  color: var(--green);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--green);
}

.catalog-panel {
  padding-bottom: 1.5rem;
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.72rem 0.62rem 0.46rem;
  background: #fff;
}

.category-title h1 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
}

.category-title span {
  color: var(--muted);
  font-size: 0.78rem;
}

.poster-list {
  display: grid;
  gap: 0.75rem;
  padding: 0 0.55rem 0.5rem;
}

.poster-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.poster-card img {
  display: block;
  width: 100%;
  min-height: 9rem;
  object-fit: cover;
  background: #f4f4f4;
}

.poster-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.68rem 0.72rem;
}

.poster-caption h2 {
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.poster-caption p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.price-tag {
  flex: 0 0 auto;
  color: #e33f35;
  font-weight: 800;
  white-space: nowrap;
}

.site-footer {
  padding: 1.2rem 0.8rem 1.8rem;
  color: #a5abad;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.8;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-block;
  margin-top: 0.2rem;
  color: var(--green);
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.detail-drawer.open {
  pointer-events: auto;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 240ms ease;
}

.detail-drawer.open .drawer-mask {
  background: rgba(0, 0, 0, 0.42);
}

.drawer-card {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 512px;
  max-height: 92vh;
  margin: 0 auto;
  overflow: auto;
  border-radius: 8px 8px 0 0;
  background: #fff;
  transform: translateY(105%);
  transition: transform 260ms ease;
}

.detail-drawer.open .drawer-card {
  transform: translateY(0);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.35rem;
}

.close-button {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 1;
}

.detail-cover {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #f4f4f4;
}

.detail-body {
  padding: 1rem 0.9rem 4.5rem;
}

.detail-category {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-body h2 {
  margin: 0;
  font-size: 1.3rem;
}

.detail-subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.95rem 0;
}

.detail-meta div {
  padding: 0.68rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.detail-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.detail-meta dd {
  margin: 0.22rem 0 0;
  font-weight: 700;
}

.detail-rich {
  color: #3d484c;
  line-height: 1.75;
  font-size: 0.9rem;
}

.detail-images {
  display: grid;
  gap: 0.55rem;
}

.detail-images img {
  display: block;
  width: 100%;
}

.call-bar {
  position: sticky;
  bottom: 0;
  display: block;
  width: calc(100% - 1.2rem);
  margin: 0 0.6rem 0.7rem;
  padding: 0.85rem;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.product-detail-page {
  min-height: 100vh;
  padding-bottom: 3.5rem;
  background: #f5f5f5;
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 2.6rem 1fr 2.6rem;
  align-items: center;
  height: 2.62rem;
  border-bottom: 1px solid #efefef;
  background: #fff;
  color: #333;
}

.detail-topbar button {
  height: 100%;
  background: #fff;
  color: #333;
  font-size: 1.8rem;
  line-height: 1;
}

.detail-topbar span {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
}

.detail-topbar a {
  color: #666;
  text-align: center;
  font-size: 0.78rem;
}

.pd-gallery {
  display: grid;
  gap: 1px;
  background: #fff;
}

.pd-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
}

.pd-summary {
  margin-top: 0.5rem;
  padding: 0.72rem 0.75rem;
  background: #fff;
}

.pd-price {
  color: var(--green);
  font-size: 1.35rem;
  font-weight: 800;
}

.pd-summary h1 {
  margin: 0.42rem 0 0;
  color: #333;
  font-size: 1rem;
  line-height: 1.42;
}

.pd-summary p {
  margin: 0.35rem 0 0;
  color: #999;
  font-size: 0.78rem;
}

.pd-guarantee {
  display: flex;
  gap: 0.9rem;
  margin-top: 0.5rem;
  padding: 0.62rem 0.75rem;
  background: #fff;
  color: #666;
  font-size: 0.75rem;
}

.pd-guarantee span::before {
  content: "";
  display: inline-block;
  width: 0.34rem;
  height: 0.34rem;
  margin-right: 0.28rem;
  border-radius: 50%;
  background: var(--green);
  vertical-align: 0.08rem;
}

.pd-tabs {
  position: sticky;
  top: 2.62rem;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 0.5rem;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.pd-tabs div {
  padding: 0.72rem 0;
  color: #666;
  text-align: center;
  font-size: 0.82rem;
}

.pd-tabs .pd-tab-active {
  color: var(--green);
  box-shadow: inset 0 -2px 0 var(--green);
}

.pd-rich {
  min-height: 12rem;
  padding: 0.6rem 0;
  background: #fff;
  color: #333;
  font-size: 0.86rem;
  line-height: 1.7;
}

.pd-rich p {
  margin: 0.35rem 0.75rem;
}

.pd-rich img {
  display: block;
  width: 100%;
  height: auto;
}

.pd-call {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: min(512px, 100%);
  margin: 0 auto;
  padding: 0.9rem;
  background: var(--green);
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.admin-body {
  background: #f4f6f7;
}

.admin-header,
.admin-shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: linear-gradient(135deg, #06c1ae, #0d8f80);
  color: #fff;
}

.admin-header p,
.admin-header h1 {
  margin: 0;
}

.admin-header p {
  opacity: 0.82;
  font-size: 0.78rem;
}

.admin-header h1 {
  margin-top: 0.18rem;
  font-size: 1.22rem;
}

.ghost-link {
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 0.82rem;
}

.admin-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.logout-button {
  min-height: auto;
  cursor: pointer;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
  background: #eef6f5;
}

.login-panel {
  width: min(100%, 360px);
  padding: 1.2rem;
  border: 1px solid #dfeceb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.08);
}

.login-panel h1 {
  margin: 0;
  color: #17282b;
  font-size: 1.35rem;
}

.login-panel p {
  margin: 0.35rem 0 1rem;
  color: #7a8689;
  font-size: 0.86rem;
}

.login-panel form {
  display: grid;
  gap: 0.78rem;
}

.login-panel label {
  display: grid;
  gap: 0.35rem;
  color: #506064;
  font-size: 0.8rem;
}

.login-panel input {
  width: 100%;
  height: 2.55rem;
  padding: 0 0.7rem;
  border: 1px solid #dfe6e7;
  border-radius: 6px;
}

.login-error {
  min-height: 1rem;
  color: var(--danger);
  font-size: 0.78rem;
}

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

.admin-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.settings-section {
  grid-column: 1 / -1;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: end;
  padding: 0.75rem;
}

.settings-form label {
  display: grid;
  gap: 0.35rem;
  color: #506064;
  font-size: 0.78rem;
}

.settings-form input {
  width: 100%;
  height: 2.35rem;
  padding: 0 0.6rem;
  border: 1px solid #dfe6e7;
  border-radius: 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 1rem;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 2.1rem;
  padding: 0 0.85rem;
  border-radius: 6px;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-button {
  background: #fff0f0;
  color: var(--danger);
}

.admin-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.admin-filter input,
.admin-filter select,
.edit-dialog input,
.edit-dialog select,
.edit-dialog textarea {
  width: 100%;
  border: 1px solid #dfe6e7;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.admin-filter input,
.admin-filter select {
  height: 2.35rem;
  padding: 0 0.55rem;
}

.table-list {
  display: grid;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
  min-height: 3.3rem;
  padding: 0.68rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-row h3 {
  margin: 0;
  font-size: 0.92rem;
}

.admin-row p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.row-cover {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.65rem;
  align-items: center;
}

.row-cover img {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 6px;
  object-fit: cover;
  background: #f2f2f2;
}

.edit-dialog {
  width: min(94vw, 620px);
  max-height: 88vh;
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
}

.edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.edit-dialog form {
  display: grid;
  gap: 0.72rem;
  padding: 1rem;
}

.edit-dialog h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.edit-dialog label {
  display: grid;
  gap: 0.35rem;
  color: #506064;
  font-size: 0.78rem;
}

.edit-dialog input,
.edit-dialog select {
  height: 2.45rem;
  padding: 0 0.6rem;
}

.edit-dialog textarea {
  min-height: 4.8rem;
  padding: 0.6rem;
  resize: vertical;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.check-line {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 0.45rem !important;
  min-height: 2.45rem;
}

.check-line input {
  width: 1rem;
  height: 1rem;
}

.upload-box {
  padding: 0.75rem;
  border: 1px dashed #b9c5c6;
  border-radius: 6px;
  background: #f9fbfb;
}

.upload-box input {
  height: auto;
  padding: 0;
  border: 0;
  margin-top: 0.3rem;
}

.cover-preview {
  display: none;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f7f7;
}

.cover-preview[src] {
  display: block;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.55rem;
  align-items: center;
  padding-top: 0.25rem;
}

@media (min-width: 720px) {
  .admin-shell {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }
}
