:root {
  --primary: #1a56db;
  --primary-dark: #143fa8;
  --primary-light: #e8f0ff;
  --success: #0e9f6e;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1f2937;
  --text2: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative;
  -webkit-tap-highlight-color: transparent;
}
#app { padding-bottom: 68px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(26,86,219,.25);
}
.topbar h1 { font-size: 16px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: 11px; opacity: .85; }
.topbar .msg-btn { position: relative; background: rgba(255,255,255,.15); border: none; color: #fff; border-radius: 50%; width: 34px; height: 34px; font-size: 16px; cursor: pointer; }
.topbar .badge {
  position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff;
  font-size: 10px; border-radius: 10px; padding: 1px 5px; min-width: 16px; text-align: center;
}

/* 底部导航 */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  background: #fff; border-top: 1px solid var(--border); display: flex; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
  flex: 1; text-align: center; padding: 8px 2px; font-size: 11px; color: var(--text2);
  cursor: pointer; user-select: none; position: relative;
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  white-space: nowrap; /* R9-5：窄屏页签文字不换行 */
}
.bottom-nav .nav-item.active { color: var(--primary); font-weight: 600; }
.bottom-nav .nav-item .ico { font-size: 19px; display: block; margin-bottom: 2px; }
.bottom-nav .nav-item .dot {
  position: absolute; top: 3px; right: calc(50% - 18px); background: var(--danger);
  border-radius: 8px; color: #fff; font-size: 9px; padding: 0 4px;
}

/* R10-04 更多抽屉 */
.more-drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
.more-drawer {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  background: #fff; border-radius: 14px 14px 0 0; z-index: 91;
  max-height: 60vh; overflow-y: auto; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
}
.more-drawer .drawer-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text2); }
.more-drawer .drawer-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px; min-height: 44px;
  border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px;
}
.more-drawer .drawer-item.active { color: var(--primary); font-weight: 600; }
.more-drawer .drawer-item .ico { font-size: 18px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); margin: 10px 12px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .more { font-size: 12px; color: var(--primary); cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: none; border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: opacity .15s; user-select: none;
}
.btn:active { opacity: .75; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warning); color: #fff; }
.btn-ghost { background: #f3f4f6; color: var(--text); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px; font-size: 15px; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
.field .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px;
  font-size: 14px; background: #fff; outline: none; font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(26,86,219,.12); }
.textarea { min-height: 64px; resize: vertical; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; }
.tag-green { background: #e7f7ef; color: var(--success); }
.tag-blue { background: #e8f0ff; color: var(--info); }
.tag-orange { background: #fdf3e3; color: var(--warning); }
.tag-red { background: #fdeaea; color: var(--danger); }
.tag-gray { background: #f3f4f6; color: var(--text2); }

/* 列表项 */
.list-item {
  background: #fff; border-radius: var(--radius); padding: 13px 14px; margin: 8px 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); cursor: pointer; transition: transform .1s;
}
.list-item:active { transform: scale(.99); }
.list-item .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.list-item .title { font-size: 14px; font-weight: 600; }
.list-item .desc { font-size: 12px; color: var(--text2); margin: 3px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.list-item .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--text2); }

/* 进度条 */
.steps { display: flex; overflow-x: auto; padding: 4px 0; }
.step-item { flex: 1; min-width: 62px; text-align: center; position: relative; }
.step-item .s-dot { width: 20px; height: 20px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; font-size: 11px; background: #e5e7eb; color: #9ca3af; position: relative; z-index: 1; }
.step-item.done .s-dot { background: var(--success); color: #fff; }
.step-item.cur .s-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px rgba(26,86,219,.2); }
.step-item.rejected .s-dot { background: var(--danger); color: #fff; }
.step-item .s-label { font-size: 10px; margin-top: 4px; color: var(--text2); white-space: nowrap; }
.step-item.done .s-label, .step-item.cur .s-label { color: var(--primary); font-weight: 600; }
.steps .step-item:not(:last-child)::after {
  content: ''; position: absolute; top: 10px; left: 50%; width: 100%; height: 2px;
  background: #e5e7eb; z-index: 0;
}
.steps .step-item.done:not(:last-child)::after { background: var(--success); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0;
  padding: 18px 16px 24px; max-height: 82vh; overflow-y: auto;
  animation: slideUp .2s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .m-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; }
.modal .m-close { cursor: pointer; color: var(--text2); font-size: 18px; }

/* toast */
.toast {
  position: fixed; top: 15%; left: 50%; transform: translateX(-50%); z-index: 200;
  background: rgba(0,0,0,.78); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; max-width: 84%; text-align: center; animation: fadeIn .2s;
}
.toast.err { background: rgba(220,38,38,.92); }
.toast.ok { background: rgba(14,159,110,.95); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 骨架屏 */
.skeleton { background: linear-gradient(90deg,#f0f1f4 25%,#e2e4e8 50%,#f0f1f4 75%); background-size: 200% 100%; animation: shim 1.2s infinite; border-radius: 8px; height: 14px; margin: 8px 0; }
@keyframes shim { to { background-position: -200% 0; } }

/* 空态 */
.empty { text-align: center; padding: 40px 0; color: var(--text2); }
.empty .ico { font-size: 40px; margin-bottom: 8px; opacity: .4; }

/* 登录页 */
.login-page { padding: 20px; }
.login-logo {
  width: 72px; height: 72px; border-radius: 18px; margin: 30px auto 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center; font-size: 36px; color: #fff;
}
.login-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 12px; color: var(--text2); margin-bottom: 24px; }
.role-item {
  display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); cursor: pointer;
}
.role-item .avatar {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
}
.role-item .r-name { font-weight: 600; font-size: 14px; }
.role-item .r-role { font-size: 11px; color: var(--text2); }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-cell { background: #fff; border-radius: 10px; padding: 10px 8px; text-align: center; }
.stat-cell .num { font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-cell .lbl { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* 配件树选择器 */
.tree-sel { border: 1px solid var(--border); border-radius: 8px; padding: 8px; max-height: 180px; overflow-y: auto; background: #fff; }
.tree-node { padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.tree-node:hover, .tree-node.active { background: var(--primary-light); color: var(--primary); }
.tree-node .arrow { font-size: 10px; color: var(--text2); }

/* 明细表格 */
.detail-grid { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 13px; }
.detail-grid .k { color: var(--text2); }
.detail-grid .v { word-break: break-all; }

/* 分段控件 */
.seg { display: flex; background: #e8eaef; border-radius: 9px; padding: 3px; margin-bottom: 12px; }
.seg .seg-item { flex: 1; text-align: center; padding: 7px 4px; border-radius: 7px; font-size: 13px; color: var(--text2); cursor: pointer; }
.seg .seg-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 消息 */
.msg-item { display: flex; gap: 10px; padding: 12px 14px; background: #fff; border-radius: 12px; margin: 8px 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.msg-item .m-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.msg-item.unread { border-left: 3px solid var(--primary); }
.msg-item .m-title { font-size: 13px; font-weight: 600; }
.msg-item .m-time { font-size: 11px; color: var(--text2); margin-top: 3px; }

/* 金额 */
.money { color: var(--danger); font-weight: 700; }
.money-in { color: var(--success); font-weight: 700; }

.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }
.text2 { color: var(--text2); }
.flex1 { flex: 1; }
.mt8 { margin-top: 8px; }
.mb8 { margin-bottom: 8px; }
.center { text-align: center; }


/* K-06 单据流转时间线 */
.timeline { padding: 4px 0 0 4px; }
.tl-item { display: flex; gap: 10px; position: relative; padding-bottom: 12px; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--border); }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 5px; position: relative; z-index: 1; }
.tl-body { flex: 1; min-width: 0; }
.tl-label { font-size: 13px; font-weight: 600; }
.tl-detail { font-size: 12px; margin-top: 2px; word-break: break-all; }
.tl-time { font-size: 11px; margin-top: 2px; }

/* K-25 移动端适配：窄屏下卡片、表格、弹窗不横向溢出 */
@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 92px 1fr !important; }
  .card { border-radius: 10px; }
  .row { flex-wrap: wrap; }
  .modal, .modal-box, .dialog { max-width: 100% !important; width: 100% !important; margin: 0 !important; border-radius: 12px 12px 0 0; }
  .tabs, .seg { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs .tab, .seg .seg-item { flex-shrink: 0; min-height: 40px; }
  .btn, .btn-sm { min-height: 40px; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .timeline { padding-left: 0; }
}
