:root {
  --bg: #f6f5fb;
  --card: #ffffff;
  --text: #191632;
  --sub: #6f6a87;
  --accent: #6d5ae6;
  --accent-2: #8b5cf6;
  --accent-soft: #efecfe;
  --border: #ece9f7;
  --ok: #12a150;
  --ok-soft: #e6f7ee;
  --warn: #c9821a;
  --warn-soft: #fdf3e2;
  --err: #d93a4b;
  --err-soft: #fdecee;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(45, 34, 98, .06);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.tiny { font-size: 12px; color: var(--sub); margin: 4px 0; }
.sub { font-size: 12.5px; color: var(--sub); margin: 2px 0 0; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(120% 60% at 10% 0%, #eae5ff 0%, rgba(234,229,255,0) 60%),
    radial-gradient(120% 60% at 100% 100%, #f0e9ff 0%, rgba(240,233,255,0) 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border-radius: 22px; padding: 26px 22px 22px;
  box-shadow: 0 18px 50px rgba(60, 45, 120, .10);
  border: 1px solid var(--border);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(109, 90, 230, .30);
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: -.3px; }

.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 6px; }
.field input, .searchbar input, textarea, select {
  width: 100%; border: 1px solid var(--border); background: #fbfaff;
  border-radius: 12px; padding: 12px 13px; font-size: 15px; color: var(--text);
  outline: none; transition: border-color .15s, background .15s;
}
.field input:focus, .searchbar input:focus, textarea:focus {
  border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(109, 90, 230, .10);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; font-family: inherit; }

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 12px; padding: 11px 16px; font-size: 14.5px; font-weight: 500;
  cursor: pointer; transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn.block { display: block; width: 100%; margin-top: 10px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; box-shadow: 0 8px 22px rgba(109, 90, 230, .28);
}
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: var(--err); border-color: #f6d5d9; }
.btn:disabled { opacity: .55; pointer-events: none; }

.msg { font-size: 12.5px; color: var(--err); min-height: 18px; margin: 8px 0 0; }

/* ---------------- 框架 ---------------- */
.app { padding-bottom: calc(72px + env(safe-area-inset-bottom)); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(246, 245, 251, .92);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(236, 233, 247, .8);
}
.topbar h2 { margin: 0; font-size: 20px; letter-spacing: -.4px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: #fff; color: var(--sub); display: flex; align-items: center;
  justify-content: center; cursor: pointer;
}
.icon-btn:active { background: var(--accent-soft); color: var(--accent); }

main { padding: 14px 16px 8px; }
.page { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.sec-title { font-size: 14px; color: var(--sub); font-weight: 600; margin: 4px 0 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------------- 卡片列表 ---------------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list.compact { gap: 6px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow);
}
.card h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }

.item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 15px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; margin: 0; }
.item-desc { font-size: 12.5px; color: var(--sub); margin: 0; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.item-actions { display: flex; gap: 8px; margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.mute { background: #f3f2f8; color: var(--sub); }

.progress { height: 6px; border-radius: 99px; background: #f0eef8; overflow: hidden; }
.progress > i {
  display: block; height: 100%; border-radius: 99px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s ease;
}
.progress.done > i { background: var(--ok); }
.progress.fail > i { background: var(--err); }

.empty {
  text-align: center; color: var(--sub); font-size: 13px;
  padding: 36px 20px; border: 1px dashed var(--border); border-radius: var(--radius);
  background: rgba(255, 255, 255, .5);
}

/* ---------------- 筛选 / 搜索 ---------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border); background: #fff; color: var(--sub);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; white-space: nowrap;
  cursor: pointer;
}
.chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(109, 90, 230, .25);
}
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }

/* ---------------- 底栏 ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  border: none; background: none; cursor: pointer; color: #9b96b0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0 4px; font-size: 11px; transition: color .15s;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }
.tab.active svg { filter: drop-shadow(0 3px 8px rgba(109, 90, 230, .28)); }

/* ---------------- 抽屉 ---------------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-mask { position: absolute; inset: 0; background: rgba(24, 18, 48, .34); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--card); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  animation: up .22s cubic-bezier(.22, .8, .3, 1);
  box-shadow: 0 -12px 40px rgba(30, 20, 70, .16);
}
@keyframes up { from { transform: translateY(14%); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-handle {
  width: 38px; height: 4px; border-radius: 99px; background: #e3e0ef;
  margin: 6px auto 12px;
}

/* ---------------- 内容详情 ---------------- */
.article h1 { font-size: 20px; margin: 6px 0 12px; letter-spacing: -.4px; }
.article h2 { font-size: 16.5px; margin: 20px 0 8px; }
.article h3 { font-size: 15px; margin: 16px 0 6px; }
.article p { margin: 10px 0; color: #2b2745; }
.article blockquote {
  margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; color: #3d3663;
}
.article ul, .article ol { padding-left: 20px; }
.article li { margin: 5px 0; }
.article code {
  background: #f4f2fb; padding: 1px 5px; border-radius: 5px; font-size: 13px;
}
.article img { max-width: 100%; border-radius: 12px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 12px);
  background: rgba(30, 24, 58, .94); color: #fff; font-size: 13px;
  padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 90; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.features { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.plan-card h3 { margin: 2px 0; font-size: 20px; letter-spacing: -.4px; }
