/* =====================================================
   客户管理-店员端 — 暖白活力风格
   暖米白底 · 珊瑚橙主色 · 大圆角 · 柔和阴影
   ===================================================== */

/* —— 主题变量 —— */
:root {
    --bg: #FAF6F0;
    --bg2: #F4ECE2;
    --card: #FFFFFF;
    --card2: #FFF9F4;
    --ink: #3D2E23;
    --ink2: #A89888;
    --ink3: #C5B7A8;
    --brand: #F07856;
    --brand-deep: #E05B3D;
    --brand-soft: #FDE9E1;
    --accent: #F2B544;
    --accent-soft: #FBF0DA;
    --danger: #E5484D;
    --danger-soft: #FCE9EA;
    --line: #EFE5DA;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow: 0 8px 24px -16px rgba(61, 46, 35, 0.25);
}

/* —— Reset —— */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px; color: var(--ink); background: var(--bg);
    line-height: 1.5; -webkit-font-smoothing: antialiased;
    display: flex; flex-direction: column;
}
button { font-family: inherit; border: none; outline: none; cursor: pointer; background: none; }
input, select { font-family: inherit; font-size: 14px; outline: none; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; height: 42px; color: var(--ink); background: var(--card); }

/* —— 统一 SVG 图标 —— */
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ic-lg { width: 26px; height: 26px; }
.ic-sm { width: 18px; height: 18px; }
.ic-tab { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* —— Header —— */
.app-header {
    height: 48px; background: var(--card); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; padding: 0 12px; flex-shrink: 0;
}
.app-header h1 { flex: 1; text-align: center; font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: 1px; }
.back-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--brand-deep); }

/* —— Main —— */
.app-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 66px; }

/* —— Tab Bar —— */
.app-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px; background: var(--card); border-top: 1px solid var(--line);
    display: flex; z-index: 99; padding-bottom: env(safe-area-inset-bottom);
}
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink3); font-size: 10px; gap: 3px; }
.tab-item.active { color: var(--brand-deep); }
.tab-item.active .tab-label { font-weight: 700; }

/* —— Cards —— */
.card { background: var(--card); margin: 10px 14px; border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-size: 13px; font-weight: 600; color: var(--ink2); margin-bottom: 10px; }
.section { background: var(--card); margin: 8px 14px; border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.section-title { font-size: 12px; color: var(--ink2); margin-bottom: 8px; font-weight: 500; }

/* —— Buttons —— */
.btn { display: block; width: 100%; height: 46px; line-height: 46px; text-align: center; font-size: 16px; font-weight: 600; border-radius: var(--radius); transition: transform .06s, filter .2s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; box-shadow: 0 8px 20px -6px var(--brand); }
.btn-secondary { background: var(--bg2); color: var(--ink); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
/* 成功按钮：浅绿（原先漏了定义，导致「确认提交入网」等只显示成一行文字） */
.btn-success { background: linear-gradient(135deg, #4BD07D, #2FA95C); color: #fff; box-shadow: 0 8px 20px -6px rgba(47, 169, 92, .55); }
/* 默认按钮：中性白底描边（原先漏了定义） */
.btn-default { background: var(--card); color: var(--ink2); border: 1px solid var(--line); }
/* 提交中/禁用态：变淡，避免看起来还能点 */
.btn:disabled { opacity: .55; box-shadow: none; }

/* —— Form —— */
.form-item { margin-bottom: 8px; }
.form-item label { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 5px; }
.form-input { width: 100%; background: var(--card2); }
.form-input:focus { border-color: var(--brand); background: #fff; }

/* —— Steps —— */
.steps { display: flex; padding: 12px 16px; gap: 0; }
.step { flex: 1; text-align: center; font-size: 10px; color: var(--ink3); position: relative; padding-top: 16px; }
.step::before {
    content: ''; position: absolute; top: 3px; left: 50%;
    width: 9px; height: 9px; border-radius: 50%; background: var(--bg2); border: 2px solid var(--ink3);
    transform: translateX(-50%); z-index: 1;
}
.step.active { color: var(--brand-deep); font-weight: 700; }
.step.active::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step.done { color: var(--brand-deep); }
.step.done::before { background: var(--brand); border-color: var(--brand); }
.step + .step::after { content: ''; position: absolute; top: 7px; right: 50%; width: 100%; height: 1px; background: var(--line); }
.step.done + .step::after { background: var(--brand); }

/* —— Data Rows —— */
.data-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.data-row:last-child { border-bottom: none; }
.data-label { color: var(--ink2); flex-shrink: 0; }
.data-value { color: var(--ink); text-align: right; max-width: 62%; word-break: break-all; }

/* —— ID Card Display —— */
.idcard-display { display: flex; gap: 10px; align-items: flex-start; }
.idcard-portrait {
    width: 72px; height: 92px; background: var(--bg2); border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink3); overflow: hidden;
}
.idcard-portrait img { width: 100%; height: 100%; object-fit: cover; }
.idcard-info { flex: 1; min-width: 0; }

/* —— Photo Areas —— */
.photo-row { display: flex; gap: 10px; }
.photo-box {
    flex: 1; aspect-ratio: 16/10; background: var(--bg2); border: 1.5px dashed var(--line); border-radius: 14px;
    display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink3); cursor: pointer; overflow: hidden;
}
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.photo-box.has-photo { border-style: solid; border-color: var(--brand); }

/* —— Fixed Bottom Bar —— */
.bottom-bar { background: var(--card); border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; flex-shrink: 0; }
.bottom-bar .btn { flex: 1; }

/* —— User Card —— */
.user-card {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 16px; margin: 10px 14px; background: var(--card); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.user-avatar {
    width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
}
.user-name { font-size: 16px; font-weight: 700; }
.user-sub { font-size: 12px; color: var(--ink2); margin-top: 2px; }

/* —— Stats —— */
.stat-row { display: flex; gap: 10px; padding: 0 14px; }
.stat-item { flex: 1; background: var(--card); border-radius: var(--radius-lg); padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 23px; font-weight: 700; color: var(--brand-deep); font-family: "SF Mono", ui-monospace, monospace; }
.stat-label { font-size: 11px; color: var(--ink2); margin-top: 3px; }

/* —— Home Grid —— */
.grid-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 10px 14px; }
.grid-item {
    background: var(--card); border-radius: var(--radius-lg); padding: 17px 8px; text-align: center; cursor: pointer;
    box-shadow: var(--shadow); transition: transform .1s;
}
.grid-item:active { transform: scale(.96); }
.grid-icon {
    width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 14px;
    background: var(--brand-soft); color: var(--brand-deep);
    display: flex; align-items: center; justify-content: center;
}
.grid-item-label { font-size: 13px; color: var(--ink); font-weight: 600; }

/* —— Lists —— */
.list-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: var(--card2); margin: 0 -14px; padding: 12px 14px; border-radius: 12px; }
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 600; }
.list-item-sub { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.list-item-meta { text-align: right; flex-shrink: 0; margin-left: 8px; }
.list-item-status { font-size: 11px; margin-bottom: 2px; }
.list-item-time { font-size: 10px; color: var(--ink3); }

/* —— Status Colors —— */
.status-pending_write { color: var(--accent); }
.status-written, .status-done { color: var(--brand-deep); }
.status-discarded, .status-failed { color: var(--danger); }
.status-processing { color: var(--brand-deep); }

/* —— Menu —— */
.menu-item {
    display: flex; justify-content: space-between; padding: 14px 0;
    border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; align-items: center;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { color: var(--brand-deep); }
.menu-item .arrow { color: var(--ink3); }

/* —— Tag —— */
.tag { display: inline-block; font-size: 11px; padding: 4px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.tag-green { background: var(--brand-soft); color: var(--brand-deep); }
.tag-amber { background: var(--accent-soft); color: #B97A1E; }
.tag-red { background: var(--danger-soft); color: var(--danger); }
.tag-gray { background: var(--bg2); color: var(--ink2); }

/* —— Misc —— */
.filter-row { display: flex; gap: 8px; margin-top: 8px; }
.account-display { font-size: 13px; color: var(--brand-deep); }
.empty-state { text-align: center; padding: 30px 20px; color: var(--ink3); font-size: 13px; }
.sign-canvas { width: 100%; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.face-video { width: 100%; max-width: 300px; aspect-ratio: 3/4; background: #000; border-radius: 14px; margin: 0 auto; display: block; object-fit: cover; }

/* —— Progress —— */
.progress-bar { height: 3px; background: var(--bg2); border-radius: 2px; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.3s; }

/* —— Toast —— */
.toast-box { position: fixed; top: 56px; left: 50%; transform: translateX(-50%); z-index: 10000; pointer-events: none; }
.toast-msg { background: rgba(61, 46, 35, 0.88); color: #fff; padding: 9px 18px; border-radius: 999px; font-size: 13px; animation: toastIn 0.2s; white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* —— Loading —— */
.loading-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(250, 246, 240, 0.85); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.loading-spinner { width: 32px; height: 32px; border: 2px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading-text { color: var(--ink2); font-size: 13px; margin-top: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* —— Scrollbar —— */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

/* —— 自定义确认框（替代原生 confirm，不显示来源域名） —— */
.confirm-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(61, 46, 35, 0.45); z-index: 20000; display: flex; align-items: center; justify-content: center; }
.confirm-box { background: #fff; border-radius: 20px; padding: 26px 20px 18px; width: 78%; max-width: 300px; text-align: center; box-shadow: 0 20px 50px -20px rgba(0,0,0,.4); }
.confirm-msg { font-size: 15px; color: var(--ink); margin-bottom: 22px; line-height: 1.55; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btn { flex: 1; height: 42px; border-radius: 13px; font-size: 15px; font-weight: 600; cursor: pointer; }
.confirm-btn.cancel { background: var(--bg2); color: var(--ink2); }
.confirm-btn.ok { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; }
