:root {
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e0d8;
  --paper: #f6f1ea;
  --card: #fffdfb;
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --sidebar: #1c1917;
  --ok: #3f6212;
  --info: #1d4ed8;
  --warn: #b45309;
  --teal: #0f766e;
  --shadow: 0 16px 40px rgba(28, 25, 23, 0.06);
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.login-hero {
  padding: 72px;
  background:
    radial-gradient(circle at 20% 20%, rgba(194, 65, 12, 0.35), transparent 40%),
    linear-gradient(160deg, #292524, #1c1917 60%);
  color: #faf7f2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand { font-size: 28px; letter-spacing: 0.12em; }
.login-hero h1 { font-size: 56px; line-height: 1.15; font-weight: 560; margin: 24px 0 12px; }
.login-hero p { max-width: 420px; color: #d6d3d1; line-height: 1.7; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; min-height: 100%; }
.login-card { width: min(380px, 100%); }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--sidebar);
  color: #f5f5f4;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.side nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  text-align: left;
  background: transparent;
  color: #d6d3d1;
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
}
.nav-btn.active, .nav-btn:hover { background: #292524; color: white; }
.main { padding: 28px 32px 48px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.top h1 { margin: 0; font-size: 26px; font-weight: 600; }
.who { color: var(--muted); margin-right: 12px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card { padding: 18px 18px 16px; }
.card .k { color: var(--muted); font-size: 13px; }
.card .v { margin-top: 8px; font-size: 28px; font-variant-numeric: tabular-nums; }
.card .s { margin-top: 6px; color: var(--muted); font-size: 12px; }

.panel { padding: 18px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.grow { flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #c2410c; }

.btn {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 10px 16px;
}
.btn:hover { background: var(--accent-dark); }
.btn.ghost, .btn.small.ghost {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.small { padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.danger { background: #fee2e2; color: #991b1b; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.thumb {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #f5f0ea; display: block;
}
.ops { display: flex; gap: 6px; }
.pager { display: flex; justify-content: flex-end; gap: 8px; align-items: center; margin-top: 14px; color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #f5f5f4;
}
.pill.on { background: #ecfccb; color: var(--ok); }
.pill.off { background: #f5f5f4; color: var(--muted); }
.pill.PENDING_PAY { background: #ffedd5; color: var(--warn); }
.pill.PAID { background: #dbeafe; color: var(--info); }
.pill.SHIPPED { background: #ccfbf1; color: var(--teal); }
.pill.COMPLETED { background: #ecfccb; color: var(--ok); }
.pill.CANCELLED { background: #f5f5f4; color: var(--muted); }

.mask {
  position: fixed; inset: 0; background: rgba(28, 25, 23, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dialog { width: min(720px, 100%); background: white; border-radius: 18px; padding: 22px; max-height: 90vh; overflow: auto; }
.gallery { display: flex; flex-wrap: wrap; gap: 12px; min-height: 24px; }
.shot { position: relative; width: 148px; }
.shot img { width: 148px; height: 148px; object-fit: cover; border-radius: 12px; background: #f5f0ea; display: block; }
.shot .mark {
  position: absolute; left: 6px; top: 6px;
  background: #1c1917; color: white; border-radius: 999px;
  font-size: 11px; padding: 2px 6px;
}
.shot-ops { display: flex; gap: 4px; margin-top: 6px; }
.shot-ops .btn { flex: 1; padding: 4px 0; }
.field.hide { display: none; }
.sku-wrap { overflow-x: auto; }
.sku-table { border-collapse: collapse; }
.sku-table th, .sku-table td { padding: 4px 6px; text-align: center; font-size: 13px; font-weight: 500; white-space: nowrap; }
.sku-table input { width: 72px; }
.color-list { display: flex; flex-direction: column; gap: 10px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row img, .color-row .ph {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #f5f0ea;
  display: flex; align-items: center; justify-content: center; color: #a8a29e; font-size: 12px; flex: none;
}
.color-row input { flex: 1; }
.color-row .file-btn { margin-top: 0; flex: none; }
.file-btn { position: relative; overflow: hidden; width: fit-content; margin-top: 10px; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dialog h3 { margin: 0 0 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white; padding: 10px 16px; border-radius: 999px; z-index: 20;
}
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.line-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line-item .meta { flex: 1; }
.muted { color: var(--muted); }

@media (max-width: 980px) {
  .login-wrap, .layout, .cards, .row2 { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
