/* 九十九小店后台 · 与前台同款暖底色设计 */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #1c1917;
  --ink-soft: #57534e;
  --ink-faint: #a8a29e;
  --line: #e7e2d9;
  --line-strong: #d6d0c6;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-ink: #3730a3;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 8px 24px rgba(28, 25, 23, 0.06);
  --shadow-lg: 0 24px 64px rgba(28, 25, 23, 0.18);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
.muted { color: var(--ink-faint); font-size: 13px; }

.nav {
  background: rgba(250, 248, 244, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 14px;
}
.brand-text { font-weight: 700; font-size: 17px; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.section-title { font-size: 18px; font-weight: 800; margin: 28px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* 登录 */
.login-view { display: flex; justify-content: center; padding-top: 64px; }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.login-card h1 { margin: 0; font-size: 22px; font-weight: 800; }
.login-desc { margin: 6px 0 20px; color: var(--ink-soft); font-size: 14px; }
.login-card .field-input { margin-bottom: 8px; }

/* 字段与按钮 */
.field-input {
  width: 100%; padding: 11px 13px; font-size: 15px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); outline: none;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-error { margin: 6px 0 0; font-size: 13px; color: var(--danger); min-height: 18px; }
.field-error:empty { min-height: 0; }
.btn {
  appearance: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; border-radius: var(--radius-sm);
  padding: 10px 18px; transition: background 0.15s ease, opacity 0.15s ease;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  appearance: none; background: none; border: none; cursor: pointer;
  padding: 10px 16px; font-size: 15px; font-weight: 700; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* 统计卡片 */
.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; margin-top: 4px; }
.low-stock-list { display: flex; flex-wrap: wrap; gap: 8px; }
.low-stock-chip {
  background: var(--warn-soft); border: 1px solid #fde68a; color: var(--warn);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700;
}

/* 表格 */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; color: var(--ink-faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }
.table .row-link { cursor: pointer; }
.status-pill {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 2px 9px; border-radius: 999px;
}
.status-pill.created { color: var(--warn); background: var(--warn-soft); }
.status-pill.paid { color: var(--accent-ink); background: var(--accent-soft); }
.status-pill.delivered { color: var(--ok); background: var(--ok-soft); }
.status-pill.failed { color: var(--danger); background: var(--danger-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* 工具栏与表单卡片 */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar.filters .field-input { width: auto; flex: 1; min-width: 160px; }
.pager { justify-content: space-between; margin-top: 14px; }
.form-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-top: 20px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-grid label, .block-label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.form-grid label input, .form-grid label select { margin-top: 6px; font-weight: 400; }
.block-label { margin-top: 14px; }
.block-label .field-input { margin-top: 6px; font-weight: 400; }
.check-label { display: flex !important; align-items: center; gap: 8px; padding-top: 28px; }
.check-label input { width: auto; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(28, 25, 23, 0.45); }
.modal-panel {
  position: relative; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px; padding: 22px; box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 800; }
.sheet-close {
  background: var(--bg); border: 1px solid var(--line); border-radius: 50%;
  width: 32px; height: 32px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--ink-soft);
}
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 14px; margin: 12px 0; }
.detail-grid dt { color: var(--ink-soft); }
.detail-grid dd { margin: 0; word-break: break-all; }
.delivery-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; white-space: pre-wrap; word-break: break-all;
  margin-top: 8px;
}

/* Toast */
.toast[hidden] { display: none; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 12px;
  max-width: min(92vw, 520px); background: var(--ink); color: #fff;
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; box-shadow: var(--shadow-lg);
}
.toast-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 0 2px; line-height: 1; }

@media (max-width: 640px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; gap: 2px; }
}
