/* ============ 全局 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --ink: #16283b;
  --ink-2: #54657a;
  --ink-3: #8797a8;
  --line: #e4e9f0;
  --bg: #f4f6f9;
  --card: #ffffff;
  --brand: #1e5f74;          /* 深藏青 主色 */
  --brand-2: #2e84a0;
  --brand-soft: #e6f2f6;
  --blue: #2e6fc2;
  --green: #2e9e5b;
  --amber: #d9911f;
  --red: #d64545;
  --violet: #7b5fd0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22,40,59,.06);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html, body { height: 100%; }
body {
  font-family: "Noto Sans SC", -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 20% 0%, #eef3f7 0%, #dfe7ef 55%, #cfd9e4 100%);
}

/* ============ 舞台布局 ============ */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 40px 24px;
  flex-wrap: wrap;
}
android-device {
  box-shadow: 0 24px 60px rgba(20,40,60,.35), 0 4px 14px rgba(20,40,60,.18);
}
.side-note { width: 320px; color: #2a3f52; }
.side-tag {
  display: inline-block; font-size: 12px; letter-spacing: 2px; color: var(--brand);
  background: #fff; border: 1px solid #cfe0e8; padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.side-note h1 { font-size: 34px; font-weight: 700; letter-spacing: .5px; margin-bottom: 8px; }
.side-sub { font-size: 14px; color: var(--brand); margin-bottom: 22px; }
.side-desc { font-size: 14px; line-height: 1.9; color: #50657a; margin-bottom: 18px; }
.side-guide { list-style: none; font-size: 13px; color: #60768a; line-height: 2; padding-left: 2px; }
.side-guide li::before { content: "▪ "; color: var(--brand-2); }

/* ============ 移动端真机适配：隐藏侧栏，手机壳铺满全屏（尺寸由 app.js 动态设置） ============ */
@media (max-width: 900px) {
  .stage { padding: 0; gap: 0; display: block; }
  .side-note { display: none; }
}

/* ============ 登录页 ============ */
.login-wrap {
  padding: 74px 30px 30px; min-height: 100%;
  display: flex; flex-direction: column; background: var(--bg);
}
.brand-mark {
  width: 64px; height: 64px; border-radius: 18px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; margin-bottom: 20px;
  box-shadow: 0 10px 24px rgba(30,95,116,.28);
}
.brand-mark svg { width: 36px; height: 36px; }
.brand-name { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.brand-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 40px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.field input {
  width: 100%; height: 50px; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px;
  font-size: 15px; background: #fff; color: var(--ink); outline: none; transition: border .15s;
}
.field input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.btn-primary {
  background: var(--brand); color: #fff; border: none; border-radius: 12px; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: background .15s, transform .05s;
}
.btn-primary:active { background: var(--brand-2); transform: scale(.99); }
.btn-block { width: 100%; height: 52px; margin-top: 10px; }
.login-tip { margin-top: 20px; text-align: center; font-size: 12px; color: var(--ink-3); }

/* ============ 应用壳 ============ */
.screen { height: 100%; display: none; background: var(--bg); }
.screen.active { display: block; }
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: #fff; border-bottom: 1px solid var(--line);
}
.appbar-title { font-size: 17px; font-weight: 600; }
.appbar-back { display: flex; align-items: center; gap: 4px; font-size: 15px; color: var(--ink); cursor: pointer; background:none;border:none;padding:4px 6px; }
.appbar-back svg { width: 20px; height: 20px; }
.appbar-right { display: flex; align-items: center; gap: 12px; }
.page { padding-bottom: 74px; }
.page.no-nav { padding-bottom: 0; }

/* ============ 底部导航 ============ */
.bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; height: calc(60px + var(--safe-b));
  padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: flex-start; padding-top: 8px;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; color: var(--ink-3); cursor: pointer; background: none; border: none; padding: 2px;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--brand); font-weight: 600; }
.nav-item.active svg { color: var(--brand); }

/* ============ 通用组件 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.b-draft  { background: #eef0f3; color: #5a6676; }
.b-pending{ background: #fdf1de; color: var(--amber); }
.b-doing  { background: #e5eefc; color: var(--blue); }
.b-buy    { background: #e5eefc; color: var(--blue); }
.b-approve{ background: #e5eefc; color: var(--blue); }
.b-done   { background: #e6f6ec; color: var(--green); }
.b-reject { background: #fcebeb; color: var(--red); }
.b-give   { background: #f0ebfc; color: var(--violet); }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 16px; margin: 12px 16px;
}
.section-title { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 18px 16px 6px; }

/* 首页 */
.h-hello { display: flex; align-items: center; gap: 12px; padding: 18px 16px 6px; }
.h-avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px;
}
.h-hello .h-name { font-size: 17px; font-weight: 700; }
.h-hello .h-role { font-size: 12px; color: var(--ink-3); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px 4px; }
.stat {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line);
  padding: 16px; box-shadow: var(--shadow);
}
.stat .s-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .s-label { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.stat.blue .s-num { color: var(--blue); } .stat.blue { border-top: 3px solid var(--blue); }
.stat.amber .s-num { color: var(--amber); } .stat.amber { border-top: 3px solid var(--amber); }
.stat.green .s-num { color: var(--green); } .stat.green { border-top: 3px solid var(--green); }
.stat.brand .s-num { color: var(--brand); } .stat.brand { border-top: 3px solid var(--brand); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px 4px; }
.quick {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); cursor: pointer; text-align: left;
}
.quick .q-ico {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
}
.quick .q-ico svg { width: 22px; height: 22px; }
.quick .q-name { font-size: 14px; font-weight: 600; }
.quick .q-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.todo-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: #fff;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.todo-row:last-child { border-bottom: none; }
.todo-row .t-main { flex: 1; min-width: 0; }
.todo-row .t-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-row .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.todo-row .t-date { font-size: 11px; color: var(--ink-3); text-align: right; }

/* 列表筛选 */
.seg {
  display: flex; gap: 6px; padding: 6px 16px; overflow-x: auto; white-space: nowrap; background: #fff;
  border-bottom: 1px solid var(--line);
}
.seg-item {
  flex-shrink: 0; font-size: 13px; padding: 7px 14px; border-radius: 999px; color: var(--ink-2);
  background: var(--bg); border: 1px solid transparent; cursor: pointer;
}
.seg-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.searchbar { padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.searchbar .sb-in {
  display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 0 12px; height: 42px;
}
.searchbar svg { width: 18px; height: 18px; color: var(--ink-3); }
.searchbar input { border: none; background: none; flex: 1; font-size: 14px; outline: none; color: var(--ink); }

/* 列表行卡片 */
.row-card { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 16px; cursor: pointer; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-title { font-size: 15px; font-weight: 600; }
.row-mid { display: flex; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.row-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.row-meta svg { width: 15px; height: 15px; color: var(--ink-3); }
.row-arrow { color: var(--ink-3); }
.row-arrow svg { width: 18px; height: 18px; }

/* 详情 */
.detail-block { background: #fff; margin: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 6px 16px; }
.detail-block .d-title { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.d-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.d-row:last-child { border-bottom: none; }
.d-row .d-k { color: var(--ink-3); flex-shrink: 0; }
.d-row .d-v { text-align: right; color: var(--ink); font-weight: 500; }

/* 步骤条（签名元素） */
.stepper { display: flex; padding: 18px 14px 8px; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; min-width: 0; }
.step .s-dot {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #e8edf2; color: var(--ink-3); font-size: 12px; font-weight: 600; position: relative; z-index: 2;
}
.step .s-line { position: absolute; top: 13px; height: 3px; background: #e8edf2; left: 50%; width: 100%; }
.step:first-child .s-line { left: 50%; }
.step:last-child .s-line { left: -50%; }
.step .s-label { font-size: 11px; color: var(--ink-3); margin-top: 6px; text-align: center; white-space: nowrap; transform: scale(.94); }
.step.done .s-dot { background: var(--green); color: #fff; }
.step.done .s-line { background: var(--green); }
.step.cur .s-dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.step.cur .s-label { color: var(--brand); font-weight: 600; }
.step.reject .s-dot { background: var(--red); color: #fff; }
.step .s-dot svg { width: 14px; height: 14px; }

/* 时间线 */
.timeline { padding: 6px 4px; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; position: relative; }
.tl-item .tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand-2); margin-top: 5px; flex-shrink: 0; position: relative; z-index: 2; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 22px; bottom: -12px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-item .tl-main { flex: 1; }
.tl-item .tl-title { font-size: 14px; font-weight: 600; }
.tl-item .tl-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.tl-item .tl-time { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.tl-item.reject .tl-dot { background: var(--red); }
.tl-item.done .tl-dot { background: var(--green); }

/* 操作栏 */
.actionbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 12px 16px calc(12px + var(--safe-b)); display: flex; gap: 12px; }
.btn-action { flex: 1; height: 48px; border-radius: 12px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-action.primary { background: var(--brand); color: #fff; }
.btn-action.subtle { background: var(--brand-soft); color: var(--brand); }
.btn-action.warn { background: var(--red); color: #fff; }

/* 新建表单 */
.form-page { padding: 16px 16px 20px; }
.form-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 16px; }
.form-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.form-row:last-child { border-bottom: none; }
.form-row label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.form-row input, .form-row select {
  width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  font-size: 15px; outline: none; background: #fff; color: var(--ink);
}
.form-row input:focus, .form-row select:focus { border-color: var(--brand-2); }
.form-row textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 15px;
  outline: none; resize: none; font-family: inherit; min-height: 80px;
}
.submit-wrap { margin: 16px 0 8px; }

/* 空态 */
.empty { text-align: center; color: var(--ink-3); padding: 60px 20px; font-size: 14px; }
.empty svg { width: 56px; height: 56px; opacity: .4; margin-bottom: 12px; }

/* ============ 角色 ============ */
.role-row { background: #fff; border-bottom: 1px solid var(--line); padding: 15px 16px; cursor: pointer; }
.role-top { display: flex; align-items: center; gap: 12px; }
.role-ico { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.role-ico svg { width: 22px; height: 22px; }
.role-name { font-size: 15px; font-weight: 600; }
.role-people { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.role-arrow { margin-left: auto; color: var(--ink-3); }
.role-arrow svg { width: 18px; height: 18px; }
.perm-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 2px; }
.perm { font-size: 12px; padding: 6px 12px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.perm.off { background: var(--bg); color: var(--ink-3); }

/* 设备 */
.device-type { font-size: 12px; color: var(--ink-3); }

/* 浮动按钮 */
.fab {
  position: fixed; right: 24px; bottom: calc(86px + var(--safe-b)); z-index: 25;
  width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(30,95,116,.35); cursor: pointer;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { background: var(--brand-2); }

/* 照片上传 */
.photo-upload {
  width: 100%; height: 52px; border: 1.5px dashed var(--brand-2); border-radius: 12px; background: var(--brand-soft);
  color: var(--brand); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer;
}
.photo-upload svg { width: 20px; height: 20px; }
.photo-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.p-img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 0; }
.photo-grid .empty { padding: 20px; width: 100%; }

/* 我的 行 */
.me-row {
  display: flex; align-items: center; gap: 14px; width: 100%; background: none; border: none;
  padding: 14px 0; cursor: pointer; text-align: left; color: var(--ink); border-bottom: 1px solid var(--line);
}
.card .me-row:last-child { border-bottom: none; }
.me-ico { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.me-ico svg { width: 21px; height: 21px; }
.me-name { font-size: 15px; font-weight: 600; }
.me-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
