:root {
  --bone: #f3efe8;
  --paper: #fbf8f2;
  --ink: #1a1815;
  --ink2: #403c35;
  --muted: #8d8679;
  --line: #e1dacc;
  --moss: #3e5144;
  --clay: #a9684f;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", -apple-system, BlinkMacSystemFont, "Microsoft YaHei",
    system-ui, sans-serif;
  --radius: 2px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

/* ------------------------------- 登录页 ------------------------------- */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  width: 360px;
  max-width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 44px 40px 38px;
}

.login-brand {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.14em;
}

.login-brand-en {
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--muted);
  margin-top: 6px;
}

.login-card h1 {
  font-size: 18px;
  margin-top: 34px;
}

.login-card .hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  margin-bottom: 22px;
}

.login-card label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 8px;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

.login-card input:focus {
  border-color: var(--ink);
}

.login-card button {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.24em;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.login-card button:hover {
  opacity: 0.82;
}

.login-error {
  margin-top: 14px;
  font-size: 12px;
  color: var(--clay);
  min-height: 18px;
}

/* ------------------------------- 主框架 ------------------------------- */

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.side {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 34px 24px 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.12em;
}

.side-brand span {
  display: block;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-top: 8px;
}

.nav {
  margin-top: 42px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink2);
  text-align: left;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav button small {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.nav button:hover {
  background: rgba(62, 81, 68, 0.05);
  color: var(--ink);
}

.nav button.active {
  border-left-color: var(--moss);
  background: rgba(62, 81, 68, 0.07);
  color: var(--ink);
}

.side-foot {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

.side-foot button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.side-foot button:hover {
  color: var(--ink);
}

.main {
  padding: 42px 48px 80px;
  max-width: 1180px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.topbar h2 {
  font-size: 24px;
}

.topbar .topbar-meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-align: right;
}

/* ------------------------------- 通用元素 ------------------------------- */

.section-label {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  gap: 20px 28px;
}

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

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

.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 7px;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="url"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.16s ease;
}

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

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: opacity 0.16s ease;
}

.btn:hover {
  opacity: 0.84;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  letter-spacing: 0.08em;
}

.btn.ghost:hover {
  border-color: var(--ink);
  opacity: 1;
}

.btn.danger {
  background: transparent;
  color: var(--clay);
  border-color: var(--line);
  letter-spacing: 0.08em;
}

.btn.danger:hover {
  border-color: var(--clay);
  opacity: 1;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.toolbar .meta {
  font-size: 12px;
  color: var(--muted);
}

.hairline {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 30px 0;
}

/* ------------------------------- 表格 ------------------------------- */

.table-wrap {
  border-top: 1px solid var(--ink);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink2);
}

tbody tr:hover {
  background: rgba(62, 81, 68, 0.035);
}

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

.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bone);
  display: block;
}

.cell-sub {
  color: var(--muted);
  font-size: 11.5px;
}

.empty {
  padding: 46px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

/* ------------------------------- 开关 ------------------------------- */

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #ddd5c6;
  border-radius: 2px;
  transition: background 0.18s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--paper);
  border-radius: 2px;
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: var(--moss);
}

.switch input:checked + span::after {
  transform: translateX(16px);
}

/* ------------------------------- 图片输入 ------------------------------- */

.img-field {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.img-preview {
  width: 86px;
  height: 86px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bone);
  object-fit: cover;
  display: block;
}

.img-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.img-controls input {
  width: 100%;
}

.upload-btn {
  align-self: flex-start;
  padding: 6px 12px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink2);
  cursor: pointer;
}

.upload-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ------------------------------- 多选 ------------------------------- */

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12.5px;
  color: var(--ink2);
  cursor: pointer;
  user-select: none;
}

.check input {
  accent-color: var(--moss);
  margin: 0;
}

.check:has(input:checked) {
  border-color: var(--moss);
  color: var(--ink);
  background: rgba(62, 81, 68, 0.06);
}

/* ------------------------------- 抽屉 ------------------------------- */

.drawer[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(26, 24, 21, 0.28);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 460px;
  max-width: 92vw;
  background: var(--paper);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  animation: slide-in 0.24s ease;
}

@keyframes slide-in {
  from {
    transform: translateX(28px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  font-size: 18px;
}

.drawer-close {
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
}

.drawer-close:hover {
  color: var(--ink);
}

.drawer-body {
  padding: 24px 28px 28px;
  overflow-y: auto;
  flex: 1;
  display: grid;
  gap: 18px;
  align-content: start;
}

.drawer-foot {
  padding: 16px 28px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--paper);
}

/* ------------------------------- 订单状态 ------------------------------- */

.status-tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink2);
  background: #fff;
}

.status-tag.pending {
  border-color: #d9c9b4;
  background: #fbf3e6;
  color: #8a6a3c;
}

.status-tag.paid {
  border-color: #b9c8bc;
  background: #eef3ee;
  color: var(--moss);
}

.status-tag.shipped {
  border-color: #c3c9d1;
  background: #eef1f5;
  color: #4a5a6b;
}

.status-tag.cancelled {
  border-color: #d8c3bb;
  background: #f8efec;
  color: var(--clay);
}

.status-select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink2);
  outline: none;
}

.status-select:focus {
  border-color: var(--ink);
}

/* ------------------------------- Toast ------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 10px 20px;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
  max-width: 80vw;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------- 响应式 ------------------------------- */

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 22px 20px;
  }

  .nav {
    margin-top: 20px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .nav button {
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .nav button.active {
    border-left: 0;
    border-bottom-color: var(--moss);
  }

  .side-foot {
    margin-top: 16px;
    padding-top: 14px;
  }

  .main {
    padding: 28px 20px 60px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
