:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6eb;
  --text: #1d2129;
  --muted: #86909c;
  --brand: #1668dc;
  --brand-soft: #e8f1fd;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --radius: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--card); border-radius: 14px;
  padding: 28px 24px; border: 1px solid var(--line);
}
.login-card h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.login-card p { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; outline: none;
}
.field input:focus { border-color: var(--brand); }
.btn-primary {
  width: 100%; height: 46px; border: 0; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-weight: 500; font-size: 15px;
}
.btn-primary:active { opacity: .85; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 72px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.row1 {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px; gap: 8px;
}
.row1 .title { font-weight: 600; font-size: 15px; }
.row1 .who { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.row1 .who a { color: #1668dc; text-decoration: none; }

.tabs { display: flex; gap: 6px; padding: 0 14px 10px; }
.tab {
  flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; font-size: 13px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2;
}
.tab.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 500; }
.tab .cnt { font-size: 10px; margin-top: 1px; opacity: .8; }

.progress { padding: 0 14px 10px; }
.progress .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress .bar { height: 5px; background: #eef0f3; border-radius: 3px; overflow: hidden; }
.progress .bar > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

.tools {
  display: flex; gap: 8px; padding: 10px 14px; align-items: center;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.tools button {
  height: 32px; padding: 0 12px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; font-size: 13px; color: var(--text);
}
.tools .sp { flex: 1; }
.tools .filter.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ---------- list ---------- */
.head-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 54px 54px 56px; gap: 5px;
  padding: 6px 14px; font-size: 11px; color: var(--muted);
  background: var(--bg); position: sticky; top: 0; z-index: 5;
}
.head-row span:not(:first-child) { text-align: center; }

.list { padding: 0 14px 20px; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) 54px 54px 56px; gap: 5px;
  align-items: center; padding: 4px 0; border-bottom: 1px solid #f0f2f5;
}
.item .nm {
  font-size: 13px; line-height: 1.25; overflow: hidden; min-width: 0;
  white-space: nowrap; text-overflow: ellipsis; padding-right: 2px;
}
.item .nm i { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 3px; }
.item.done .nm { color: var(--text); }
.item.empty .nm { color: var(--muted); }

.cell {
  height: 32px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; text-align: center; width: 100%; min-width: 0; padding: 0;
  outline: none; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.cell:focus { border-color: var(--brand); background: #fff; }
.cell.bad { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.cell.stat { font-size: 10px; color: var(--warn); background: var(--warn-soft); border-color: #fedf89; }

.pick {
  height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #fff;
  font-size: 11px; color: var(--text); width: 100%; min-width: 0; padding: 0 1px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.pick.unset { color: #c0c4cc; }
.pick:active { background: #f7f8fa; }

/* ---------- footer ---------- */
.footbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
}
.footbar .btn-primary { flex: 1; }
.footbar .ghost {
  height: 46px; padding: 0 16px; border: 1px solid var(--line);
  background: #fff; border-radius: var(--radius); font-size: 14px;
}

/* ---------- sheet ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40;
  display: none; align-items: flex-end;
}
.mask.on { display: flex; }
.sheet {
  width: 100%; background: #fff; border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 80vh; overflow: auto;
}
.sheet h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.sheet .grp { margin-bottom: 16px; }
.sheet .grp > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 13px;
}
.opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.opt.off { opacity: .5; }
.sheet .actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet .actions button { flex: 1; height: 44px; border-radius: 10px; }
.sheet .actions .ok { border: 0; background: var(--brand); color: #fff; font-weight: 500; }
.sheet .actions .no { border: 1px solid var(--line); background: #fff; }

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

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

/* 强制改密提示条 */
.warn-tip {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 8px;
  background: var(--warn-soft); border: 1px solid #fedf89;
  color: #93370d; font-size: 12px; line-height: 1.55;
}
