:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --text: #1c1f23;
  --text-dim: #6b7280;
  --text-faint: #9aa1ab;
  --brand: #3b6ef5;
  --brand-weak: #eaf0ff;
  --danger: #d92d20;
  --danger-weak: #fdecea;
  --ok: #067647;
  --ok-weak: #e7f6ec;
  --warn: #b54708;
  --warn-weak: #fef4e6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 20px 64px; }
.wrap.narrow { max-width: 420px; }

header.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 22px;
}
header.site h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px; }
header.site .sub { color: var(--text-dim); font-size: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card > h2 {
  margin: 0 0 4px; font-size: 15px; font-weight: 650;
}
.card > .hint { margin: 0 0 16px; color: var(--text-dim); font-size: 12.5px; }

/* ---------- 登录页 ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 400px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
}
.brand .name { font-size: 16px; font-weight: 650; }
.brand .tag { font-size: 12px; color: var(--text-dim); }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak);
}
textarea { resize: vertical; min-height: 72px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

button {
  font-family: inherit; font-size: 14px; cursor: pointer;
  border-radius: 9px; border: 1px solid transparent; padding: 10px 16px;
  transition: background .15s, border-color .15s, opacity .15s;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; font-weight: 550; }
.btn-primary:hover:not(:disabled) { background: #2f5ee0; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); width: 100%; font-weight: 550; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; background: var(--surface); border-color: var(--border); }
.btn-sm:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: #f3c3bd; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-weak); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.divider {
  display: flex; align-items: center; gap: 10px; margin: 18px 0;
  color: var(--text-faint); font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.alert { padding: 10px 12px; border-radius: 9px; font-size: 12.5px; margin-bottom: 14px; }
.alert.warn { background: var(--warn-weak); color: var(--warn); border: 1px solid #f7d9b6; }
.alert.err { background: var(--danger-weak); color: var(--danger); border: 1px solid #f5c6c2; }
.alert.ok { background: var(--ok-weak); color: var(--ok); border: 1px solid #bfe6cc; }
.alert.info { background: var(--brand-weak); color: #2b4fa8; border: 1px solid #cfdcff; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.item {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  background: var(--surface-2);
}
.item .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item .title { font-weight: 600; font-size: 14px; }
.item .meta { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; margin-top: 10px; font-size: 12.5px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; word-break: break-all; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.secret {
  display: flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px;
}
.secret code { flex: 1; word-break: break-all; }
.masked { letter-spacing: 2px; }

.empty {
  text-align: center; color: var(--text-faint); font-size: 13px;
  padding: 22px 10px; border: 1px dashed var(--border); border-radius: 10px;
}

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); margin-right: 4px;
}

.checks { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.checks input { width: auto; }

/* ---------- 提示气泡 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: #1c1f23; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 99; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.foot { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 22px; }
