/* 通用基础样式（前台 / 后台共用） */
:root {
  --red: #f5333f;
  --red-dark: #d81e2c;
  --red-light: #fff1f2;
  --orange: #ff7a2f;
  --green: #10c8a0;
  --blue: #2f8bff;
  --purple: #8b5cf6;
  --text: #22242a;
  --text2: #5c6270;
  --muted: #9aa0ac;
  --line: #eceef2;
  --bg: #f5f6f8;
  --card: #fff;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(30, 40, 70, .07);
  --admin-line: #10d0a4;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; outline: none; }
button { cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
.ic { flex: none; vertical-align: middle; }
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.scroll-y::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: #d7dbe3; border-radius: 6px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; background: #fff;
  border: 1px solid #dfe3ea; color: var(--text2); font-size: 13px; font-weight: 500;
  transition: .18s; white-space: nowrap;
}
.btn:hover { border-color: var(--red); color: var(--red); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { color: #fff; opacity: .9; }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.blue:hover { color: #fff; opacity: .9; }
.btn.ghost { background: transparent; }
.btn.danger { color: #e34b4b; border-color: #f3c9c9; }
.btn.danger:hover { background: #fff3f3; border-color: #e34b4b; color: #e34b4b; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { height: 44px; padding: 0 24px; font-size: 15px; border-radius: 24px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: #f2f4f7; color: var(--text); }

/* 表单 */
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid #dfe3ea; border-radius: 8px;
  background: #fff; color: var(--text); transition: .18s;
}
.textarea { height: auto; min-height: 86px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(245, 51, 63, .08); }
.input::placeholder, .textarea::placeholder { color: #b6bbc5; }
.field { margin-bottom: 16px; }
.field > label { display: block; margin-bottom: 7px; font-size: 13px; color: var(--text2); font-weight: 500; }
.field > label .req { color: var(--red); margin-right: 3px; }
.field .hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkline { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--text2); }
.checkline input { accent-color: var(--red); width: 15px; height: 15px; }
.switch { position: relative; display: inline-block; width: 42px; height: 23px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #d5d9e0; border-radius: 20px; transition: .2s; }
.switch i::after { content: ''; position: absolute; width: 19px; height: 19px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(19px); }

/* 状态标签 */
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 4px; font-size: 11px; line-height: 18px; background: #f2f4f7; color: var(--text2); }
.tag.red { background: var(--red-light); color: var(--red); }
.tag.green { background: #e7f9f3; color: #0ba87e; }
.tag.blue { background: #eaf3ff; color: var(--blue); }
.tag.orange { background: #fff2e8; color: var(--orange); }
.tag.gray { background: #f2f4f7; color: #8a909c; }
.badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
.divider { height: 8px; background: var(--bg); }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .ic { color: #d3d8e0; margin-bottom: 10px; }
.empty p { font-size: 13px; margin-bottom: 14px; }

/* 提示条 */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -18px); z-index: 9999;
  display: flex; align-items: center; gap: 8px; max-width: 86vw; padding: 10px 18px;
  border-radius: 10px; background: rgba(34, 36, 42, .93); color: #fff; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: .24s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success .ic { color: #4ade80; }
.toast.error .ic { color: #ff8080; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; z-index: 900; background: rgba(20, 25, 38, .45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { width: min(520px, 100%); max-height: 86vh; display: flex; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.22); overflow: hidden; animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { height: 54px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-title { padding: 22px 22px 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px 22px; font-size: 14px; color: var(--text2); }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.confirm-box .modal-foot { border-top: 0; padding-top: 4px; }
.icon-preview { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.hidden { display: none !important; }
.txt-red { color: var(--red); }
.txt-muted { color: var(--muted); }
.txt-green { color: #0ba87e; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; }
.gap6 { gap: 6px; }
.gap10 { gap: 10px; }
.grow { flex: 1; min-width: 0; }
.price { color: var(--red); font-weight: 700; }
.price small { font-size: .7em; font-weight: 500; }
.price del { color: var(--muted); font-size: 11px; font-weight: 400; margin-left: 6px; }

@media (max-width: 640px) {
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal-box { width: 100%; max-height: 88vh; border-radius: 16px 16px 0 0; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
