/* AI 寻呼机 · H5 用户端
   视觉语言取自设备那块 ST7305 全反射屏：纸感底色、墨色文字、
   朱红只在「未读 / 危险」出现。数字统一用等宽字体，像真实寻呼机显示屏。 */

:root {
  --paper:   #F1EEE6;
  --card:    #FFFDF8;
  --ink:     #17140F;
  --ink-2:   #5B554B;
  --ink-3:   #9C9488;
  --line:    #E4DDD0;
  --line-2:  #F0EAE0;
  --accent:  #BE3D26;
  --ok:      #2C6B4C;
  --shadow:  0 1px 2px rgba(23,20,15,.05), 0 8px 24px -12px rgba(23,20,15,.18);
  --r:       14px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

/* ---------- 外壳：手机宽度居中，桌面端像个机身 ---------- */

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

@media (min-width: 520px) {
  #app {
    min-height: calc(100vh - 48px);
    margin: 24px auto;
    border-radius: 28px;
    box-shadow: 0 24px 60px -28px rgba(23,20,15,.35), 0 0 0 1px var(--line);
    overflow: hidden;
  }
}

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

.hdr {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.hdr h1 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
}

.hdr .icon-btn {
  width: 34px;
  height: 34px;
  margin-left: -6px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.hdr .icon-btn:active { background: var(--line-2); }
.hdr .icon-btn svg { width: 20px; height: 20px; }

.hdr .txt-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.hdr .txt-btn:active { background: var(--line-2); }

/* ---------- 内容区 ---------- */

.main {
  flex: 1;
  padding: 16px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main.flush { padding: 0 0 0; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

.card.pad { padding: 18px 16px; }

.eyebrow {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---------- 设备大卡（首页主角） ---------- */

.hero {
  padding: 22px 18px 18px;
  background:
    radial-gradient(120% 90% at 100% 0%, #FFF6E9 0%, transparent 60%),
    var(--card);
}

.hero .no {
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: .06em;
  font-weight: 500;
  margin: 8px 0 2px;
}

.hero .sub {
  color: var(--ink-2);
  font-size: 13px;
}

.hero .foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--ink-3);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--line-2);
  color: var(--ink-2);
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
}
.pill.on  { background: #E8F1EB; color: var(--ok); }
.pill.on .dot { background: var(--ok); }
.pill.off { background: #F6E9E6; color: var(--accent); }
.pill.off .dot { background: var(--accent); }

/* ---------- 列表 ---------- */

.list { display: flex; flex-direction: column; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  background: transparent;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.list .item:last-child { border-bottom: 0; }
.item:active { background: var(--line-2); }

.item .grow { flex: 1; min-width: 0; }
.item .t {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .d {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .chev { color: var(--ink-3); flex: none; }

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--line-2);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 600;
}
.avatar.accent { background: #FBEAE5; color: var(--accent); }

/* ---------- 分组标题 ---------- */

.sec {
  padding: 0 6px 6px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.sec + .card { margin-bottom: 18px; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn.block { width: 100%; }
.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFFDF8;
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); border-color: #EBD6D0; background: transparent; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }

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

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
  padding-left: 2px;
}
.field .hint { font-size: 12px; color: var(--ink-3); padding-left: 2px; }

.input {
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 16px 以下 iOS 会自动放大 */
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px rgba(23,20,15,.07);
}
.input.mono { letter-spacing: .22em; font-size: 20px; }
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; line-height: 1.55; }

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

.login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 24px 60px;
  gap: 22px;
}
.login .brand { text-align: center; margin-bottom: 6px; }
.login .brand .mark {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  border: 1.5px solid var(--ink);
  display: grid; place-items: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .04em;
}
.login .brand h2 { margin: 0; font-size: 20px; letter-spacing: .01em; }
.login .brand p { margin: 6px 0 0; color: var(--ink-3); font-size: 13px; }

.code-row { display: flex; gap: 10px; }
.code-row .input { flex: 1; }
.code-row .btn { flex: none; height: 48px; min-width: 104px; }

/* ---------- 空态 ---------- */

.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty .big { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { margin: 0; font-size: 13px; line-height: 1.7; }

/* ---------- 聊天 ---------- */

.chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}
.bubble.them {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.bubble.me {
  align-self: flex-end;
  background: var(--ink);
  color: #FFFDF8;
  border-bottom-right-radius: 5px;
}
.bubble .ts {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  opacity: .5;
  letter-spacing: .04em;
}
.bubble.fail { outline: 1px dashed var(--accent); }

.chat-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.chat-bar .input { height: 42px; font-size: 15px; border-radius: 20px; }
.chat-bar .send {
  flex: none;
  width: 62px;
  height: 42px;
  border-radius: 20px;
  border: 0;
  background: var(--ink);
  color: #FFFDF8;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.chat-bar .send[disabled] { opacity: .35; }

/* ---------- 底部导航 ---------- */

.tabs {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 8px;
  font-size: 10px;
  color: var(--ink-3);
  text-decoration: none;
  letter-spacing: .04em;
  position: relative;
}
.tabs a svg { width: 21px; height: 21px; }
.tabs a.on { color: var(--ink); }
.tabs a .badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 6px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  line-height: 15px;
  text-align: center;
  font-weight: 600;
}

/* ---------- 轻提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 14px);
  max-width: 82vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(23,20,15,.92);
  color: #FFFDF8;
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 加载 ---------- */

.loading {
  padding: 60px 0;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 13px;
}
.spin {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--ink-2);
  border-radius: 50%;
  animation: sp .7s linear infinite;
  margin-bottom: 10px;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- 日程 ---------- */

.sched-item {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  align-items: flex-start;
}
.sched-item:last-child { border-bottom: 0; }
.sched-time {
  flex: none;
  width: 52px;
  font-size: 12px;
  color: var(--ink-2);
  padding-top: 2px;
}
.sched-time b { display: block; font-size: 15px; color: var(--ink); font-weight: 600; }
.sched-item .grow { flex: 1; min-width: 0; }
.sched-item.done .t { color: var(--ink-3); text-decoration: line-through; }
.sched-item .actions { display: flex; gap: 6px; flex: none; }

.kv {
  display: flex;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
}
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-2); }
.kv .v { color: var(--ink); font-weight: 500; }
