/* ============================================================
 * styles.css —— 移动优先
 * ============================================================ */

:root {
  --bg: #f2f5f7;
  --card: #fff;
  --ink: #12232e;
  --ink-2: #5b6b76;
  --ink-3: #93a2ac;
  --line: #e4eaee;
  --brand: #10695d;
  --brand-2: #0b5449;
  --brand-soft: #e6f2f0;
  --danger: #c03a2f;
  --danger-soft: #fdecea;
  --warn: #a8690a;
  --warn-soft: #fdf4e3;
  --radius: 14px;
  --tap: 44px;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }

.boot { padding: 80px 0; text-align: center; color: var(--ink-3); }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand);
  background-image: linear-gradient(135deg, #0f7c6c 0%, #0d5a4f 100%);
  color: #fff;
  padding-top: env(safe-area-inset-top);
}
.topbar__in {
  max-width: 720px; margin: 0 auto;
  padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; display: flex; align-items: center; gap: 7px; }
.brand__dot { width: 7px; height: 7px; border-radius: 50%; background: #6fe0cd; box-shadow: 0 0 0 3px rgba(111,224,205,.22); }
.who { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.14); }
.who__av {
  width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.who__n { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.who__tag { font-style: normal; font-size: 10px; font-weight: 500; background: #ffd98a; color: #6a4a00; padding: 1px 5px; border-radius: 4px; }

/* ---------------- 主体 ---------------- */

.main { max-width: 720px; margin: 0 auto; padding: 14px 12px 86px; }
.page { display: flex; flex-direction: column; gap: 12px; }

/* ---------------- 卡片 ---------------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(16,40,54,.04);
}
.card--tight { padding-bottom: 10px; }
.card__label { font-size: 12px; color: var(--ink-2); font-weight: 600; letter-spacing: .3px; margin-bottom: 10px; }
.card__label--gap { margin-top: 16px; }
.req { color: var(--danger); margin-left: 2px; }

/* ---------------- 表单 ---------------- */

.fld { display: block; margin-bottom: 12px; }
.fld__l { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.inp {
  width: 100%; min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fbfcfd; color: var(--ink);
  font-size: 16px; /* iOS 不缩放 */
  outline: none;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none;
}
.inp:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--brand-soft); }
.inp--area { resize: vertical; min-height: 84px; line-height: 1.5; }
.inp--s { min-height: 38px; font-size: 14px; flex: 1; }

/* ---------------- 按钮 ---------------- */

.btn {
  min-height: var(--tap); padding: 0 18px;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; }
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:active { background: var(--brand-2); }
.btn--ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--s { min-height: 38px; padding: 0 12px; font-size: 14px; }

.foot { display: flex; flex-direction: column; gap: 8px; }
.foot__n { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------------- 提示条 ---------------- */

.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.alert b { display: block; margin-bottom: 2px; }
.alert--err { background: var(--danger-soft); color: #8f2a21; border: 1px solid #f4c9c4; }
.alert--warn { background: var(--warn-soft); color: #7c4d06; border: 1px solid #f0dcb0; }

.notice {
  max-width: 720px; margin: 0 auto 8px;
  font-size: 12px; line-height: 1.6; color: var(--ink-2);
  background: var(--warn-soft); border: 1px solid #f0dcb0; border-radius: 10px; padding: 10px 12px;
}
.notice b { color: #7c4d06; }

.editingbar {
  background: var(--brand-soft); color: var(--brand-2);
  border-radius: 10px; padding: 9px 12px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.editingbar a { font-weight: 600; }

/* ---------------- 统计 ---------------- */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stats--3 { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; text-align: center;
}
.stat b { display: block; font-size: 24px; line-height: 1.2; color: var(--brand); }
.stat span { font-size: 12px; color: var(--ink-2); }

/* ---------------- 条形统计 ---------------- */

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.bar__n { width: 46px; flex: none; color: var(--ink-2); }
.bar__t { flex: 1; height: 8px; background: #eef2f4; border-radius: 999px; overflow: hidden; }
.bar__t i { display: block; height: 100%; background: var(--brand); border-radius: 999px; min-width: 2px; }
.bar__v { width: 62px; flex: none; text-align: right; color: var(--ink); font-weight: 600; }
.bar__v i { font-style: normal; font-size: 11px; color: var(--brand); margin-left: 3px; font-weight: 500; }

/* ---------------- 记录卡 ---------------- */

.list { display: flex; flex-direction: column; gap: 10px; }
.rec {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px;
  box-shadow: 0 1px 2px rgba(16,40,54,.04);
}
.rec__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rec__name { font-size: 16px; font-weight: 700; }
.rec__owner {
  font-size: 11px; font-weight: 600; color: var(--brand-2);
  background: var(--brand-soft); border-radius: 5px; padding: 2px 7px; flex: none;
}
.rec__phone { margin: 3px 0 5px; }
.rec__phone a { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.rec__addr { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.rec__line { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.rec__line--r { color: var(--ink-3); }
.rec__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--ink-3);
}
.rec__acts { display: flex; gap: 4px; flex: none; }
.rec__acts button {
  background: none; border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink-2); font-size: 12px; padding: 5px 11px; min-height: 32px;
}
.rec__acts button[data-act="del"] { color: var(--danger); border-color: #f0d3cf; }

.empty {
  text-align: center; color: var(--ink-3); font-size: 14px;
  padding: 46px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  line-height: 2;
}

/* ---------------- 底栏 ---------------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; max-width: 140px; min-height: 40px;
  background: none; border: none; border-radius: 9px;
  color: var(--ink-3); font-size: 14px; font-weight: 600;
}
.tab--on { background: var(--brand-soft); color: var(--brand-2); }

/* ---------------- 登录 ---------------- */

.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 22px 14px 28px; max-width: 560px; margin: 0 auto; }
.login__head { text-align: center; }
.login__logo {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px;
  background: linear-gradient(135deg, #0f7c6c, #0d5a4f); color: #fff;
  display: grid; place-items: center; font-size: 19px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 6px 18px rgba(13,90,79,.24);
}
.login__t { margin: 0 0 6px; font-size: 21px; letter-spacing: .3px; }
.login__s { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }

.picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick {
  background: #fbfcfd; border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 66px; transition: all .14s;
}
.pick__av {
  width: 30px; height: 30px; border-radius: 50%; background: #e6ebef; color: var(--ink-2);
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.pick__n { font-size: 12px; color: var(--ink-2); }
.pick--on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand-soft); }
.pick--on .pick__av { background: var(--brand); color: #fff; }
.pick--on .pick__n { color: var(--brand-2); font-weight: 600; }
.pick--admin { grid-column: span 4; flex-direction: row; justify-content: center; gap: 8px; min-height: 48px; padding: 8px; }
.pick--admin .pick__av { width: 26px; height: 26px; font-size: 12px; }

/* 登录错误提示 */
.login__err {
  background: var(--danger-soft); color: #8f2a21; border: 1px solid #f4c9c4;
  border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px;
  animation: shake .3s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0) }
  25% { transform: translateX(-4px) }
  75% { transform: translateX(4px) }
}

.login__tip { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.6; }
.login .card { padding: 18px; }
.login .fld:last-of-type { margin-bottom: 18px; }

/* ---------------- 工具条 ---------------- */

.tools { display: flex; gap: 8px; }

/* ---------------- 弹层 ---------------- */

.mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10,25,33,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 16px; padding: 18px;
  width: 100%; max-width: 340px;
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
}
.modal--sm { max-width: 320px; }
@keyframes pop { from { transform: scale(.94); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.modal__title { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.modal__body { font-size: 13px; color: var(--ink-2); margin-bottom: 16px; line-height: 1.6; }
.modal__acts { display: flex; gap: 9px; margin-top: 16px; }
.modal__acts .btn { flex: 1; }
.mp { margin-top: 4px; }
.mp .btn { margin-top: 6px; }

.menu { display: flex; flex-direction: column; }
.menu__i {
  background: none; border: none; text-align: left;
  padding: 13px 4px; font-size: 15px; color: var(--ink);
  border-bottom: 1px solid var(--line); min-height: var(--tap);
}
.menu__i:last-child { border-bottom: none; }
.menu__i--danger { color: var(--danger); }

/* ---------------- Toast ---------------- */

#toast-root {
  position: fixed; left: 0; right: 0; top: 14px; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(18,35,46,.94); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px;
  max-width: 88%; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: drop .2s cubic-bezier(.2,.9,.3,1.1);
}
.toast--err { background: var(--danger); }
.toast--out { opacity: 0; transform: translateY(-6px); transition: all .3s; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px) } to { opacity: 1; transform: none } }

/* ---------------- 宽屏 ---------------- */

@media (min-width: 768px) {
  .main { padding: 18px 16px 90px; }
  .login { max-width: 420px; }
}
