:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }

/* 顶部栏 */
.topbar {
  background: var(--primary); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .user { font-size: 13px; opacity: .9; }
.topbar button { background: rgba(255,255,255,.18); color: #fff; border: 0; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }

/* 容器 */
.container { max-width: 880px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.active { display: block; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 16px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #eef2ff; color: var(--primary); }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.warn { background: #fef3c7; color: var(--warn); }
.tag.gray { background: #f3f4f6; color: var(--muted); }

/* 表单 */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--text); font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; min-height: 84px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border: 0; border-radius: 10px; background: var(--primary); color: #fff; font-size: 15px; cursor: pointer; width: 100%; transition: .15s; }
.btn:active { transform: scale(.98); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost { background: #f3f4f6; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn-row { display: flex; gap: 10px; }
.btn.sm { width: auto; padding: 7px 14px; font-size: 13px; }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; }
.tab { padding: 8px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--muted); cursor: pointer; white-space: nowrap; font-size: 14px; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; }
.login-box .logo { text-align: center; margin-bottom: 20px; }
.login-box .logo .ic { font-size: 46px; }
.login-box h2 { text-align: center; margin-bottom: 4px; }

/* 照片 */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photos .ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f3f4f6; }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph .del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: 0; font-size: 14px; line-height: 1; cursor: pointer; }
.upload-actions { display: flex; gap: 10px; margin-top: 6px; }
.upload-actions .btn { width: auto; flex: 1; }

/* 跟进时间线 */
.timeline { border-left: 2px solid var(--border); margin-left: 8px; padding-left: 14px; }
.timeline .item { position: relative; margin-bottom: 14px; }
.timeline .item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline .meta { font-size: 12px; color: var(--muted); }

/* 表格（管理后台） */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }

/* 提示 */
.toast { position: fixed; left: 50%; bottom: 40px; translate: -50% 20px; background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; max-width: 90%; }
.toast.show { opacity: 1; translate: -50% 0; }
.toast-err { background: var(--danger); }
.toast-ok { background: var(--ok); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 模态 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-mask.show { display: flex; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; max-height: 90vh; overflow-y: auto; padding: 18px; }
@media (min-width: 600px) { .modal-mask { align-items: center; } .modal { border-radius: 16px; } }

.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap8 { gap: 8px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
