* { box-sizing: border-box; }
:root {
  --primary: #2f6fed;
  --primary-dark: #2059c9;
  --bg: #f4f6fa;
  --card: #ffffff;
  --side: #1e2430;
  --side-soft: #2a3241;
  --text: #1f2733;
  --muted: #7a8699;
  --line: #e7ebf2;
  --danger: #e24b4a;
  --ok: #0f9d6e;
}
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 7px 15px; border-radius: 7px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; padding: 5px 8px; }
.btn.danger:hover { background: #fdf0f0; }
.btn.ghost { background: transparent; }
.btn.link { border: none; background: transparent; color: var(--primary); padding: 5px 8px; }
.btn.link:hover { background: #eef3ff; }
.btn.block { width: 100%; padding: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }

/* ---------- 登录 ---------- */
.login-mask { position: fixed; inset: 0; background: #eef2f8; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 360px; background: #fff; border-radius: 14px; padding: 34px 32px 26px;
  box-shadow: 0 12px 40px rgba(31, 39, 51, .10); text-align: center;
}
.login-logo, .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 11px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 20px;
}
.login-card h1 { font-size: 19px; margin: 16px 0 2px; font-weight: 600; }
.login-sub { color: var(--muted); font-size: 12px; margin: 0 0 22px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 7px; outline: none; font-size: 14px;
}
.login-card input:focus { border-color: var(--primary); }
.login-error { color: var(--danger); font-size: 12px; margin: 0 0 10px; }
.login-tip { color: var(--muted); font-size: 11px; margin: 14px 0 0; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: 0 0 224px; background: var(--side); color: #cfd6e2; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 20px; font-size: 15px; font-weight: 600; color: #fff; }
.brand small { display: block; font-size: 11px; font-weight: 400; color: #8894a8; }
.brand-mark { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
.menu { flex: 1; overflow-y: auto; padding-bottom: 20px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: 0 0 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb span::after { content: "/"; margin: 0 9px; color: #c4ccd8; }
.crumb b { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 12.5px; color: var(--muted); }
.content { padding: 22px 24px 40px; flex: 1; min-width: 0; }

/* ---------- 卡片 / 看板 ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 25px; font-weight: 600; margin-top: 6px; letter-spacing: -.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* ---------- 表格 ---------- */
.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input {
  width: 240px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 7px; outline: none; background: #fff;
}
.toolbar input:focus { border-color: var(--primary); }
.toolbar .spacer { flex: 1; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 11px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #fafbfe; color: var(--muted); font-weight: 500; position: sticky; top: 0; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: none; }
td.ops { white-space: nowrap; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; background: #eaf1ff; color: var(--primary); }
.pill.off { background: #f2f4f7; color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }

.member-admin-filters { padding: 15px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 11px; }
.member-admin-filters label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.member-admin-filters input, .member-admin-filters select {
  min-height: 38px; padding: 7px 10px; max-width: 100%; font-size: 14px; color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; background: var(--card);
}
.member-admin-table th:last-child, .member-admin-table td.ops { position: sticky; right: 0; }
.member-admin-table td.ops { background: var(--card); }
.member-admin-table tbody tr:hover td.ops { background: #f8faff; }
.member-admin-table td:first-child { font-weight: 600; }
.card-form-heading { grid-column: 1 / -1; margin: 2px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 14px; }
.member-details {
  position: fixed; inset: 0; margin: auto; border: 0; padding: 0; color: var(--text);
  width: min(760px, calc(100vw - 48px)); max-width: calc(100vw - 32px); height: fit-content; max-height: 88vh;
  border-radius: 12px; background: var(--card); overflow: hidden; box-shadow: 0 18px 48px rgba(15, 23, 42, 0.25);
}
.member-details[open] { display: flex; flex-direction: column; }
.member-details::backdrop { background: rgba(15, 23, 42, 0.44); }
.member-details-body { min-height: 0; overflow: auto; padding: 0 20px 20px; }
.member-details-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 0; }
.member-details-summary span { color: var(--muted); }
.member-details-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.member-details-tabs button { padding: 8px 4px; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; }
.member-details-tabs button[aria-pressed="true"] { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }
.member-details-fields { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.member-details-fields div { min-width: 0; padding: 10px; border-bottom: 1px solid var(--line); }
.member-details-fields dt { color: var(--muted); font-size: 12px; }
.member-details-fields dd { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(20, 28, 40, .45); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal { width: min(720px, 92vw); max-height: 86vh; display: flex; flex-direction: column; background: #fff; border-radius: 12px; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
#modalForm { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; padding: 20px; overflow-y: auto; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 74px; resize: vertical; }
.field.wide { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- 删除确认（不依赖浏览器原生 confirm，避免预览面板拦截） ---------- */
.confirm-card {
  width: min(400px, 90vw); background: #fff; border-radius: 12px; padding: 22px 24px 18px;
  box-shadow: 0 18px 48px rgba(20, 28, 40, .22);
}
.confirm-card h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.confirm-card p { margin: 0 0 20px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.confirm-foot { display: flex; justify-content: flex-end; gap: 10px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #c93c3b; border-color: #c93c3b; color: #fff; }

/* ---------- 列表缩略图 ---------- */
.thumb { width: 72px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f4f6fa; vertical-align: middle; display: inline-block; }
.thumb-face { width: 44px; height: 72px; }
.thumb-preview { cursor: zoom-in; transition: transform .15s ease, box-shadow .15s ease; }
.thumb-preview:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(15, 23, 42, .16); }
.image-lightbox { border: none; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; overflow: visible; }
.image-lightbox::backdrop { background: rgba(15, 23, 42, .72); backdrop-filter: blur(4px); }
.image-lightbox img { display: block; max-width: 88vw; max-height: 86vh; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 50px rgba(0, 0, 0, .45); background: #fff; }
.image-lightbox-close { position: fixed; top: 20px; right: 24px; width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .92); color: #111827; font-size: 24px; line-height: 38px; text-align: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.image-lightbox-close:hover { background: #fff; }
.field .img-preview { margin-top: 6px; }

/* ---------- 人员编辑页的人脸照片 ---------- */
.face-field { border-top: 1px dashed var(--line); padding-top: 14px; }
.form-grid .face-field-top-right { grid-column: 2; grid-row: 1 / span 2; border-top: none; padding-top: 0; align-self: start; }
.face-box { display: flex; align-items: center; gap: 16px; min-height: 92px; }
.face-field-top-right .face-box { gap: 12px; min-height: 102px; }
.face-preview {
  width: 92px; height: 92px; flex: 0 0 92px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); background: #f4f6fa;
}
.face-empty {
  width: 92px; height: 92px; flex: 0 0 92px; display: flex; align-items: center; justify-content: center;
  text-align: center; line-height: 1.5; font-size: 11px; color: var(--muted);
  border: 1px dashed #cbd4e2; border-radius: 10px; background: #fafbfe;
}
.face-field-top-right .face-preview,
.face-field-top-right .face-empty { width: 68px; height: 102px; flex: 0 0 68px; }
.face-info { min-width: 0; }
.face-ok { font-size: 13px; font-weight: 600; color: var(--ok); }
.face-meta { font-size: 12px; color: var(--muted); margin: 3px 0 9px; }
.face-muted { font-size: 12px; color: var(--muted); }
.face-actions { display: flex; gap: 8px; }
.face-field-top-right .face-actions { flex-wrap: wrap; }
.face-actions .btn.danger { border: 1px solid var(--line); background: #fff; padding: 7px 15px; }
.face-tip { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: #1f2733; color: #fff; padding: 9px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.error { background: var(--danger); }

@media (max-width: 900px) {
  .sidebar { width: 180px; flex-basis: 180px; }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .face-field-top-right { grid-column: auto; grid-row: auto; border-top: 1px dashed var(--line); padding-top: 14px; }
}

/* 固定首页图片编辑 */
.mini-settings { max-width:1150px; margin:0 auto; }
.mini-settings-header { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:18px; }
.mini-settings-header h2 { margin:0; font-size:24px; }
.mini-settings-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.mini-save-status { font-size:13px; color:var(--muted); }
.mini-settings .btn:disabled { opacity:.52; cursor:default; }
.mini-settings-grid { display:grid; grid-template-columns:minmax(290px, 376px) minmax(0, 1fr); gap:22px; align-items:start; }
.mini-settings-preview,.mini-settings-card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:18px; min-width:0; }
.mini-settings-preview { position:sticky; top:12px; }
.mini-settings-card h3 { margin:0 0 10px; font-size:16px; }
.mini-shop-field { display:flex; flex-direction:column; gap:6px; font-size:13px; font-weight:600; margin-bottom:8px; }
.mini-shop-field select,.mini-image-setting textarea,.mini-image-setting input[type="text"] { width:100%; min-height:38px; padding:7px 10px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.mini-image-setting { padding:13px 0; border-top:1px solid var(--line); }
.mini-image-setting small { display:block; color:var(--muted); margin-bottom:7px; }
.mini-image-setting textarea { min-height:65px; resize:vertical; }
.mini-image-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:7px; }
.mini-upload-label { position:relative; display:inline-block; cursor:pointer; }
.mini-upload-label input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.mini-upload-label:focus-within,.mini-settings :is(button,input,textarea,select):focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.mini-preview-label { margin-bottom:8px; text-align:center; font-size:13px; font-weight:600; color:var(--muted); }
.mini-phone {
  --phone-bg:#f7f7f8; --phone-surface:#fff; --phone-text:#242731; --phone-line:#e4e7ed;
  display:grid; grid-template-rows:minmax(0, 1fr) auto; height:min(610px, 73vh); min-height:400px;
  max-width:300px; margin:0 auto; overflow:hidden; border:6px solid #20252d; border-radius:28px;
  background:var(--phone-bg); color:var(--phone-text); box-shadow:0 10px 24px rgba(31,39,51,.15);
}
.mini-phone-dark { --phone-bg:#15171b; --phone-surface:#262a31; --phone-text:#f3f4f6; --phone-line:#454954; }
.mini-phone-body { min-height:0; overflow:auto; }
.mini-preview-hero { height:145px; position:relative; background:#2e3340; }
.mini-cover { display:block; width:100%; height:100%; object-fit:cover; }
.mini-cover-placeholder { display:grid; height:100%; place-items:center; color:white; background:linear-gradient(120deg,#2e3340,#495465); font-size:12px; }
.mini-preview-top { display:flex; justify-content:space-between; align-items:center; gap:5px; position:absolute; top:11px; left:9px; right:9px; color:#fff; font-size:10px; }
.mini-preview-top span { background:#20252dba; padding:3px 7px; border-radius:12px; }
.mini-gallery-controls { position:absolute; bottom:8px; right:8px; display:flex; align-items:center; gap:6px; color:#fff; background:#20252db5; border-radius:12px; font-size:10px; }
.mini-gallery-controls button { border:0; background:none; color:#fff; min-width:23px; cursor:pointer; }
.mini-preview-promo { position:relative; height:70px; margin:8px 11px 0; border-radius:10px; overflow:hidden; }
.mini-preview-promo strong { position:absolute; bottom:6px; left:8px; padding:2px 6px; background:#20252dad; border-radius:4px; color:#fff; font-size:11px; }
.mini-phone-store { margin:10px 11px; border-radius:11px; padding:11px; background:var(--preview-accent); color:#13151a; font-size:12px; overflow-wrap:anywhere; }
.mini-phone-store small { display:block; margin-top:5px; }
.mini-preview-tags { display:flex; gap:5px; margin-top:5px; }
.mini-preview-tags span { padding:1px 4px; border-radius:4px; background:#ffffffa0; font-size:9px; }
.mini-preview-features { display:grid; grid-template-columns:1fr 1fr; grid-template-rows:61px 61px; gap:6px; margin:0 11px 10px; }
.mini-preview-feature { position:relative; overflow:hidden; background:var(--phone-surface); border:1px solid var(--phone-line); padding:7px; border-radius:9px; font-size:10px; }
.mini-preview-feature small { display:block; font-size:8px; }
.mini-preview-verify { grid-row:span 2; }
.mini-feature-art { position:absolute; bottom:2px; right:4px; width:38%; height:55%; object-fit:contain; object-position:bottom right; }
.mini-preview-verify .mini-feature-art { width:77%; height:68%; }
.mini-preview-cards { margin:0 11px 12px; }
.mini-preview-section-title { display:flex; justify-content:space-between; align-items:center; color:var(--phone-text); font-weight:700; font-size:12px; margin:5px 0; }
.mini-preview-section-title small { font-size:9px; }
.mini-preview-card-list { display:flex; gap:5px; overflow:auto; scrollbar-width:none; }
.mini-preview-card-list > div { flex:none; width:72px; min-height:49px; padding:6px; border-radius:7px; background:var(--phone-surface); border:1px solid var(--phone-line); font-size:10px; }
.mini-preview-card-list span { display:block; margin-top:3px; color:var(--preview-accent); }
.mini-phone-nav { display:flex; justify-content:space-between; padding:9px 11px; gap:4px; border-top:1px solid var(--phone-line); background:var(--phone-surface); font-size:10px; }
.mini-phone-nav strong { border-bottom:2px solid var(--preview-accent); }
@media (max-width:900px) {
  .mini-settings-grid { grid-template-columns:minmax(0, 1fr); }
  .mini-settings-preview { position:static; }
  .mini-phone { height:460px; }
}

.douyin-settings { max-width:1000px; margin:0 auto; }
.douyin-connect-card,.douyin-query-card { padding:20px; margin-bottom:16px; }
.douyin-connect-card dl { display:grid; gap:8px; margin:0; }
.douyin-connect-card dl div { display:grid; grid-template-columns:130px minmax(0,1fr); gap:12px; }
.douyin-connect-card dt { color:var(--muted); }
.douyin-connect-card dd { margin:0; font-weight:650; overflow-wrap:anywhere; }
.douyin-connect-card h3 { margin:0 0 12px; }
.douyin-connect-card label { display:grid; gap:5px; }
.douyin-connect-card :is(input,select),.douyin-query-card select { width:100%; min-width:0; padding:8px 10px; border:1px solid var(--line); border-radius:7px; background:#fff; }
.douyin-connect-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin:12px 0 20px; }
.douyin-connect-row { display:grid; grid-template-columns:auto minmax(0,1fr) minmax(0,1.5fr) auto; gap:8px; margin-bottom:9px; }
@media (max-width:640px) { .douyin-connect-row { grid-template-columns:auto minmax(0,1fr); } }
.douyin-connect-actions { display:flex; gap:8px; margin-top:14px; }
.douyin-query-card select { width:auto; max-width:100%; }
@media (max-width:700px) { .douyin-connect-fields { grid-template-columns:1fr; } }
