:root {
  --primary: #534AB7;
  --primary-dark: #423a9a;
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1f1f29;
  --muted: #8a8a99;
  --danger: #e24b4a;
  --border: #ececf2;
  --danger-soft: #fff0f0;
}

* { 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", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(83, 74, 183, .25);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .who { font-size: 13px; opacity: .9; display: flex; align-items: center; gap: 8px; }
.topbar a, .topbar .link { color: #fff; cursor: pointer; font-size: 13px; text-decoration: none; }

/* 卡片 */
.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  margin: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.card + .card { margin-top: 0; }

/* 按钮 */
.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 11px 18px;
  font-size: 15px; font-weight: 600; cursor: pointer; text-align: center;
  background: var(--primary); color: #fff; transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--primary); }
.btn-danger { background: var(--danger); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-muted { background: #eee; color: #666; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.field { margin: 14px 0; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; background: #fff; color: var(--text);
  font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 分段控件 */
.segment { display: flex; background: #ececf2; border-radius: 10px; padding: 3px; }
.segment button {
  flex: 1; border: none; background: transparent; padding: 8px; border-radius: 8px;
  font-size: 14px; color: var(--muted); cursor: pointer;
}
.segment button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* 列表 */
.list { padding: 0 12px 12px; }
.item {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.item .clock {
  width: 46px; height: 46px; border-radius: 12px; background: #efeefb; color: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; line-height: 1.1;
}
.item .clock small { font-size: 10px; font-weight: 500; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item .actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  border: none; background: #f0f0f5; border-radius: 8px; width: 34px; height: 34px;
  cursor: pointer; font-size: 15px; color: var(--text);
}
.icon-btn.danger { background: var(--danger-soft); color: var(--danger); }

/* 启用/停用 */
.disabled-section { padding: 0 12px 12px; }
.disabled-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #f0f0f5; border-radius: 12px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.disabled-header .chev { font-size: 16px; color: #c4c4cc; }
.item.disabled { opacity: .6; }
.item.disabled .clock { background: #ececf2; color: #9a9aa5; }
.link-btn {
  border: none; background: transparent; color: var(--muted);
  font-size: 12px; padding: 6px 8px; cursor: pointer; border-radius: 8px;
}
.link-btn.enable { color: var(--primary); font-weight: 600; background: #efeefb; }

/* 成员角色徽章 */
.role-admin {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  background: linear-gradient(135deg, #534AB7, #8B7FE8);
  color: #fff; font-size: 12px; font-weight: 500;
}
.role-member {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  background: #f3f4f6; color: #6b7280; font-size: 12px;
}

.item.done .title { text-decoration: line-through; color: var(--muted); }

/* 已到点提醒过、但尚未勾选完成：醒目红底（与小程序首页一致，排序也在最前） */
.item.due { background: #fff3f3; box-shadow: inset 4px 0 0 var(--danger); }
.item.due .title { color: #b4232a; }
.badge-due {
  display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 6px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 500; vertical-align: 1px;
}

/* 分类标签 */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 12px 0; }
.tab {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px; background: #fff;
  border: 1px solid var(--border); font-size: 13px; cursor: pointer; color: var(--text);
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* 分组标题 */
.group-title {
  margin: 16px 12px 4px; font-size: 13px; font-weight: 600; color: var(--primary);
  display: flex; justify-content: space-between; align-items: baseline;
}
.group-title small { font-weight: 400; color: var(--muted); }

/* 空态 */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; z-index: 50; max-width: 80%;
}
.toast.err { background: rgba(226, 75, 74, .95); }

/* 开关行 */
.switch-row { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }
.switch-row .label { font-size: 15px; font-weight: 600; }
.switch-row .label.on { color: var(--primary); }
.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #ccc; border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 模态 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center;
  justify-content: center; z-index: 60; padding: 20px;
}
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 360px; }
.modal h3 { margin: 0 0 14px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.login-wrap .logo { text-align: center; font-size: 28px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.login-wrap .slogan { text-align: center; color: var(--muted); margin-bottom: 28px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* 扫码登录 */
.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.qr-box {
  width: 240px;
  height: 240px;
  padding: 8px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-box svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.qr-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.qr-status .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fbbf24;
  animation: pulse 1.4s ease-in-out infinite;
}
.qr-status .dot.ok { background: #22c55e; animation: none; }
.qr-status .dot.err { background: #ef4444; animation: none; }
.qr-box .qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.qr-mode { text-align: center; margin-top: 4px; }
.qr-mode .tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.qr-mode .tag.scheme   { background: #e0fbe6; color: #047857; }
.qr-mode .tag.ok       { background: #e0e7ff; color: #3730a3; }
.qr-mode .tag.fallback { background: #fff3cd; color: #92400e; }
.qr-warn {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #92400e;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 8px 10px;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.8); }
}
.big-icon {
  font-size: 64px;
  color: #22c55e;
  text-align: center;
  margin-bottom: 8px;
}
.msg {
  text-align: center;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 16px;
}
.link {
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  background: transparent;
  border: none;
  padding: 4px 8px;
}
.link.disabled { opacity: .45; pointer-events: none; cursor: default; }
.btn:disabled { opacity: .55; pointer-events: none; cursor: default; }
.mt { margin-top: 14px; }
.hidden { display: none; }

/* 登录 tab 切换（扫码 / 账号密码） */
.login-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.login-tabs button {
  flex: 1; border: 1px solid var(--border); background: #fff; padding: 10px;
  border-radius: 10px; font-size: 14px; color: var(--muted); cursor: pointer;
}
.login-tabs button.active { border-color: var(--primary); color: var(--primary); font-weight: 600; background: #f5f3ff; }
.login-form .field input { font-size: 16px; }
.login-form .hint { color: var(--muted); font-size: 12px; margin-top: -6px; margin-bottom: 12px; }

/* 设置密码（强制首次 / 修改密码复用） */
.setpw-wrap { padding: 24px 16px; }
.setpw-card { background: var(--card); border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.setpw-card h2 { margin: 0 0 6px; font-size: 18px; }
.setpw-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.setpw-banner { background: #fff7ed; color: #b45309; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.setpw-strength { font-size: 12px; margin-top: 4px; color: var(--muted); }
.setpw-strength.ok { color: #16a34a; }
.setpw-strength.warn { color: #ea580c; }

/* 头像 */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  background: #EEEDFE; color: #534AB7; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; overflow: hidden;
  border: 2px solid #fff;
}
.avatar-fallback {
  background: linear-gradient(135deg, #534AB7, #8B7FE8); color: #fff;
}
.avatar-sm { width: 32px; height: 32px; font-size: 14px; }

/* 成员卡片操作（编辑备注 / 角色 / 移除） */
.item .actions.col { flex-direction: column; gap: 4px; }
.item .actions.col .icon-btn { width: 30px; height: 30px; font-size: 13px; }

/* 备注 */
.remark {
  margin-top: 6px;
  font-size: 12px; color: var(--text);
  background: #FFFBEB; border-left: 3px solid #FBBF24;
  padding: 6px 8px; border-radius: 4px;
  word-break: break-all;
}
.remark-muted { color: var(--muted); font-style: italic; font-size: 11px; }

/* 我 自己 标签 */
.me-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  background: var(--primary); color: #fff; border-radius: 8px;
  font-size: 10px; font-weight: 500; vertical-align: 1px;
}

/* 资料补全视图（首次登录设置昵称/头像） */
.profile-wrap { padding: 24px 16px; }
.profile-card { background: var(--card); border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.profile-card h2 { margin: 0 0 6px; font-size: 18px; }
.profile-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.profile-banner { background: #eef2ff; color: #4338ca; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.profile-avatar {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin: 20px 0 14px;
}
.profile-avatar img {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--primary);
}
.profile-avatar .pick-btn {
  font-size: 13px; color: var(--primary); cursor: pointer;
  background: transparent; border: 1px dashed #c7c5e8; padding: 6px 14px; border-radius: 999px;
}
.profile-avatar input[type="file"] { display: none; }

/* 24 小时制时间选择（替代 input[type=time]，避免英文 locale 浏览器显示 12h AM/PM） */
.time-picker {
  display: inline-flex; align-items: center; gap: 6px;
}
.time-picker select {
  appearance: none; -webkit-appearance: none;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 15px; min-width: 56px;
  text-align: center;
}
.time-picker select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.time-picker > span { color: var(--muted); font-size: 15px; }
.time-hint { margin-left: 6px; color: var(--muted); font-size: 12px; }

/* ===== 共享目录 / 共同提醒 ===== */
.dir-item { cursor: pointer; }
.dir-dot { width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto; margin-right: 12px; }
.dir-item .title { font-size: 16px; }
.dir-item .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.dir-item .chev { margin-left: auto; color: #c4c4cc; font-size: 22px; }
.role { font-size: 12px; color: var(--muted); background: #f1f1f4; border-radius: 6px; padding: 2px 8px; }
.role.owner { color: var(--primary); background: #eef2ff; }
.dot.sel { box-shadow: 0 0 0 3px rgba(83,74,183,.35); }
.me-tag { margin-left: 6px; font-size: 11px; color: #fff; background: var(--primary); border-radius: 6px; padding: 1px 6px; }
.invite-code { font-weight: 700; letter-spacing: 2px; color: var(--primary); cursor: pointer; }
/* 凭邀请码加入入口 */
.join-entry { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border, #eeeef2); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; cursor: pointer; }
.join-entry:hover { background: #fafaff; }
.join-icon { width: 40px; height: 40px; border-radius: 12px; background: #eef2ff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; }
.join-main { flex: 1; min-width: 0; }
.join-title { font-size: 15px; font-weight: 600; }
.join-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.join-entry .chev { color: #c4c4cc; font-size: 22px; }

/* 提前提醒规则编辑器 */
.adv-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.adv-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.adv-row .step { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; }
.adv-row .step:active { background: #eee; }
.adv-num { width: 64px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: 14px; }
.adv-row .step-del { margin-left: auto; color: var(--danger); background: transparent; border: none; cursor: pointer; font-size: 13px; padding: 6px 10px; }

