/* 头发蛋采购 · 巡厂式手机卡片风格（flat，无渐变无阴影） */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2937;
  --sub: #6b7280;
  --line: #e5e7eb;
  --blue: #1667d9;
  --blue-soft: #e8f0fc;
  --green: #1a7f4e;
  --green-soft: #e6f4ec;
  --red: #c0392b;
  --red-soft: #fdecea;
  --amber: #b7791f;
  --amber-soft: #fdf3e3;
  --purple: #6d4fc4;
  --purple-soft: #efeafb;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 24px; text-align: center; }
.login-logo { font-size: 40px; }
.login-card h1 { font-size: 20px; margin: 8px 0 4px; }
.login-card .sub { color: var(--sub); font-size: 13px; margin-bottom: 24px; }
.login-card input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: var(--bg); }
.login-card input:focus { outline: 2px solid var(--blue); border-color: transparent; }
.login-hint { color: var(--sub); font-size: 12px; margin-top: 16px; }

/* 主框架：手机限宽居中 */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; background: var(--blue); color: #fff; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
.topbar h2 { font-size: 17px; font-weight: 600; flex: 1; }
.back-btn { color: #fff; font-size: 26px; line-height: 1; padding: 0 6px; }
.top-user { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.role-chip { background: rgba(255,255,255,.22); border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.content { padding: 12px 12px 84px; }
.ledger-status { background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid var(--line); padding: 10px 14px; font-size: 13px; }

/* 底部导航 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--sub); font-size: 11px; min-height: 56px; }
.tab .tab-ico { font-size: 20px; line-height: 1.2; }
.tab.active { color: var(--blue); font-weight: 600; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-title { font-weight: 600; font-size: 15px; }
.card-sub { color: var(--sub); font-size: 12px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--sub); }
.kv .v { text-align: right; font-variant-numeric: tabular-nums; }
.kv .v.wide { grid-column: 1 / -1; text-align: left; }
.row-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
.row-line .k { color: var(--sub); }
.divider { border-top: 1px dashed var(--line); margin: 8px 0; }

/* 余额卡 */
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.balance-card { border-radius: var(--radius); padding: 12px 14px; border: 1px solid var(--line); background: var(--card); }
.balance-card .label { font-size: 12px; color: var(--sub); display: flex; justify-content: space-between; align-items: center; }
.balance-card .amount { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.balance-card.cny .amount { color: var(--red); }
.balance-card.usd .amount { color: var(--green); }
.balance-card.uzs .amount { color: var(--purple); }
.balance-card.prepay .amount { color: var(--amber); }
.chip { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.gray { background: var(--bg); color: var(--sub); }
.chip.purple { background: var(--purple-soft); color: var(--purple); }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; }
.kpi .n { font-size: 17px; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.kpi .t { font-size: 11px; color: var(--sub); margin-top: 2px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 11px 16px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); padding: 6px 8px; min-height: 32px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; }
.fab { position: fixed; bottom: calc(72px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: calc(100% - 24px); max-width: 496px; z-index: 25; }
.fab .btn { width: 100%; box-shadow: none; }

/* 列表菜单（更多） */
.menu { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px; font-size: 15px; border-bottom: 1px solid var(--line); text-align: left; }
.menu-item:last-child { border-bottom: none; }
.menu-item .ico { font-size: 18px; }
.menu-item .arr { margin-left: auto; color: var(--sub); }
.menu-item .desc { display: block; font-size: 12px; color: var(--sub); }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--sub); margin-top: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue); border-color: transparent; }
.field input:disabled, .field select:disabled { background: var(--bg); color: var(--sub); }
.field input.invalid { border-color: var(--red); outline: 1px solid var(--red); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.req::after { content: " *"; color: var(--red); }

/* 预览框 */
.preview { background: var(--blue-soft); border: 1px solid var(--blue); border-radius: var(--radius); padding: 12px; margin: 12px 0; font-size: 13px; }
.preview .row-line .v { font-weight: 600; }
.preview.warn { background: var(--red-soft); border-color: var(--red); }
.preview .big { font-size: 17px; font-weight: 700; }

/* 照片 */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.thumb-wrap { position: relative; }
.thumb-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; line-height: 1; }
.thumb.big { aspect-ratio: 4/3; }
.photo-empty { border: 1px dashed var(--line); border-radius: 8px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 12px; }

/* 全屏表单 sheet */
.sheet { position: fixed; inset: 0; max-width: 520px; margin: 0 auto; background: var(--bg); z-index: 40; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; gap: 8px; background: var(--blue); color: #fff; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
.sheet-head .back-btn { font-size: 26px; }
.sheet-title { font-size: 16px; font-weight: 600; flex: 1; }
.sheet-spacer { width: 32px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px 14px 32px; }
.section-title { font-size: 14px; font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.section-title:first-child { margin-top: 0; }
.section-title .sc-sub { font-weight: 400; font-size: 12px; color: var(--sub); }

/* 分配行 */
.alloc-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--card); }
.alloc-row .top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.alloc-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--blue); }
.alloc-row .weight-input { margin-top: 8px; }
.alloc-row .weight-input input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 12px; }
.modal .modal-text { font-size: 14px; margin-bottom: 14px; white-space: pre-line; }
.camera-panel video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.camera-status { font-size: 13px; color: var(--sub); margin: 8px 0; min-height: 20px; }
.photo-view img { width: 100%; border-radius: 10px; }

/* toast */
.toast { position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 18px; font-size: 13px; z-index: 60; max-width: 90vw; text-align: center; }
.toast.err { background: var(--red); }

/* 空态 */
.empty { text-align: center; color: var(--sub); padding: 40px 16px; font-size: 14px; }
.empty .ico { font-size: 36px; display: block; margin-bottom: 8px; }

/* 金额币种色 */
.amt-usd { color: var(--green); font-weight: 600; }
.amt-cny { color: var(--red); font-weight: 600; }
.amt-uzs { color: var(--purple); font-weight: 600; }
.muted { color: var(--sub); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }