:root {
  --green: #008060;
  --green-dark: #004c3f;
  --ink: #1a1a1a;
  --gray: #6d7175;
  --line: #e3e3e3;
  --bg: #f6f6f4;
  --red: #d72c0d;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box {
  background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
}
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box p { font-size: 13px; color: var(--gray); margin-bottom: 20px; }
.login-box input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 14px; outline: none;
}
.login-box input:focus { border-color: var(--green); }
.login-box .err { color: var(--red); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

/* ---------- 布局 ---------- */
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.topbar .logo { font-weight: 800; font-size: 17px; }
.topbar .logo span { color: var(--green); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--gray);
}
.tab.active { background: var(--ink); color: #fff; }
.logout-btn { font-size: 13px; color: var(--gray); text-decoration: underline; }
.main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .label { font-size: 13px; color: var(--gray); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--gray); font-weight: 600; background: #fafafa; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }

.btn {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--ink); color: #fff; transition: background .15s; white-space: nowrap;
}
.btn:hover { background: #333; }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-dark); }
.btn.sm { padding: 5px 12px; font-size: 12px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #f1c6bd; }
.btn.danger:hover { background: #fdf1ef; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.unpaid { background: #fff3cd; color: #8a6d00; }
.badge.paid { background: #dbeafe; color: #1d4ed8; }
.badge.shipped { background: #ede9fe; color: #6d28d9; }
.badge.done { background: #dcfce7; color: #15803d; }
.badge.cancelled { background: #fee2e2; color: #b91c1c; }
.badge.on { background: #dcfce7; color: #15803d; }
.badge.off { background: #e5e7eb; color: #6b7280; }

select.status-sel { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- 编辑弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; padding: 28px;
}
.modal-box h3 { font-size: 17px; margin-bottom: 18px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--green); }
.field textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.empty { text-align: center; color: var(--gray); padding: 48px; font-size: 14px; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
}
