:root {
  --ink: #1b2733;
  --muted: #6c7c8d;
  --brand: #1f4f7a;
  --brand-2: #2f6da3;
  --bg: #f2f5f8;
  --card: #ffffff;
  --line: #e2e8f0;
  --ok: #2c7a5b;
  --warn: #b4532a;
  --danger: #b23b3b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(24, 45, 66, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  background: linear-gradient(135deg, #1f4f7a, #2a6496);
  color: #fff;
  box-shadow: 0 2px 10px rgba(16, 42, 66, 0.18);
}

.brand { font-size: 19px; font-weight: 700; letter-spacing: 0.5px; }
.tagline { font-size: 12px; opacity: 0.78; margin-top: 2px; }

.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 14px 14px 30px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--brand);
  margin-bottom: 12px;
}

.section-head .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  margin-right: 8px;
}

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  color: var(--ink);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand-2);
  background: #fff;
}

textarea { min-height: 78px; resize: vertical; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  background: #f7fafc;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chip small { opacity: 0.65; margin-left: 4px; }

.staff-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-radius: 12px;
  padding: 8px 12px;
  line-height: 1.25;
}

.staff-chip span { font-size: 11px; opacity: 0.7; margin-top: 2px; }

.fixed-tag {
  font-style: normal;
  font-size: 10px;
  line-height: 1.4;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.24);
}

.staff-chip:not(.active) .fixed-tag { background: #e6edf4; color: #5b7186; }

.lock {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #6b7f92;
  background: #eef2f6;
  border-radius: 8px;
}

.seg {
  display: inline-flex;
  background: #eef2f6;
  border-radius: 10px;
  padding: 3px;
  flex: 0 0 auto;
}

.seg button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}

.seg button.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.party { display: grid; grid-template-columns: 96px 1fr 34px; gap: 8px; margin-bottom: 10px; }
.party select, .party input { padding: 9px 10px; font-size: 15px; }
.party .phone { grid-column: 1 / 3; }
.party .del {
  grid-column: 3;
  grid-row: 1;
  border: 0;
  background: #f6ecec;
  color: var(--danger);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}

.plus {
  border: 1px dashed #b9c7d6;
  background: #f8fafc;
  color: var(--brand-2);
  border-radius: 10px;
  padding: 9px;
  width: 100%;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.muted { color: var(--muted); }

.primary, .ghost, .danger {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.primary { background: var(--brand); color: #fff; }
.primary:active { background: #173e60; }
.ghost { background: #eef3f8; color: var(--brand); }
.danger { background: #fbecec; color: var(--danger); }
.big { width: 100%; padding: 14px; font-size: 17px; font-weight: 600; }

.actions { margin: 4px 0 10px; }
.actions .ghost.big { background: #fff; border: 1px solid #c7d5e3; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #eef2f6;
  aspect-ratio: 1 / 1;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: blur(8px);
}

.tabbar button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.tabbar button b { font-size: 18px; font-weight: 500; }
.tabbar button.active { color: var(--brand); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(27, 39, 51, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(14, 28, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  background: #fff;
  border-radius: 18px;
  padding: 26px 22px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.gate-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.gate-card h2 { margin: 0 0 4px; font-size: 19px; }
.gate-card input { margin: 16px 0 12px; text-align: center; letter-spacing: 4px; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(14, 28, 42, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-card {
  background: #fff;
  width: 100%;
  max-width: 820px;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow: auto;
}
.sheet-card h3 { margin: 0 0 4px; font-size: 20px; }

.file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.file-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 8px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.file-btn small { font-weight: 400; font-size: 11px; opacity: 0.75; }
.file-btn.pdf { background: #fdeeee; color: #a33535; }
.file-btn.docx { background: #eaf1fb; color: #235a9c; }
.file-btn.xls { background: #e8f4ec; color: #1f6b45; }
.file-btn.zip { background: #e9eef5; color: #1f4a72; }
.file-btn.wide { grid-column: 1 / -1; padding: 12px 8px; }
.file-btn.disabled { opacity: 0.45; pointer-events: none; }

.batch-card { border: 1px solid #d5e0eb; }
.batch-list { display: flex; flex-direction: column; gap: 6px; }
.batch-item { border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; overflow: hidden; }
.batch-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; }
.batch-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.batch-title b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-title span { font-size: 11px; color: var(--muted); margin-top: 2px; }
.batch-caret { color: var(--muted); font-size: 18px; transition: transform 0.15s; }
.batch-detail { padding: 0 12px 10px; }
.batch-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.batch-tags span { font-size: 12px; background: #eef3f8; border-radius: 6px; padding: 3px 7px; color: #47617a; }
.batch-actions { display: flex; gap: 8px; }
.batch-actions button { font-size: 12px; padding: 6px 10px; }

.progress { height: 8px; background: #eef2f6; border-radius: 999px; overflow: hidden; margin: 14px 0 8px; }
.progress i { display: block; height: 100%; width: 3%; background: var(--brand); transition: width 0.3s; }

.pdf-list { margin-top: 12px; font-size: 13px; }
.pdf-list summary { cursor: pointer; color: var(--brand); padding: 6px 0; }
.pdf-list a { display: block; padding: 8px 4px; border-bottom: 1px solid var(--line); color: #31485e; text-decoration: none; }

.client-card .hint { margin-top: 6px; }

.summary {
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 10px;
  max-height: 260px;
  overflow: auto;
}

.copy-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.copy-row button { flex: 1; min-width: 110px; }

.sheet-actions { display: flex; gap: 10px; }
.sheet-actions > * { flex: 1; }

.rec-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 15px;
  margin-bottom: 10px;
}
.rec-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rec-client { font-weight: 700; font-size: 16px; }
.rec-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rec-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: #47617a;
}
.pill.ok { background: #e7f4ee; color: var(--ok); }
.pill.warn { background: #fbf0e6; color: var(--warn); }
.rec-summary {
  font-size: 13px;
  color: #44566a;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 6px 0 10px;
}
.rec-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rec-actions a, .rec-actions button {
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 8px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.rec-actions .dl { background: #eaf1fb; color: #235a9c; }
.rec-actions .dl.pdf { background: #fdeeee; color: #a33535; }
.rec-actions .mut { background: #f1f4f7; color: #55697e; }
.rec-actions .del { background: #fbecec; color: var(--danger); }

.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters input { flex: 1; }
.filters .primary { flex: 0 0 auto; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}

.client-card { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.client-card .acts { display: flex; gap: 6px; flex: 0 0 auto; }
.client-card .acts button { font-size: 12px; padding: 6px 9px; }

.taglist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.taglist span { font-size: 12px; background: #f1f5f9; border-radius: 6px; padding: 3px 7px; color: #4b6076; }

.staff-row { display: grid; grid-template-columns: 90px 1fr 34px; gap: 8px; margin-bottom: 8px; }
.staff-row input { padding: 9px 10px; font-size: 15px; }
.staff-row .del { border: 0; background: #f6ecec; color: var(--danger); border-radius: 8px; font-size: 18px; cursor: pointer; }

.settings-note { font-size: 12px; color: var(--muted); line-height: 1.6; }
.settings-note code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; }

.hidden { display: none !important; }

@media (min-width: 700px) {
  .party { grid-template-columns: 110px 1fr 34px; }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 手机版补充 ---------- */
.privacy-box {
  background: #f1f7f3;
  border: 1px solid #cfe4d8;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #255843;
  line-height: 1.6;
}
.storage-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 8px 0; }
.storage-bar { height: 8px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.storage-bar i { display: block; height: 100%; background: var(--brand-2); width: 0; }
.backup-warn {
  background: #fdf3e7;
  border: 1px solid #f0d2ae;
  color: #8a4b12;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.install-steps { font-size: 13px; color: #44566a; line-height: 1.8; }
.install-steps b { color: var(--ink); }
.offline-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3a9b6e; margin-right: 5px; }
button.file-btn { border: 0; font-family: inherit; cursor: pointer; }
.plain-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 9px 4px;
  color: #31485e;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.batch-card { scroll-margin-top: 86px; }
/* iPhone 刘海屏：顶栏让出状态栏高度 */
.topbar { padding-top: calc(14px + env(safe-area-inset-top)); }