:root {
  --brand: #ff4544;
  --brand-grad: linear-gradient(135deg, #ff4c46, #ff684f);
  --bg: #f5f6f8;
  --text: #1a1a1a;
  --muted: #999;
  --border: #eceef2;
  --aside: #1f2430;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
code { background: #f0f1f3; padding: 1px 6px; border-radius: 4px; }

.layout { display: flex; height: 100%; }
.aside {
  width: 210px;
  background: var(--aside);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo__mark {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--brand-grad);
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.logo__text { font-size: 15px; font-weight: 600; }
.menu { padding: 10px 0; flex: 1; overflow: auto; }
.menu__item {
  display: block;
  padding: 12px 22px;
  color: #b9bfcc;
}
.menu__item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu__item.is-active { background: var(--brand); color: #fff; }

.layout__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.header {
  height: 60px; background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 0 22px; flex-shrink: 0;
}
.header__title { font-size: 16px; font-weight: 600; }
.header__right { display: flex; align-items: center; gap: 14px; }
.badge {
  background: #ffecec; color: var(--brand);
  padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer;
}
.user { position: relative; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.user__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.user__drop {
  display: none; position: absolute; right: 0; top: 36px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08); min-width: 140px; z-index: 20;
}
.user.open .user__drop { display: block; }
.user__drop button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 14px; cursor: pointer;
}
.user__drop button:hover { background: #f7f8fa; }
.main { flex: 1; overflow: auto; padding: 18px; }

.page-card { background: #fff; border-radius: 8px; padding: 18px 20px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.page-title { font-size: 18px; font-weight: 600; margin: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar input, .toolbar select, .form-item input, .form-item select, .form-item textarea {
  border: 1px solid #dcdfe6; border-radius: 6px; padding: 8px 10px; background: #fff;
}
.toolbar input:focus, .form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  outline: none; border-color: var(--brand);
}

.btn {
  border: 1px solid #dcdfe6; background: #fff; border-radius: 6px;
  padding: 8px 14px; cursor: pointer; color: #333;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(.95); color: #fff; }
.btn-danger { color: var(--brand); border-color: #ffbdbd; background: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { border: 0; background: none; color: var(--brand); padding: 0 6px; cursor: pointer; }
.btn-link.danger { color: #e63b3a; }
.btn-link.warn { color: #ff9500; }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 12px 10px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle;
}
.table th { color: #666; font-weight: 600; background: #fafafa; }
.table-sm th, .table-sm td { padding: 6px; }
.table tbody tr:hover { background: #fafbfc; }
.thumb {
  width: 52px; height: 52px; border-radius: 6px;
  object-fit: cover; background: #f2f3f5; display: block;
}
.goods-cell, .member-cell { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.price { color: var(--brand); font-weight: 600; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px;
  background: #f0f1f3; color: #666;
}
.tag-success { background: #e8f8f1; color: #26c08c; }
.tag-info { background: #f0f1f3; color: #888; }
.tag-warn { background: #fff4e5; color: #ff9500; }

.pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px; margin-top: 16px; flex-wrap: wrap;
}
.pager button, .pager select, .pager input {
  border: 1px solid #dcdfe6; background: #fff; border-radius: 4px;
  padding: 6px 10px; cursor: pointer; min-width: 36px;
}
.pager button.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager .pager-info { color: #888; margin-right: 8px; }
.pager .pager-jump {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 8px; color: #666; font-size: 13px;
}
.pager .pager-jump input {
  width: 56px; min-width: 56px; text-align: center; cursor: text;
}

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 14px;
}
.stat {
  background: #fff; border-radius: 8px; padding: 16px 18px;
  border-left: 3px solid var(--accent, var(--brand));
}
.stat__label { font-size: 13px; color: #888; }
.stat__value { font-size: 26px; font-weight: 700; margin: 6px 0 4px; }
.stat__hint { font-size: 12px; color: #aaa; }
.grid-2 {
  display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 14px;
}
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.chart { height: 300px; }
.seg { display: flex; gap: 0; }
.seg button {
  border: 1px solid #dcdfe6; background: #fff; padding: 4px 12px; cursor: pointer;
}
.seg button:first-child { border-radius: 4px 0 0 4px; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.form-item { margin-bottom: 14px; }
.form-item > label { display: block; margin-bottom: 6px; color: #555; }
.form-item input, .form-item select, .form-item textarea { width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.check-group { display: flex; gap: 16px; flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; color: #666; }
.form-narrow { max-width: 620px; }
.desc { display: grid; grid-template-columns: 120px 1fr 120px 1fr; gap: 0; border: 1px solid var(--border); }
.desc div { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.desc .k { background: #fafafa; color: #666; }

.modal, .drawer { position: fixed; inset: 0; z-index: 100; }
.modal__mask, .drawer__mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal__box {
  position: relative; margin: 6vh auto; background: #fff; border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18); z-index: 1;
}
.modal__head, .drawer__head, .modal__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal__foot { border-bottom: 0; border-top: 1px solid var(--border); justify-content: flex-end; gap: 10px; }
.modal__body, .drawer__body { padding: 18px; }
.modal__x { border: 0; background: none; font-size: 22px; cursor: pointer; color: #999; }
.modal__head h3, .drawer__head h3 { margin: 0; font-size: 16px; }
.drawer__panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(620px, 100%);
  background: #fff; z-index: 1; display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,.08);
}
.drawer__body { overflow: auto; flex: 1; }

.uploader {
  width: 96px; height: 96px; border: 1px dashed #d0d3d9; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: #fafafa; position: relative; overflow: hidden;
}
.uploader img { width: 100%; height: 100%; object-fit: cover; }
.uploader__plus { font-size: 28px; color: #bbb; }
.uploader.busy::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.6);
}

/* display:flex 会盖掉原生 [hidden]，必须显式处理，否则登录页会一直转圈 */
.loading-mask {
  position: fixed; inset: 0; background: rgba(255,255,255,.45);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
.loading-mask:not([hidden]) {
  display: flex;
}
.loading-spin {
  width: 36px; height: 36px; border: 3px solid #f0f0f0;
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px;
  border-radius: 6px; z-index: 300; max-width: 80%;
}
.toast.ok { background: #26c08c; }
.toast.err { background: var(--brand); }

.login {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad); position: relative; overflow: hidden;
}
.login::after {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: rgba(255,255,255,.08); right: -180px; top: -220px;
}
.login__card {
  position: relative; z-index: 1; width: 380px; background: #fff;
  border-radius: 14px; padding: 34px 34px 26px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login__mark {
  width: 46px; height: 46px; border-radius: 10px; background: var(--brand-grad);
  color: #fff; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.login__title { font-size: 19px; margin: 0; font-weight: 600; }
.login__sub { margin: 4px 0 0; font-size: 13px; color: #999; }
.login__btn { width: 100%; letter-spacing: 4px; padding: 12px; }
.login__tip { margin: 18px 0 0; text-align: center; font-size: 12px; color: #b5b5b5; }

.indent { padding-left: 24px; }
.total-line { text-align: right; margin-top: 16px; font-size: 15px; }
