* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --red: #e53935; --red-d: #c62828; --green: #2e9e5b; --orange: #ef9a1f;
  --bg: #f4f5f7; --card: #ffffff; --line: #e8eaed; --txt: #22252a; --sub: #8a9099;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--txt); }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", Roboto, sans-serif; font-size: 15px; line-height: 1.5; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* ---------- 登录 ---------- */
.login-mask { position: fixed; inset: 0; background: linear-gradient(160deg, #e53935, #b71c1c); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; overflow-y: auto; }
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 30px 24px 24px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-logo { font-size: 46px; text-align: center; }
.login-box h1 { text-align: center; margin: 6px 0 2px; font-size: 22px; }
.login-sub { text-align: center; color: var(--sub); margin: 0 0 22px; font-size: 13px; }
.login-box label { display: block; font-size: 13px; color: #555; margin: 14px 0 6px; font-weight: 600; }
.login-box input { width: 100%; height: 44px; border: 1px solid #d9dce1; border-radius: 10px; padding: 0 12px; font-size: 15px; outline: none; }
.login-box input:focus { border-color: var(--red); }
.token-toggle { color: var(--red) !important; font-weight: 400 !important; font-size: 12px !important; cursor: pointer; margin-top: 14px !important; }
.login-err { color: var(--red-d); font-size: 13px; min-height: 20px; margin-top: 10px; }
.login-tip { text-align: center; color: var(--sub); font-size: 11px; margin: 14px 0 0; }

/* ---------- 按钮 ---------- */
.btn { border: none; border-radius: 10px; padding: 11px 16px; font-size: 14px; font-weight: 600; transition: opacity .15s; }
.btn:active { opacity: .75; }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--red); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-ghost { background: #f1f2f4; color: #444; }
.btn-outline { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn-danger { background: #fff; color: var(--red-d); border: 1px solid #efc7c7; }
.link { background: none; border: none; color: var(--red); font-size: 12px; }

/* ---------- 布局 ---------- */
.appbar { position: sticky; top: 0; z-index: 20; height: 52px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.appbar-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.appbar-logo { font-size: 20px; }
.bar-user { font-size: 12px; opacity: .9; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 12px 12px 78px; max-width: 720px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }

/* ---------- 统计条 ---------- */
.stat-bar { display: flex; gap: 6px; background: #fff; border-radius: 12px; padding: 12px 4px; box-shadow: 0 1px 4px rgba(0,0,0,.04); margin-bottom: 12px; }
.stat-item { flex: 1; text-align: center; }
.stat-item b { display: block; font-size: 21px; line-height: 1.2; }
.stat-item span { font-size: 11px; color: var(--sub); }
.c-green { color: var(--green); } .c-orange { color: var(--orange); } .c-red { color: var(--red); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.search { flex: 1; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 14px; outline: none; background: #fff; }
.search:focus { border-color: var(--red); }
.toolbar .btn { white-space: nowrap; }
.status-line { font-size: 12px; color: var(--sub); margin: 6px 2px 10px; }

/* ---------- 订单列表 ---------- */
.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-item { background: #fff; border-radius: 12px; padding: 12px 14px; border-left: 4px solid #ccc; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.order-item.done { border-left-color: var(--green); }
.order-item.one { border-left-color: var(--orange); }
.order-item.zero { border-left-color: var(--red); }
.order-item.pending { border-left-color: #7e57c2; }
.order-item.ignored { border-left-color: #bdbdbd; opacity: .7; }
.oi-main { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.oi-sid { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.oi-badge { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.oi-badge.done { background: #e6f5ec; color: var(--green); }
.oi-badge.one { background: #fdf1dd; color: #c67d0a; }
.oi-badge.zero { background: #fdeaea; color: var(--red-d); }
.oi-badge.pending { background: #efe7fb; color: #6a3fb5; }
.oi-badge.ignored { background: #eee; color: #888; }
.oi-sub { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); margin-top: 6px; }
.oi-detail { font-size: 11px; color: #9aa0a8; margin-top: 4px; }
.empty { text-align: center; color: var(--sub); padding: 34px 12px; font-size: 14px; background: #fff; border-radius: 12px; }

/* ---------- 打卡操作区 ---------- */
.sign-actions { margin: 14px 0 4px; }
.sign-actions-row { display: flex; gap: 8px; margin-top: 8px; }
.sign-actions-row .btn { flex: 1; }
.rule-tip { font-size: 11px; color: var(--sub); margin: 10px 2px 0; line-height: 1.6; }

/* ---------- 日志 ---------- */
.log-panel { margin-top: 16px; background: #1e2126; border-radius: 12px; overflow: hidden; }
.log-head { padding: 9px 14px; color: #cfd3da; font-size: 12px; display: flex; justify-content: space-between; align-items: center; background: #171a1f; }
.log-head .link { color: #ff8a80; }
.log-box { padding: 12px 14px; color: #b8bec8; font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow-y: auto; font-family: "SF Mono", Consolas, monospace; }

/* ---------- 卡片/表单 ---------- */
.card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title-note { font-size: 11px; color: var(--sub); font-weight: 400; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.form-row label { width: 76px; flex-shrink: 0; font-size: 13px; color: #555; }
.form-row input { flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font-size: 14px; outline: none; }
.form-row input:focus { border-color: var(--red); }
.hint { font-size: 12px; color: var(--sub); line-height: 1.6; margin: 8px 0 0; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 14px; resize: vertical; outline: none; line-height: 1.5; }
textarea:focus { border-color: var(--red); }
.add-btns { display: flex; gap: 8px; margin-top: 10px; }
.add-btns .btn { flex: 1; }
.add-errors { font-size: 11.5px; color: #c67d0a; margin-top: 8px; line-height: 1.6; }
.sum-badge { font-size: 12px; color: var(--red); background: #fdeaea; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.add-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.add-item { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
.ai-head { display: flex; justify-content: space-between; }
.ai-sid { font-weight: 700; font-size: 14px; }
.ai-km { color: var(--red); font-weight: 600; font-size: 13px; }
.ai-sub { font-size: 11.5px; color: var(--sub); margin-top: 3px; }
.ai-state { font-size: 11.5px; margin-top: 4px; }
.ai-state.ok { color: var(--green); }
.ai-state.bad { color: var(--red-d); }
.me-info { font-size: 13px; margin-bottom: 10px; }
.me-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.me-row span { color: var(--sub); }
.me-json { background: #f6f7f9; padding: 10px; border-radius: 8px; font-size: 11px; white-space: pre-wrap; word-break: break-all; }

/* ---------- 底部导航 ---------- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--sub); font-size: 11px; }
.tab .tab-ico { font-size: 20px; filter: grayscale(1); opacity: .6; }
.tab.active { color: var(--red); font-weight: 600; }
.tab.active .tab-ico { filter: none; opacity: 1; }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 200; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 400px; padding: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.modal-body { font-size: 13px; color: #555; max-height: 55vh; overflow-y: auto; }
.confirm-text { line-height: 1.7; margin-bottom: 8px; }
.confirm-list { background: #f6f7f9; border-radius: 8px; padding: 10px; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow-y: auto; color: #444; }
.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal-btns .btn { flex: 1; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: rgba(30,33,38,.94); color: #fff; padding: 11px 18px; border-radius: 24px; font-size: 13px; z-index: 300; max-width: 86%; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.25); }

/* ---------- 今日记录小标题（打卡按钮在上、记录在下） ---------- */
.list-head{display:flex;align-items:baseline;gap:6px;font-size:13.5px;font-weight:600;color:#333;margin:16px 2px 8px}
.list-head span{font-weight:400;font-size:11.5px;color:#999}
.sign-actions{margin:2px 0 6px}

/* ---------- 额度 / 备注 ---------- */
.quota-line{font-size:12px;color:#137333;margin:2px 2px 8px;font-weight:600}
.quota-line.quota-warn{color:#e64340}
.oi-remark{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:6px;
  font-size:12px;color:#555;background:#f7f8fa;border-radius:8px;padding:6px 9px}
.oi-remark-txt{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.oi-none{color:#bbb;font-style:normal}
.oi-edit{color:var(--primary,#e64340);font-weight:600;flex:none}
input.card-input{height:42px;padding:0 12px;border:1px solid #e2e4e8;border-radius:10px;width:100%;font-size:14px}

/* ---------- 删除订单 ---------- */
.oi-sub{align-items:center;gap:10px}
.oi-del{flex:none;margin-left:auto;padding:3px 10px;border:1px solid #f0c9c9;border-radius:8px;
  color:#d93025;font-size:11.5px;font-weight:600;background:#fff5f5;line-height:1.5}
.oi-del:active{background:#ffe3e3}
.list-head .list-clean{margin-left:auto;color:#d93025;font-weight:600;font-size:11.5px;
  border:1px solid #f0c9c9;border-radius:8px;padding:2px 8px;background:#fff5f5}

/* ---------- 运行设置 ---------- */
.form-row.col{flex-direction:column;align-items:stretch;gap:6px}
.form-row.col label{width:auto}
.cfg-check{display:flex;align-items:flex-start;gap:8px;font-size:12.5px;color:#444;
  margin:10px 0;line-height:1.5}
.cfg-check input{width:16px;height:16px;margin-top:2px;flex:none;accent-color:#e64340}

/* ---------- 添加页按钮换行 ---------- */
.add-btns{flex-wrap:wrap}
.add-btns .btn{flex:1 1 30%;font-size:12px;padding:8px 6px}
