/* ============ Apple-style White UI ============ */
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
               "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin: 0;
  background: #ffffff;
  color: #1d1d1f;
  font-size: 15px;
  line-height: 1.5;
}

/* 顶栏 */
header {
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 12px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1d1d1f;
  text-decoration: none;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
header .brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}
header nav {
  display: flex;
  gap: 22px;
  align-items: center;
  font-size: 14px;
}
header nav a {
  color: #515154;
  text-decoration: none;
  transition: color .18s;
}
header nav a:hover { color: #1d1d1f; }

/* 主体 */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin: 0 0 8px;
}
.sub {
  color: #86868b;
  font-size: 15px;
  margin: 0 0 40px;
}

/* 分区 */
section { margin: 40px 0; }
section h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cnt {
  display: inline-block;
  background: #f5f5f7;
  color: #86868b;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

/* 卡片网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  text-decoration: none;
  color: #1d1d1f;
  border: 1px solid rgba(0,0,0,.06);
  transition: all .22s cubic-bezier(.4,0,.2,1);
  display: block;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.08);
  border-color: rgba(0,0,0,.1);
}
.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.card p {
  margin: 0;
  font-size: 13px;
  color: #86868b;
  line-height: 1.45;
}

/* 返回 */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  color: #0071e3;
  text-decoration: none;
  font-size: 14px;
  transition: opacity .15s;
}
.back:hover { opacity: .7; }

/* 表单 */
form label {
  display: block;
  margin: 20px 0;
  font-size: 14px;
  color: #1d1d1f;
  font-weight: 500;
}
textarea, input[type=text], input[type=number], input[type=password], input[type=email] {
  width: 100%;
  padding: 12px 14px;
  margin-top: 8px;
  font-size: 15px;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 10px;
  background: #fbfbfd;
  color: #1d1d1f;
  font-family: inherit;
  transition: all .18s;
  -webkit-appearance: none;
}
textarea:focus, input:focus {
  outline: none;
  border-color: #0071e3;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,113,227,.1);
}
textarea {
  min-height: 150px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.6;
  resize: vertical;
}

/* 按钮 */
button {
  background: #0071e3;
  color: #fff;
  border: 0;
  padding: 12px 28px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  margin-top: 12px;
  transition: all .18s;
  letter-spacing: -0.1px;
}
button:hover { background: #0077ed; }
button:active { transform: scale(0.98); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary {
  background: #f5f5f7;
  color: #1d1d1f;
}
button.secondary:hover { background: #ebebed; }

/* 结果输出 */
pre {
  background: #fbfbfd;
  color: #1d1d1f;
  padding: 20px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.06);
  overflow: auto;
  min-height: 100px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.65;
  margin-top: 20px;
}
#meta {
  font-size: 13px;
  color: #86868b;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  background: #f5f5f7;
  color: #515154;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  margin: 6px 6px 0 0;
}
.badge.green {
  background: #e8f9ee;
  color: #1c8a45;
}

/* 用量面板 */
.dashboard {
  max-width: 540px;
  background: #fff;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.06);
}
.dashboard .row {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
  font-size: 15px;
  color: #515154;
}
.dashboard .row:last-child { border: none; font-size: 17px; font-weight: 600; color: #1d1d1f; }

/* 页脚 */
footer {
  text-align: center;
  color: #86868b;
  font-size: 13px;
  padding: 40px 20px;
}

/* 图片预览 */
img.preview {
  max-width: 280px;
  border-radius: 16px;
  margin-top: 16px;
  display: block;
  border: 1px solid rgba(0,0,0,.06);
}

/* 后台 */
.admin-card, .cfg-section {
  background: #fff;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.06);
  max-width: 760px;
  margin-bottom: 18px;
}
.cfg-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 16px;
  letter-spacing: -0.2px;
}
.cfg-section label {
  display: block;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 500;
}
.cfg-section input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 10px;
  margin-top: 6px;
  font-size: 14px;
  background: #fbfbfd;
  box-sizing: border-box;
  font-family: inherit;
}
.cfg-section input:focus {
  outline: none;
  border-color: #0071e3;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,113,227,.1);
}
.cfg-section .hint {
  font-size: 12px;
  color: #86868b;
  margin-top: 4px;
  font-weight: 400;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.btn-row button { margin-top: 0; }
.btn-save { background: #0071e3; }
.btn-test { background: #1c8a45; }
.btn-test:hover { background: #15753a; }
.btn-gray { background: #f5f5f7; color: #1d1d1f; }
.btn-gray:hover { background: #ebebed; }

#testResult {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  display: none;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}
#testResult.ok { background: #e8f9ee; color: #1c8a45; display: block; }
#testResult.err { background: #fdecea; color: #c0392b; display: block; }
#testResult.loading { background: #f5f5f7; color: #515154; display: block; }

/* 登录框 */
.auth-box {
  max-width: 380px;
  margin: 100px auto;
  background: #fff;
  padding: 40px 32px;
  border-radius: 20px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 4px 24px rgba(0,0,0,.04);
}
.auth-box h1 {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 28px;
  letter-spacing: -0.4px;
}

/* Logo 上传预览 */
.logo-preview {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,.08);
  margin-top: 8px;
  display: block;
}