:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e6eaf2;
  --text: #1b2130;
  --muted: #7b8496;
  --brand: #ff6a00;
  --brand-soft: #fff2e8;
  --ok: #17a673;
  --warn: #d9822b;
  --danger: #d94848;
  --info: #3b6ef5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand span {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 18px; font-weight: 700;
}
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }

nav { display: flex; flex-direction: column; gap: 4px; }
nav button {
  border: 0; background: transparent; text-align: left;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: var(--text);
}
nav button:hover { background: var(--bg); }
nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.env {
  margin-top: auto; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.env i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.env.bad i { background: var(--danger); }

main { flex: 1; padding: 24px 28px; min-width: 0; }

header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
header h1 { font-size: 22px; }
header p { color: var(--muted); font-size: 13px; }

button {
  font-family: inherit; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel);
  padding: 8px 14px; font-size: 13px; color: var(--text);
}
button:hover { border-color: #c9d2e4; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.metric b { display: block; font-size: 24px; line-height: 1.2; }
.metric span { color: var(--muted); font-size: 12px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { padding: 6px 12px; }
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

input {
  font-family: inherit; font-size: 13px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; min-width: 220px; background: var(--panel);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
td { font-size: 13px; }
td small { display: block; color: var(--muted); font-size: 12px; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; }
.tag-UNPAID { background: #f3f4f8; color: var(--muted); }
.tag-PAID { background: #fff4e0; color: var(--warn); }
.tag-PACKED { background: #e8f1ff; color: var(--info); }
.tag-SHIPPED { background: #e6f7f1; color: var(--ok); }
.tag-COMPLETED { background: #e6f7f1; color: var(--ok); }
.tag-CANCELED { background: #fdecec; color: var(--danger); }
.tag-EXCEPTION { background: #fdecec; color: var(--danger); }

.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.primary-btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.primary-btn:hover { border-color: #e65f00; }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

.config-grid { display: grid; gap: 10px; }
.config-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.config-item span { color: var(--muted); }
.config-item b { font-weight: 500; word-break: break-all; text-align: right; }
.hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

pre { background: #1b2130; color: #d9e0f0; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12px; margin-top: 12px; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, 92vw); box-shadow: 0 20px 60px rgba(16, 24, 40, .18); }
dialog::backdrop { background: rgba(16, 24, 40, .38); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 12px; color: var(--muted); }
.dialog-head h2 { font-size: 17px; }
#close-dialog { border: 0; background: transparent; font-size: 20px; color: var(--muted); }
#dialog-body { padding: 18px 20px 22px; max-height: 60vh; overflow-y: auto; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv span { color: var(--muted); }
.timeline { margin-top: 14px; display: grid; gap: 8px; }
.timeline div { font-size: 12px; color: var(--muted); }
.ship-form { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1b2130; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .22s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* ---- 商品管理 ---- */
.cat-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.cat-chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: #5c6479;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
}

.cat-chip:hover { border-color: #c9d2e4; }

.cat-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 500;
}

#product-search { min-width: 200px; }
