:root {
  color-scheme: light;
  --bg: #0b1422;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-quiet: #eef2f7;
  --ink: #172033;
  --muted: #748096;
  --line: #e5eaf1;
  --line-strong: #d8e0ea;
  --brand: #2788f5;
  --brand-dark: #1372dd;
  --brand-soft: #e9f3ff;
  --warn: #a46012;
  --warn-soft: #fff4de;
  --danger: #b42318;
  --good: #1d8a55;
  --shadow: 0 18px 44px rgba(0, 8, 24, 0.22);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.5;
}

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

button {
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

button:active {
  transform: translateY(1px);
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 32px;
  background: rgba(11, 20, 34, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: #ffffff;
}

.brand p {
  margin: 3px 0 0;
  color: #aeb9ca;
  font-size: 13px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.session-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.session-chip:empty {
  display: none;
}

.nav a,
.actions a,
.ghost-button,
.primary-button,
.danger-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.nav a:hover,
.ghost-button:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.topbar .nav a,
.topbar .nav button {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.topbar .nav a:hover,
.topbar .nav button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.15);
}

.primary-button {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
  font-weight: 800;
}

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

.danger-button {
  border-color: #f2c7c7;
  background: #fff5f5;
  color: var(--danger);
  font-weight: 800;
}

.danger-button:hover {
  border-color: var(--danger);
  background: #ffecec;
}

.content {
  width: min(1360px, calc(100% - 48px));
  margin: 28px auto 56px;
}

.mobile-content {
  width: min(820px, calc(100% - 28px));
  margin: 30px auto 48px;
}

.grid {
  display: grid;
  gap: 16px;
}

.dashboard-grid {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.rank-grid {
  grid-template-columns: 1fr;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.stat-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 17px 18px;
  border-top: 3px solid var(--brand);
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-value {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.15;
  font-weight: 850;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.section-break {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.panel .hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.field {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #283248;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f3f6fa;
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 0 0 1px #edf1f6, 0 5px 14px rgba(23, 32, 51, 0.05);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input[type="file"] {
  padding: 8px;
  color: var(--muted);
}

.field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 11px;
  border: 0;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 800;
  cursor: pointer;
}

.style-image-preview {
  width: 100%;
  max-width: 180px;
  padding: 8px;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  background: #f8fafc;
}

.style-image-preview img {
  display: block;
  width: 100%;
  max-height: 140px;
  border-radius: 6px;
  object-fit: cover;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: #b6c5bf;
}

.field input[readonly] {
  color: var(--muted);
  cursor: not-allowed;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.size-table input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 136, 245, 0.15);
}

.check-row {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #f3f6fa;
}

.segmented label {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  background: var(--brand);
  color: white;
}

.success-panel {
  display: grid;
  gap: 16px;
  text-align: center;
}

.success-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-size: 30px;
  font-weight: 900;
}

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

.login-panel {
  width: min(500px, 100%);
  padding: 30px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-brand h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.auth-mode-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.auth-mode-switch button.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(39, 136, 245, 0.22);
}

.login-form .field {
  grid-template-columns: 72px minmax(0, 1fr);
}

.login-button {
  width: 100%;
  margin-top: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.wechat-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  background: #20a162;
  color: #ffffff;
  font-weight: 850;
  cursor: pointer;
}

.wechat-button:hover:not(:disabled) {
  background: #178a52;
}

.wechat-button:disabled {
  background: #dce3e7;
  color: #8a969f;
  cursor: not-allowed;
}

.wechat-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.auth-links a {
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.role-mismatch-panel {
  max-width: 460px;
}

.role-mismatch-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
}

.role-mismatch-box p {
  margin: 0;
}

.role-mismatch-box strong {
  color: var(--text);
}

.role-mismatch-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.role-mismatch-actions .ghost-button,
.role-mismatch-actions .primary-button {
  min-height: 44px;
}

.invite-status {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.invite-status.ok {
  border-color: #b7dfca;
  background: #edf9f2;
  color: var(--good);
}

.invite-status.error {
  border-color: #f0c0bb;
  background: #fff5f4;
  color: var(--danger);
}

.invite-box {
  margin-bottom: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.invite-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.invite-row input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--muted);
}

.demo-accounts {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.demo-accounts p {
  margin: 3px 0;
}

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

.entry-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
  color: var(--ink);
  text-decoration: none;
}

.entry-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.entry-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: white;
  font-size: 24px;
  font-weight: 900;
}

.entry-card strong {
  display: block;
  font-size: 16px;
}

.entry-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.size-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.matrix-field {
  align-items: start;
}

.matrix-field > .size-table-wrap,
.matrix-field > .table-action,
.matrix-field > .hint {
  grid-column: 2;
}

.matrix-field > .table-action {
  justify-self: start;
  width: auto;
}

.size-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.size-table th,
.size-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.size-table th {
  background: #f0f4f9;
  color: #374258;
  font-size: 12px;
  font-weight: 850;
}

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

.size-table input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 8px;
  background: white;
  outline: none;
  text-align: center;
}

.size-table .color-cell {
  min-width: 122px;
}

.size-table .color-input {
  text-align: left;
}

.size-table .remove-cell {
  width: 54px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--danger);
  cursor: pointer;
}

.icon-button:hover {
  background: #fff5f3;
  border-color: #f0b4ad;
}

.table-action {
  margin-top: 10px;
}

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

.status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.status.ok {
  color: var(--good);
}

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

.style-list,
.order-list,
.ranking-list {
  display: grid;
  gap: 10px;
}

.inventory-editor {
  display: grid;
  gap: 8px;
}

.inventory-field > .inventory-editor,
.inventory-field > .size-table-wrap,
.inventory-field > .table-action,
.inventory-field > .hint {
  grid-column: 2;
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 36px;
  gap: 8px;
  align-items: center;
}

.stock-preview {
  display: block;
  padding: 12px;
  border: 1px solid #cfe1f5;
  border-radius: 8px;
  background: #f5f9fe;
}

.stock-preview-title {
  margin: 0;
  font-weight: 850;
}

.stock-preview-heading,
.stock-color-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stock-preview-heading {
  justify-content: space-between;
}

.stock-color-list {
  margin-top: 10px;
}

.stock-color {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #cfe1f5;
  border-radius: 7px;
  background: white;
  color: var(--text);
  font-size: 13px;
}

.stock-color strong {
  color: #156fcf;
}

.stock-color.empty-stock,
.stock-color.empty-stock strong {
  color: var(--danger);
}

.sales-stock-panel {
  margin-top: 16px;
}

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

.sales-stock-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.style-item,
.order-item,
.ranking-item {
  display: grid;
  gap: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9fc;
}

.style-item {
  grid-template-columns: 68px minmax(0, 1fr);
}

.order-item {
  grid-template-columns: minmax(0, 1fr) auto;
  background: white;
  box-shadow: 0 4px 14px rgba(23, 32, 51, 0.04);
}

.account-panel {
  margin-top: 16px;
}

.account-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.account-create-form .field {
  grid-template-columns: 1fr;
  gap: 6px;
}

.account-reset-form {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #cfe1f5;
  border-radius: 8px;
  background: #f5f9fe;
}

.account-reset-form[hidden] {
  display: none;
}

.account-reset-form .field {
  grid-template-columns: 1fr;
  gap: 6px;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.item-actions .ghost-button,
.item-actions .danger-button {
  width: auto;
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.user-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.user-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 900;
}

.thumb {
  width: 68px;
  height: 68px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: cover;
  background: #eef3f8;
}

.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.item-title {
  margin: 0;
  font-weight: 850;
}

.meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.line-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: #156fcf;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.rank-card {
  min-width: 0;
}

.ranking-item {
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
}

.ranking-item .thumb {
  width: 54px;
  height: 54px;
}

.image-zoom-trigger {
  padding: 0;
  border: 0;
  cursor: zoom-in;
  overflow: hidden;
}

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

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.66);
}

.image-preview-dialog {
  position: relative;
  max-width: min(920px, 94vw);
  max-height: 88vh;
  padding: 12px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.28);
}

.image-preview-dialog img {
  max-width: 100%;
  max-height: calc(88vh - 24px);
  display: block;
  border-radius: 6px;
  object-fit: contain;
}

.image-preview-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

.quantity {
  min-width: 36px;
  text-align: right;
  color: var(--brand);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}

.rank-card {
  border-top: 3px solid var(--brand);
}

.ranking-header {
  align-items: center;
}

.ranking-tabs {
  min-width: 300px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.ranking-tab {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.ranking-tab:hover {
  background: #ffffff;
  color: var(--text);
}

.ranking-tab.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(47, 126, 234, 0.2);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

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

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

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

@media (max-width: 900px) {
  .account-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .matrix-field > .size-table-wrap,
  .matrix-field > .table-action,
  .matrix-field > .hint,
  .inventory-field > .inventory-editor,
  .inventory-field > .size-table-wrap,
  .inventory-field > .table-action,
  .inventory-field > .hint {
    grid-column: 1;
  }
}

@media (max-width: 700px) {
  .account-create-form {
    grid-template-columns: 1fr;
  }

  .account-reset-form {
    grid-template-columns: 1fr;
  }

  .inventory-row {
    grid-template-columns: minmax(0, 1fr) 100px 36px;
  }

  .content,
  .mobile-content {
    width: min(100% - 20px, 820px);
    margin-top: 18px;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    padding: 14px 12px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .nav {
    width: auto;
  }

  .nav a,
  .nav button {
    flex: initial;
  }

  .form-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .matrix-field > .size-table-wrap,
  .matrix-field > .table-action,
  .matrix-field > .hint {
    grid-column: 1;
  }

  .entry-grid {
    grid-template-columns: 1fr;
  }

  .user-list {
    grid-template-columns: 1fr;
  }

  .invite-row {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
  }

  .order-item {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column-reverse;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
  }

  .nav a,
  .nav button {
    flex: 1;
  }

  .session-chip {
    order: -1;
  }

  .login-panel {
    padding: 22px 18px;
  }

  .login-form .field {
    grid-template-columns: 1fr;
  }
}

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-quiet: #edf2f7;
  --ink: #172033;
  --text: #172033;
  --muted: #6f7b8f;
  --line: #e2e8f0;
  --line-strong: #cfd8e5;
  --brand: #2f7eea;
  --brand-dark: #1f67ca;
  --brand-soft: #eaf3ff;
  --warn: #9a5a0a;
  --warn-soft: #fff5df;
  --danger: #b42318;
  --good: #168654;
  --shadow: 0 8px 24px rgba(30, 50, 80, 0.08);
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 92% 0, rgba(47, 126, 234, 0.08), transparent 28rem),
    var(--bg);
  font-size: 14px;
}

.shell {
  background: transparent;
}

.topbar {
  min-height: 68px;
  padding: 12px clamp(18px, 3vw, 42px);
  background: rgba(12, 22, 38, 0.97);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(8, 17, 31, 0.18);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: none;
}

.brand h1 {
  font-size: 19px;
  letter-spacing: 0.01em;
}

.brand p {
  margin-top: 2px;
  color: #aeb9ca;
  font-size: 12px;
}

.session-chip,
.topbar .nav a,
.topbar .nav button {
  min-height: 34px;
  border-radius: 9px;
}

.content {
  width: min(1480px, calc(100% - 32px));
  margin: 18px auto 42px;
}

.mobile-content {
  margin-top: 22px;
}

.stat-card,
.panel {
  border-color: rgba(207, 216, 229, 0.86);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.stat-card {
  min-width: 0;
  padding: 13px 15px;
  border-top: 0;
  border-left: 4px solid var(--brand);
}

.stat-label {
  font-size: 12px;
}

.stat-value {
  margin-top: 2px;
  font-size: 24px;
}

.panel {
  padding: 18px;
}

.panel-header {
  align-items: center;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 17px;
  letter-spacing: 0.01em;
}

.panel .hint {
  margin-top: 2px;
  line-height: 1.45;
}

.section-break {
  margin-top: 16px;
  padding-top: 15px;
}

.field {
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.field label {
  color: #33405a;
}

.field input,
.field textarea,
.field select {
  min-height: 40px;
  border-color: var(--line);
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: none;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  background: #ffffff;
  border-color: #9fb3ce;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.size-table input:focus {
  background: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 126, 234, 0.13);
}

.segmented input {
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
}

.form-grid,
.matrix-field,
.size-table-wrap {
  min-width: 0;
  max-width: 100%;
}

.size-table-wrap {
  width: 100%;
}

.nav a,
.actions a,
.ghost-button,
.primary-button,
.danger-button {
  min-height: 36px;
  border-radius: 9px;
  padding: 7px 13px;
}

.primary-button {
  box-shadow: 0 6px 14px rgba(47, 126, 234, 0.2);
}

.badge {
  height: 24px;
  padding: 0 8px;
  font-weight: 750;
}

.style-item,
.order-item,
.ranking-item,
.sales-stock-card,
.user-item {
  border-radius: 10px;
  background: #fbfcfe;
}

.style-item:hover,
.order-item:hover,
.sales-stock-card:hover,
.user-item:hover {
  border-color: #b8cae1;
  background: #ffffff;
}

.thumb {
  border-radius: 9px;
}

.item-actions {
  margin-top: 8px;
}

.account-panel {
  margin-top: 14px;
}

.account-create-form,
.account-reset-form {
  border-radius: 10px;
}

.invite-box,
.invite-status,
.demo-accounts {
  border-radius: 10px;
}

.size-table-wrap {
  border-radius: 10px;
  background: #ffffff;
}

.size-table th {
  background: #eef4fb;
  color: #3b4c65;
}

.size-table th,
.size-table td {
  padding: 7px;
}

.size-table input {
  min-height: 36px;
  border-radius: 7px;
  background: #f8fafc;
}

.stock-preview {
  border-radius: 10px;
  background: #f4f8fd;
}

.stock-color {
  border-radius: 8px;
}

.empty {
  border-radius: 10px;
}

.auth-page {
  background:
    radial-gradient(circle at 18% 20%, rgba(47, 126, 234, 0.2), transparent 24rem),
    radial-gradient(circle at 85% 80%, rgba(29, 138, 85, 0.12), transparent 22rem),
    #0c1626;
}

.auth-page .login-shell {
  padding: 32px 20px;
}

.auth-page .login-panel {
  border-color: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 7, 20, 0.35);
}

.auth-page .login-brand {
  margin-bottom: 22px;
}

.auth-page .login-brand .brand-mark {
  background: var(--brand);
  color: #ffffff;
}

.auth-page .login-form .field {
  grid-template-columns: 1fr;
  gap: 6px;
}

.auth-page .login-form input {
  min-height: 46px;
}

.auth-page .login-button,
.auth-page .wechat-button {
  min-height: 46px;
}

.success-page .success-panel {
  gap: 18px;
  padding: 34px;
  border-top: 4px solid var(--good);
}

.success-page .success-mark {
  width: 68px;
  height: 68px;
  background: var(--good);
  box-shadow: 0 12px 26px rgba(22, 134, 84, 0.2);
}

.admin-page .dashboard-grid > .panel .field {
  grid-template-columns: 1fr;
  gap: 6px;
}

.admin-page .dashboard-grid > .panel .inventory-field > .inventory-editor,
.admin-page .dashboard-grid > .panel .inventory-field > .size-table-wrap,
.admin-page .dashboard-grid > .panel .inventory-field > .table-action,
.admin-page .dashboard-grid > .panel .inventory-field > .hint {
  grid-column: 1;
}

@media (min-width: 981px) {
  .admin-page .dashboard-grid {
    grid-template-columns: minmax(390px, 430px) minmax(0, 1fr);
    gap: 14px;
  }

  .admin-page .rank-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-page .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
  }

  .admin-page .grid {
    gap: 14px;
  }

  .admin-page .style-item {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 10px;
  }

  .admin-page .style-item .thumb {
    width: 56px;
    height: 56px;
  }

  .admin-page .order-item {
    gap: 10px;
    padding: 10px 12px;
  }

  .admin-page .order-item .meta {
    margin-top: 2px;
    line-height: 1.4;
  }

  .admin-page .ranking-item {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .admin-page .ranking-item .thumb {
    width: 46px;
    height: 46px;
  }

  .admin-page .quantity {
    font-size: 20px;
  }

  .admin-page .user-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
  }

  .admin-page .user-item {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: 10px;
  }

  .admin-page .user-avatar {
    width: 38px;
    height: 38px;
  }

  .admin-page .account-create-form {
    grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  }

  .admin-page.form-page .mobile-content {
    width: min(980px, calc(100% - 32px));
  }
}

@media (min-width: 981px) and (max-width: 1100px) {
  .admin-page .rank-card {
    padding: 14px;
  }

  .admin-page .ranking-item {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 8px;
  }

  .admin-page .ranking-item .thumb {
    width: 42px;
    height: 42px;
  }

  .admin-page .ranking-item .meta {
    white-space: nowrap;
    font-size: 12px;
  }
}

@media (max-width: 980px) {
  .admin-page .dashboard-grid,
  .admin-page .rank-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 701px) and (max-width: 980px) {
  .admin-page .content {
    width: min(100% - 28px, 960px);
    margin-top: 14px;
  }

  .admin-page .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
  }

  .admin-page .stat-card {
    min-height: 78px;
    padding: 12px 14px;
  }

  .admin-page .dashboard-grid {
    grid-template-columns: minmax(300px, 320px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  .admin-page .rank-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-page .ranking-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-page .ranking-tabs {
    width: 100%;
    min-width: 0;
  }

  .admin-page .panel {
    padding: 16px;
  }

  .admin-page .inventory-row {
    grid-template-columns: minmax(0, 1fr) 96px 36px;
    gap: 6px;
  }

  .admin-page .style-item {
    grid-template-columns: 50px minmax(0, 1fr);
    padding: 9px;
  }

  .admin-page .style-item .thumb {
    width: 50px;
    height: 50px;
  }

  .admin-page .ranking-item {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .admin-page .ranking-item .thumb {
    width: 44px;
    height: 44px;
  }

  .admin-page .user-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page .account-create-form,
  .admin-page .account-reset-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  body {
    background:
      linear-gradient(180deg, #eaf0f7 0, #f4f7fb 240px, #f4f7fb 100%);
    font-size: 14px;
  }

  .topbar {
    position: sticky;
    min-height: 0;
    padding: 13px 12px;
    gap: 12px;
    box-shadow: 0 6px 20px rgba(8, 17, 31, 0.2);
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand p {
    font-size: 11px;
  }

  .session-chip,
  .topbar .nav a,
  .topbar .nav button {
    min-height: 42px;
  }

  .mobile-content,
  .content {
    width: calc(100% - 20px);
    margin: 16px auto 32px;
  }

  .mobile-page .panel,
  .admin-page .panel {
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(32, 55, 84, 0.09);
  }

  .panel-header {
    margin-bottom: 14px;
  }

  .ranking-header {
    align-items: stretch;
    flex-direction: column;
  }

  .ranking-tabs {
    width: 100%;
    min-width: 0;
  }

  .panel h2 {
    font-size: 18px;
  }

  .field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .field label {
    font-size: 13px;
  }

  .field input,
  .field textarea,
  .field select {
    min-height: 50px;
    border-radius: 11px;
    padding: 12px 13px;
    background: #f5f8fc;
  }

  .field textarea {
    min-height: 100px;
  }

  .entry-grid {
    gap: 12px;
  }

  .entry-card {
    min-height: 94px;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #fbfdff, #f4f8fd);
    box-shadow: 0 5px 16px rgba(38, 68, 104, 0.06);
  }

  .entry-icon {
    width: 54px;
    height: 54px;
    border-radius: 13px;
    box-shadow: 0 8px 18px rgba(47, 126, 234, 0.22);
  }

  .entry-card strong {
    font-size: 17px;
  }

  .entry-card small {
    line-height: 1.45;
  }

  .sales-stock-panel {
    margin-top: 12px;
  }

  .sales-stock-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 13px;
    border-radius: 13px;
    background: linear-gradient(135deg, #ffffff, #f7faff);
  }

  .sales-stock-card .thumb {
    width: 72px;
    height: 72px;
  }

  .stock-preview {
    padding: 14px;
    border-radius: 13px;
  }

  .stock-color {
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 10px;
  }

  .size-table-wrap {
    overflow-x: hidden;
    border-radius: 12px;
  }

  .size-table {
    width: 100%;
    min-width: 314px;
    table-layout: fixed;
  }

  .size-table th,
  .size-table td {
    padding: 6px 3px;
  }

  .size-table th:first-child,
  .size-table td:first-child {
    width: 72px;
    background: #f5f8fc;
  }

  .size-table th:first-child {
    background: #eaf2fb;
  }

  .size-table th:nth-child(n + 2):nth-child(-n + 6),
  .size-table td:nth-child(n + 2):nth-child(-n + 6) {
    width: 40px;
  }

  .size-table th:last-child,
  .size-table td:last-child {
    width: 42px;
  }

  .size-table input {
    min-height: 40px;
    padding: 6px 2px;
    font-size: 13px;
  }

  .size-table .color-cell {
    min-width: 0;
  }

  .size-table .color-input {
    padding-inline: 6px;
    font-size: 12px;
  }

  .size-table .remove-cell {
    width: 42px;
  }

  .size-table .icon-button {
    width: 32px;
    height: 32px;
  }

  .mobile-page .order-item {
    padding: 14px;
    border-radius: 13px;
    background: #ffffff;
  }

  .mobile-page .order-item .ghost-button {
    min-height: 44px;
  }

  .mobile-page .actions {
    gap: 9px;
    margin: 18px 0 0;
    padding: 10px;
    border: 1px solid rgba(207, 216, 229, 0.9);
    border-radius: 14px;
    background: #f8fafc;
  }

  .mobile-page .actions .primary-button,
  .mobile-page .actions .ghost-button,
  .mobile-page .actions a {
    min-height: 48px;
  }

  .inventory-row {
    grid-template-columns: minmax(0, 1fr) 96px 42px;
  }

  .inventory-row .icon-button {
    width: 42px;
    height: 42px;
  }

  .admin-page .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .admin-page .stat-card {
    min-height: 82px;
    padding: 12px;
  }

  .admin-page .rank-grid {
    grid-template-columns: 1fr;
  }

  .admin-page .user-list {
    grid-template-columns: 1fr;
  }

  .admin-page .account-create-form,
  .admin-page .account-reset-form {
    grid-template-columns: 1fr;
  }

  .auth-page {
    background:
      radial-gradient(circle at 50% 0, rgba(47, 126, 234, 0.23), transparent 24rem),
      #0c1626;
  }

  .auth-page .login-shell {
    align-items: start;
    padding: 20px 12px;
  }

  .auth-page .login-panel {
    margin-top: 5vh;
    padding: 22px 18px;
    border-radius: 17px;
  }

  .auth-page .login-brand {
    margin-bottom: 20px;
  }

  .auth-page .login-brand h1 {
    font-size: 22px;
  }

  .success-page .success-panel {
    margin-top: 7vh;
    padding: 28px 18px;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar .nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .topbar .session-chip {
    min-width: 0;
    flex: 1;
    justify-content: center;
    order: 0;
  }

  .topbar .nav a,
  .topbar .nav button {
    flex: 0 0 auto;
    width: auto;
  }

  .mobile-page .topbar .nav a,
  .mobile-page .topbar .nav button {
    min-width: 92px;
  }

  .demo-accounts {
    padding: 11px;
  }
}
