/* 明菲饰品 · 共享基础样式 v1 */
:root {
  --gold: #b8894a;
  --gold-2: #d9b87a;
  --gold-3: #f0e2c8;
  --gold-soft: #fbf6ec;
  --ink: #211c17;
  --ink-2: #3d352c;
  --ink-3: #6b6157;
  --muted: #918779;
  --line: #e7e0d5;
  --line-2: #f0ebe2;
  --bg: #f6f3ee;
  --bg-2: #efeae1;
  --surface: #ffffff;
  --surface-2: #fcfaf6;
  --success: #2f7d5b;
  --success-bg: #e9f5ee;
  --warning: #b8762a;
  --warning-bg: #fdf3e3;
  --danger: #b3402f;
  --danger-bg: #fbeceA;
  --info: #35658f;
  --info-bg: #eaf1f8;
  --purple: #6b4d8a;
  --purple-bg: #f0ebf6;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(33, 28, 23, .05), 0 1px 3px rgba(33, 28, 23, .04);
  --shadow: 0 6px 20px -8px rgba(33, 28, 23, .16), 0 2px 6px rgba(33, 28, 23, .04);
  --shadow-lg: 0 24px 60px -20px rgba(33, 28, 23, .3), 0 8px 20px -8px rgba(33, 28, 23, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .8, .28, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; line-height: 1.25; color: var(--ink); }
h1 { font-size: 26px; letter-spacing: -.3px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8d0c2; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c4b9a6; background-clip: content-box; border: 3px solid transparent; }
::selection { background: var(--gold-3); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* ---------- layout ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.space-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.center { display: flex; align-items: center; justify-content: center; }
.flex-1 { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.gold { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: all .18s var(--ease); user-select: none;
}
.btn:hover { border-color: #d6cbb9; background: var(--surface-2); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--gold) 0%, #a97a3f 100%); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -4px rgba(184, 137, 74, .5); }
.btn-primary:hover { background: linear-gradient(135deg, #c4975a 0%, #b0834a 100%); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: rgba(33, 28, 23, .05); color: var(--ink); border-color: transparent; }
.btn-danger { background: var(--danger-bg); border-color: #f0d5d1; color: var(--danger); }
.btn-danger:hover { background: #f7e0dc; border-color: #e8c4be; color: var(--danger); }
.btn-soft { background: var(--gold-soft); border-color: var(--gold-3); color: var(--gold); }
.btn-soft:hover { background: #f7eeda; border-color: var(--gold-2); color: var(--gold); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }

/* ---------- inputs ---------- */
.input, .select, textarea.input {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 13px;
  transition: border-color .16s, box-shadow .16s; appearance: none;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.input::placeholder, textarea.input::placeholder { color: #b3a999; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(184, 137, 74, .12); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23918779' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.field .hint { font-size: 11px; color: var(--muted); }
.field .err { font-size: 11px; color: var(--danger); }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group > .input { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.check input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #d8d0c2; border-radius: 999px; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--gold); }
.switch input:checked + i::after { transform: translateX(18px); }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-height: 36px; align-items: center; }
.tag-input input { border: none; outline: none; flex: 1; min-width: 80px; font-size: 13px; background: transparent; height: 24px; }
.tag-input .chip { cursor: default; }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.card-hd h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-hd h3::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.card-sub { font-size: 12px; color: var(--muted); }
.card-bd { padding: 18px; }
.card-bd.tight { padding: 0; }
.card-ft { padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); }

/* ---------- kpi ---------- */
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(184,137,74,.12), transparent 70%); }
.kpi-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 26px; font-weight: 650; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; margin-top: 8px; font-weight: 500; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.flat { color: var(--muted); }

/* ---------- table ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; }
.table tbody tr { transition: background .14s; }
.table tbody tr:hover { background: var(--gold-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num, .table .right { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- badge / chip / tags ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 500; background: var(--bg-2); color: var(--ink-3); white-space: nowrap; }
.badge-gold { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-3); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-orange { background: var(--warning-bg); color: var(--warning); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray { background: #f1eee8; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 12px; cursor: pointer; transition: all .16s; white-space: nowrap; }
.chip:hover { border-color: var(--gold-2); color: var(--gold); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.gold.active { background: var(--gold); border-color: var(--gold); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; background: var(--bg-2); color: var(--ink-3); font-size: 11px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; padding: 10px 14px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: color .16s; border: none; background: none; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--gold); }

/* ---------- misc ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; background: var(--gold); flex: none; overflow: hidden; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.progress { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width .5s var(--ease); }
.skeleton { background: linear-gradient(90deg, #f0ebe2 25%, #f7f3ec 37%, #f0ebe2 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 16px; color: var(--muted); text-align: center; }
.empty .empty-icon { font-size: 30px; opacity: .5; }
.tooltip { position: relative; }
.tooltip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) scale(.96); background: var(--ink); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: .16s; z-index: 50; }
.tooltip:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---------- toast ---------- */
.mf-toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.mf-toast { display: flex; align-items: center; gap: 8px; min-width: 160px; max-width: 80vw; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); animation: toastIn .24s var(--ease); pointer-events: auto; }
.mf-toast.success { background: #256649; }
.mf-toast.error { background: #a03a2b; }
.mf-toast.warn { background: #a06a20; }
.mf-toast.info { background: #2f4f6b; }
.mf-toast .ico { font-size: 14px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
.mf-toast.out { animation: toastOut .2s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(.97); } }

/* ---------- modal / drawer ---------- */
.mf-mask { position: fixed; inset: 0; background: rgba(33, 28, 23, .42); backdrop-filter: blur(2px); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .18s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.mf-modal { width: 560px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: modalIn .26s var(--ease); overflow: hidden; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.mf-modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 14px; font-size: 16px; font-weight: 600; }
.mf-modal-hd .x { width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.mf-modal-hd .x:hover { background: var(--bg-2); color: var(--ink); }
.mf-modal-bd { padding: 4px 22px 20px; overflow-y: auto; flex: 1; color: var(--ink-2); font-size: 13.5px; }
.mf-modal-ft { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }
.mf-drawer-wrap { position: fixed; inset: 0; background: rgba(33, 28, 23, .42); z-index: 9000; display: flex; justify-content: flex-end; animation: fadeIn .18s; }
.mf-drawer { width: 480px; max-width: 92vw; height: 100%; background: var(--surface); display: flex; flex-direction: column; animation: drawerIn .28s var(--ease); }
@keyframes drawerIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 12px 18px; font-size: 12px; color: var(--muted); }
.pager .pbtn { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-size: 12px; color: var(--ink-3); }
.pager .pbtn:hover:not(:disabled) { border-color: var(--gold-2); color: var(--gold); }
.pager .pbtn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager .pbtn:disabled { opacity: .4; cursor: not-allowed; }
.pager .ptotal { margin-right: auto; }

/* ---------- loading overlay ---------- */
.mf-loading { position: fixed; inset: 0; z-index: 9800; display: flex; align-items: center; justify-content: center; background: rgba(246, 243, 238, .6); backdrop-filter: blur(1px); animation: fadeIn .16s; }
.mf-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--gold-3); border-top-color: var(--gold); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- image thumb ---------- */
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--bg-2); flex: none; border: 1px solid var(--line-2); }
.thumb-lg { width: 64px; height: 64px; border-radius: 10px; }
.thumb-fallback { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--gold-3), var(--gold-soft)); color: var(--gold); font-weight: 700; font-size: 15px; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .mf-modal { width: 100%; }
}
