:root {
  --bg: #fafafa;
  --card: #ffffff;
  --line: #e8e8e8;
  --line-soft: #f0f0f0;
  --text: #171717;
  --muted: #737373;
  --faint: #a3a3a3;
  --primary: #171717;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .03);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- 登录 ---------- */
.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 22px 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 30px rgba(0,0,0,.04);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .3px; }
.brand .mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.auth h1 { font-size: 21px; line-height: 1.3; margin: 18px 0 4px; font-weight: 650; letter-spacing: -.2px; }
.auth .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.seg {
  display: flex; gap: 4px; padding: 3px;
  background: #f4f4f5; border-radius: 10px; margin-bottom: 16px;
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 7px 8px; border-radius: 8px; font-size: 13px; font-weight: 550;
  cursor: pointer; transition: .15s;
}
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.form { display: block; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; font-weight: 550; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  outline: none; transition: .15s;
}
.field input:focus { border-color: #c9c9c9; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.field input::placeholder { color: #b8b8b8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text);
  font-size: 13px; font-weight: 550; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: #f6f6f6; border-color: #dcdcdc; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #2b2b2b; border-color: #2b2b2b; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f2f2f2; color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fef2f2; border-color: #fbd5d5; }
.btn.block { width: 100%; height: 40px; margin-top: 4px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.auth-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.link { color: var(--muted); text-decoration: none; border-bottom: 1px dashed #d4d4d4; cursor: pointer; }
.link:hover { color: var(--text); }

.msg { margin-top: 12px; font-size: 12.5px; min-height: 18px; color: var(--danger); }
.msg.ok { color: #15803d; }

/* ---------- 主界面 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px;
  background: rgba(250, 250, 250, .82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .left { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.topbar .right { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.card > h2 {
  font-size: 14px; font-weight: 650; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.notice {
  display: flex; gap: 9px; align-items: flex-start;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 12px;
  font-size: 13px;
}

/* 概览统计（Cap 同款彩色圆点） */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { margin: 0; padding: 13px; }
.stat .k { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -.5px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 11.5px; color: var(--faint); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.dot.blue { background: var(--blue); }
.dot.violet { background: var(--violet); }

/* 头像 */
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: #f1f1f2 center/cover no-repeat;
  display: grid; place-items: center;
  color: var(--muted); font-weight: 650; font-size: 19px;
  border: 1px solid var(--line); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  background: #f4f4f5; color: var(--muted); font-size: 12px; font-weight: 550;
}
.pill.ok { background: #ecfdf3; color: #15803d; }

.nick { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }

/* 列表行 */
.rows { display: block; margin: -4px 0; }
.rowitem {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.rowitem:last-child { border-bottom: 0; }
.rowitem .t { font-size: 13px; font-weight: 550; }
.rowitem .s { font-size: 11.5px; color: var(--faint); }

/* 壁纸 */
.walls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 560px) { .walls { grid-template-columns: repeat(6, 1fr); } }
.wall {
  position: relative; aspect-ratio: 3 / 4; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line); overflow: hidden; background: #f1f1f1;
  transition: transform .12s, box-shadow .12s;
}
.wall:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.wall.active { outline: 2px solid var(--primary); outline-offset: 1px; }
.wall span {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 6px;
  font-size: 10.5px; color: #fff; text-align: center;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}

/* 卡密 */
.code {
  display: flex; align-items: center; gap: 8px; padding: 9px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.code:last-child { border-bottom: 0; }
.code .v { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; font-weight: 600; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #f4f4f5; color: var(--muted); font-weight: 550;
}
.tag.ok { background: #ecfdf3; color: #15803d; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.off { background: #f4f4f5; color: #a3a3a3; }

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

.upload { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.upload label.btn { position: relative; overflow: hidden; }
.upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px);
  background: #171717; color: #fff; font-size: 13px; padding: 9px 15px;
  border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 99;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #dc2626; }
