:root {
  --primary: #2F93D8;
  --primary-dark: #1F7BB8;
  --primary-soft: #EAF3FB;
  --bg: #F2F6FA;
  --card: #FFFFFF;
  --text: #1F2A44;
  --muted: #64748B;
  --line: #E6ECF2;
  --salary: #FF6B3D;
  --danger: #E5484D;
  --shadow: 0 4px 16px rgba(31, 42, 68, 0.06);
  --radius: 14px;
  --tab-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 手机容器 ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

/* ---------- 顶栏 ---------- */
.appbar {
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.appbar .ab-back {
  font-size: 22px;
  line-height: 1;
  width: 28px;
  cursor: pointer;
  user-select: none;
}
.appbar .ab-title { font-size: 17px; font-weight: 600; flex: 1; }
.appbar .ab-action {
  font-size: 14px;
  background: rgba(255,255,255,0.18);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

/* ---------- 内容区 ---------- */
.view {
  flex: 1 1 auto;
  padding: 12px 12px calc(var(--tab-h) + 24px);
  overflow-y: auto;
}
.view.no-tab { padding-bottom: 24px; }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 30;
}
.tabbar.hidden { display: none; }
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
}
.tab-item .ic { font-size: 20px; line-height: 1; }
.tab-item.active { color: var(--primary); font-weight: 600; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 14px 4px 8px;
}
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 首页头部 ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0; font-size: 20px; font-weight: 700; }
.hero p { margin: 6px 0 0; opacity: 0.9; font-size: 13px; }

/* 搜索 */
.search {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.search input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}
.search .si { color: var(--muted); margin-right: 8px; }

/* 城市筛选 */
.city-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.city-bar::-webkit-scrollbar { display: none; }
.city-chip {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.city-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* 职位卡 */
.job-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}
.job-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.job-title { font-size: 16px; font-weight: 600; color: var(--text); }
.job-status {
  flex: 0 0 auto;
  font-size: 11px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.job-salary { color: var(--salary); font-weight: 700; font-size: 16px; margin-top: 6px; }
.job-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 3px 9px;
  border-radius: 6px;
}

/* 空态 */
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 48px 24px;
  line-height: 1.8;
  white-space: pre-line;
}

/* ---------- 详情 ---------- */
.d-title { font-size: 20px; font-weight: 700; }
.d-salary { color: var(--salary); font-weight: 700; font-size: 20px; margin-top: 6px; }
.d-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.company { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.logo {
  width: 46px; height: 46px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.c-name { font-weight: 600; font-size: 15px; }
.c-desc { color: var(--muted); font-size: 12px; }
.line { padding: 6px 0; color: var(--text); font-size: 14px; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: none; }
.benefits { display: flex; flex-wrap: wrap; gap: 6px; }

/* 字段表单 */
.field { margin-bottom: 12px; }
.field-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  background: #fff;
  font-family: inherit;
}
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 64px; }
.readonly { padding: 11px 12px; color: var(--text); background: #F6F9FC; border-radius: 10px; }

/* 按钮 */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  user-select: none;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost {
  background: #fff;
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.agree-tip { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* 客服卡 */
.cs-card .cs-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
.cs-card .cs-row:last-child { border-bottom: none; }
.cs-card .cs-label { color: var(--muted); font-size: 14px; }
.cs-card .cs-value { color: var(--primary-dark); font-weight: 600; }

/* 我的页 */
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.p-name { font-size: 17px; font-weight: 700; }
.p-sub { font-size: 12px; color: var(--muted); }
.entry-row {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; user-select: none;
}
.entry-row .arrow { color: var(--muted); font-size: 20px; }

/* 后台统计 */
.stats { display: flex; gap: 10px; margin-bottom: 12px; }
.stat {
  flex: 1; background: var(--card); border-radius: var(--radius);
  padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .btn-primary, .toolbar .btn-ghost { width: auto; flex: 1; padding: 10px; font-size: 14px; }

/* 后台列表行 */
.row-item {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer; user-select: none;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; }
.row-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row-ops { display: flex; gap: 12px; flex: 0 0 auto; }
.op { color: var(--primary-dark); font-size: 13px; cursor: pointer; user-select: none; }
.op.danger { color: var(--danger); }

/* 登录 */
.login-box { max-width: 360px; margin: 8vh auto 0; }
.login-box .hero { text-align: center; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet {
  background: #fff; width: min(480px, 100%); max-height: 86vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom,0px));
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(20px); opacity: .6 } to { transform: translateY(0); opacity: 1 } }
.sheet-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.form-scroll { max-height: 60vh; overflow-y: auto; }
.form-ops { display: flex; gap: 10px; margin-top: 14px; }
.form-ops .btn-primary, .form-ops .btn-ghost { flex: 1; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv text:first-child { color: var(--muted); }
.sub-title { font-weight: 600; margin: 14px 0 8px; }
.dl-row { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.dl-title { font-size: 14px; }
.dl-time { font-size: 12px; color: var(--muted); }
.close-btn { margin-top: 14px; }

/* 分享弹层 */
.share-sheet { align-items: center; background: rgba(15,23,42,0.6); }
.share-card {
  background: #fff; width: min(360px, 90%); border-radius: 18px; padding: 22px 18px;
  text-align: center; animation: up .22s ease;
}
.share-card img { width: 220px; height: 220px; margin: 8px auto; display: block; image-rendering: pixelated; }
.share-card .url-box { display: flex; gap: 6px; margin-top: 10px; }
.share-card .url-box input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; color: var(--muted);
}
.share-tip { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.share-actions { display: flex; gap: 10px; margin-top: 14px; }
.share-actions .btn-primary, .share-actions .btn-ghost { flex: 1; padding: 10px; font-size: 14px; }

/* toast */
.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(15,23,42,0.88); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }

/* 公网访问 / 隧道 */
.radio { display: block; margin: 6px 0; font-size: 14px; color: var(--text); }
.warn-box { margin-top: 14px; background: #FFF7E6; border: 1px solid #FFD591; color: #8A5A00; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6; }
.ok { color: var(--primary); font-weight: 600; }
#pub-state a { color: var(--primary); word-break: break-all; }

/* ============ 客服注册 / 工作台 ============ */
.cs-banner {
  background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; line-height: 1.6;
}
.cs-banner b { color: var(--primary); }

.agree-box .agree-line { font-size: 13px; color: var(--text); padding: 7px 0; border-bottom: 1px dashed var(--line); line-height: 1.6; }
.agree-box .agree-line:last-child { border-bottom: none; }
.agree-check { margin: 10px 4px 14px; font-size: 13px; color: var(--muted); }
.agree-check label { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.agree-check input { margin-top: 3px; flex: 0 0 auto; }

.cs-promote { font-size: 12px; color: var(--muted); margin-top: 8px; word-break: break-all; }
.cs-ops { display: flex; gap: 8px; margin-top: 12px; }
.cs-ops .btn-ghost { flex: 1; }

.wb-greet {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.wb-greet .wb-name { font-size: 18px; font-weight: 700; }
.wb-greet .wb-sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }

.dl-card { background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.dl-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dl-name { font-weight: 600; font-size: 15px; }
.dl-status { flex: 0 0 auto; font-size: 11px; background: var(--primary-soft); color: var(--primary-dark); padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.dl-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.chat { margin-top: 10px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 12px; font-size: 13px; margin: 6px 0; line-height: 1.5; }
.bubble.left { background: var(--primary-soft); color: var(--primary-dark); border-bottom-left-radius: 2px; }
.bubble.right { background: #fff; border: 1px solid var(--line); margin-left: auto; border-bottom-right-radius: 2px; }
.chat-input { display: flex; gap: 8px; margin-top: 8px; }
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; outline: none; }
.chat-input .send { align-self: center; color: var(--primary); font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; user-select: none; }

/* ============ 响应式：后台/工作台在桌面浏览器也好用 ============ */
body.wide .app { max-width: 960px; }
body.wide .tabbar { width: min(960px, 100%); }
body.wide .mask .sheet { width: min(700px, 100%); }
@media (min-width: 768px) {
  body.wide .stats { gap: 14px; }
  body.wide .stat { padding: 18px; }
  body.wide .stat-num { font-size: 26px; }
  body.wide .row-item { padding: 14px 16px; }
  body.wide .toolbar .btn-primary, body.wide .toolbar .btn-ghost { padding: 12px 16px; }
  body.wide .login-box { max-width: 420px; }
}
