:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --soft: #f7f9fc;
  --ink: #172033;
  --muted: #69748a;
  --line: #e4e9f2;
  --line-strong: #d4dbea;
  --blue: #0b91e8;
  --teal: #18a886;
  --pink: #eb7aa8;
  --red: #f0526e;
  --green: #25bd72;
  --amber: #d8901f;
  --shadow: 0 18px 45px rgba(25, 39, 68, 0.12);
  --radius: 8px;
  --sidebar: 264px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(115deg, rgba(11, 145, 232, 0.08), transparent 28%),
    linear-gradient(245deg, rgba(235, 122, 168, 0.08), transparent 34%),
    repeating-linear-gradient(90deg, rgba(23, 32, 51, 0.025) 0 1px, transparent 1px 96px);
}

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

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

[hidden] {
  display: none !important;
}

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

h1 {
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  font-size: 21px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #10192b, #273652);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong,
.brand-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 17px;
}

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

.eyebrow,
.section-label,
.crumb {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ghost-button,
.solid-link,
.primary-button,
.secondary-button,
.danger-button,
.pay-choice,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  max-width: 100%;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--ink);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.ghost-button:hover,
.secondary-button:hover,
.pay-choice:hover,
.tab-button:hover {
  border-color: rgba(11, 145, 232, 0.45);
  box-shadow: 0 10px 26px rgba(11, 145, 232, 0.1);
  transform: translateY(-1px);
}

.solid-link,
.primary-button {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.solid-link:hover,
.primary-button:hover {
  background: #087ac4;
  transform: translateY(-1px);
}

.primary-button {
  width: 100%;
}

.secondary-button {
  background: #eef7ff;
  color: var(--blue);
}

.danger-button {
  border-color: #ffd2dc;
  background: #fff0f4;
  color: var(--red);
}

.button-row,
.topline-actions,
.shop-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Shop */

.site-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.shop-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 12px 0;
  background: rgba(243, 246, 251, 0.86);
  border-bottom: 1px solid rgba(228, 233, 242, 0.78);
  backdrop-filter: blur(18px);
}

.store-grid {
  display: grid;
  grid-template-columns: minmax(280px, 376px) minmax(0, 1fr);
  gap: 22px;
  padding: 24px 0 56px;
}

.store-aside {
  display: grid;
  gap: 16px;
  align-self: start;
}

.store-hero,
.filter-panel,
.store-main,
.notice-card,
.product-card,
.modal-card,
.login-card,
.admin-panel,
.metric-card {
  border: 1px solid rgba(228, 233, 242, 0.92);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.store-hero {
  display: grid;
  gap: 20px;
  padding: 22px;
  min-height: 220px;
  overflow: hidden;
  position: relative;
}

.store-hero::after,
.admin-panel::after {
  content: "";
  position: absolute;
  inset: auto -8% -42px 12%;
  height: 88px;
  background: repeating-linear-gradient(90deg, rgba(11, 145, 232, 0.1) 0 18px, rgba(235, 122, 168, 0.09) 18px 36px);
  opacity: 0.45;
  transform: rotate(-3deg);
  pointer-events: none;
}

.store-hero h1 {
  margin-top: 8px;
  max-width: 320px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.hero-metrics div {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.hero-metrics strong {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 24px;
}

.hero-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.floating-board {
  position: relative;
  min-height: 138px;
}

.float-card {
  position: absolute;
  width: 150px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 34px rgba(25, 39, 68, 0.1);
  animation: floatPanel 5.6s ease-in-out infinite;
}

.float-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.float-card strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
}

.float-card-a {
  left: 4px;
  top: 10px;
}

.float-card-b {
  right: 14px;
  top: 2px;
  animation-delay: -1.7s;
}

.float-card-c {
  left: 88px;
  bottom: 2px;
  animation-delay: -3.1s;
}

@keyframes floatPanel {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

.filter-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.search-box,
.order-form label,
.editor-form label,
.settings-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(11, 145, 232, 0.58);
  box-shadow: 0 0 0 3px rgba(11, 145, 232, 0.12);
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-weight: 800;
}

.category-button.is-active {
  border-color: rgba(11, 145, 232, 0.52);
  background: #eaf6ff;
  color: var(--blue);
}

.category-button small {
  color: var(--muted);
}

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

.notice-card {
  padding: 12px;
  box-shadow: none;
}

.notice-card strong {
  display: block;
  margin-bottom: 4px;
}

.notice-card p {
  font-size: 13px;
}

.store-main {
  min-width: 0;
  padding: 18px;
}

.content-head,
.admin-section-head,
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.product-card {
  display: grid;
  grid-template-rows: 150px 1fr;
  min-height: 384px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(25, 39, 68, 0.08);
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.product-card:hover {
  border-color: rgba(11, 145, 232, 0.55);
  box-shadow: 0 18px 40px rgba(25, 39, 68, 0.13);
  transform: translateY(-3px);
}

.product-cover {
  position: relative;
  overflow: hidden;
  background: #e8edf6;
}

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

.product-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
}

.product-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 12px;
  padding: 14px;
}

.product-body p {
  font-size: 13px;
}

.product-meta,
.result-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price {
  color: #c9235a;
  font-size: 24px;
  font-weight: 900;
}

.stock,
.status-chip,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eafaf2;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.stock.is-empty,
.status-chip.is-bad {
  background: #fff0f4;
  color: var(--red);
}

.status-chip.is-warn {
  background: #fff7e7;
  color: var(--amber);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

/* Modals and forms */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 25, 36, 0.52);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.modal-product {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  padding-right: 38px;
}

.modal-product img {
  width: 116px;
  height: 94px;
  border-radius: var(--radius);
  object-fit: cover;
}

.order-form,
.editor-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

.pay-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pay-choice {
  min-width: 0;
  white-space: normal;
}

.pay-choice.is-active {
  border-color: rgba(24, 168, 134, 0.5);
  background: #e9fbf6;
  color: var(--teal);
}

.order-summary,
.result-card,
.card-code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 0 14px;
}

.order-summary span {
  color: var(--muted);
  font-weight: 800;
}

.order-summary strong {
  color: #c9235a;
  font-size: 24px;
}

.warning {
  padding: 10px 12px;
  border: 1px solid #f4d59b;
  border-radius: var(--radius);
  background: #fff9ec;
  color: #81540b;
  font-size: 13px;
}

.query-result {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.result-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.result-line span:first-child {
  color: var(--muted);
}

.card-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.copy-button,
.icon-mini {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: none;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 800;
}

.toast.is-visible {
  display: block;
}

/* Admin */

.admin-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 24px;
}

.admin-login-brand {
  margin-bottom: 28px;
}

.admin-app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  padding: 20px 18px;
}

.admin-brand {
  margin-bottom: 26px;
}

.side-menu {
  display: grid;
  gap: 22px;
}

.menu-group {
  display: grid;
  gap: 7px;
}

.menu-group > span {
  padding: 0 8px;
  color: #95a0b5;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.menu-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #253047;
  padding: 0 12px;
  font-weight: 800;
  text-align: left;
}

.menu-item::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 3px;
  background: #c8d0df;
}

.menu-item:hover,
.menu-item.is-active {
  border-color: rgba(11, 145, 232, 0.18);
  background: #eef7ff;
  color: var(--blue);
}

.menu-item.is-active::before {
  background: var(--blue);
}

.admin-workspace {
  min-width: 0;
  padding: 22px 28px 48px;
}

.admin-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
}

.admin-topline h1 {
  margin-top: 5px;
  font-size: 23px;
}

.admin-hero {
  position: relative;
  min-height: 132px;
  margin: 16px 0 18px;
  overflow: hidden;
}

.admin-ambient {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.admin-ambient span {
  position: absolute;
  display: block;
  width: 280px;
  height: 74px;
  border: 1px solid rgba(11, 145, 232, 0.13);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.44);
  animation: driftBand 9s ease-in-out infinite;
}

.admin-ambient span:nth-child(1) {
  left: 4%;
  top: 16px;
}

.admin-ambient span:nth-child(2) {
  right: 14%;
  top: 38px;
  animation-delay: -3s;
}

.admin-ambient span:nth-child(3) {
  left: 42%;
  top: 0;
  animation-delay: -5.4s;
}

@keyframes driftBand {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(8px) translateX(16px);
  }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
}

.metric-card span {
  display: block;
  margin-bottom: 14px;
  color: #8792a8;
  font-size: 13px;
  font-weight: 900;
}

.metric-card strong {
  color: var(--blue);
  font-size: 26px;
}

.metric-card:nth-child(2) strong {
  color: var(--green);
}

.metric-card:nth-child(3) strong {
  color: #7a55ff;
}

.metric-card:nth-child(4) strong {
  color: var(--pink);
}

.admin-panel {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.admin-panel > * {
  position: relative;
  z-index: 1;
}

.filter-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
}

.filter-strip:empty {
  display: none;
}

.filter-strip input,
.filter-strip select {
  min-height: 36px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
}

.admin-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: #69748a;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr:hover {
  background: rgba(238, 247, 255, 0.62);
}

.check-cell {
  width: 46px;
}

.action-cell {
  width: 150px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: var(--radius);
  background: #eef4fb;
  color: #1e2b45;
  font-weight: 900;
}

.user-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: #7a55ff;
}

.settings-form,
.plugin-grid,
.payment-grid,
.stock-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 16px;
}

.settings-card,
.plugin-card,
.stock-card,
.payment-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
}

.settings-card {
  display: grid;
  gap: 12px;
}

.notice-edit-row {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.notice-edit-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.plugin-card,
.payment-card,
.stock-card {
  display: grid;
  gap: 12px;
}

.plugin-card h3,
.payment-card h3,
.stock-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-card {
  width: min(760px, 100%);
}

.editor-head {
  justify-content: flex-start;
  gap: 10px;
  padding-right: 38px;
}

.editor-form .full-span {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .primary-button,
.modal-actions .secondary-button,
.modal-actions .danger-button {
  width: auto;
}

.inline-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1080px) {
  .store-grid,
  .admin-app {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .side-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

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

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

@media (max-width: 680px) {
  .site-shell {
    width: calc(100% - 20px);
  }

  .shop-topbar,
  .admin-topline,
  .content-head,
  .admin-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .shop-actions,
  .topline-actions {
    width: 100%;
  }

  .shop-actions > *,
  .topline-actions > * {
    flex: 1 1 auto;
  }

  .product-grid,
  .form-grid,
  .editor-grid,
  .settings-grid,
  .settings-form,
  .plugin-grid,
  .payment-grid,
  .stock-grid,
  .pay-row,
  .metrics-grid,
  .filter-strip,
  .side-menu {
    grid-template-columns: 1fr;
  }

  .floating-board {
    display: none;
  }

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

  .modal-product img {
    width: 100%;
    height: 150px;
  }

  .admin-workspace {
    padding: 16px 10px 36px;
  }

  .admin-sidebar {
    padding: 16px 10px;
  }
}
