:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d8e0e8;
  --accent: #0f6e56;
  --accent-soft: #e6f4ef;
  --danger: #b42318;
  --warn: #b54708;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(26, 35, 50, 0.06);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #e8f2ee 0, transparent 28%),
    linear-gradient(180deg, #eef2f6 0%, var(--bg) 40%);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; gap: 16px;
}
.brand { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 600; }
.nav a.active, .nav a:hover { color: var(--ink); text-decoration: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.stat h3 { margin: 0; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.stat p { margin: 8px 0 0; font-size: 1.6rem; font-weight: 700; }

h1, h2 { margin: 0 0 14px; }
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.thumb {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px;
  background: #edf1f5; border: 1px solid var(--line);
}
.preview {
  max-width: min(100%, 720px); max-height: 480px; object-fit: contain;
  border-radius: 8px; border: 1px solid var(--line); background: #edf1f5;
}

.btn, button, .button {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn.secondary, button.secondary { background: #334155; }
.btn.danger, button.danger { background: var(--danger); }
.btn.ghost, button.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.btn:hover, button:hover { filter: brightness(0.95); text-decoration: none; }

.form-row { margin-bottom: 14px; }
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.92rem; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; max-width: 480px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: #fff;
}
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.alert {
  padding: 12px 14px; border-radius: 8px; margin-bottom: 14px;
  background: #fff4ed; color: var(--warn); border: 1px solid #f9dbaf;
}
.alert.success {
  background: var(--accent-soft); color: var(--accent); border-color: #b7dfd0;
}
.alert.danger {
  background: #fef3f2; color: var(--danger); border-color: #fecdca;
}
.login-box {
  max-width: 420px; margin: 10vh auto; padding: 28px;
}
.mono { font-family: Consolas, "Courier New", monospace; font-size: 0.9rem; word-break: break-all; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filters .form-row { margin: 0; }
.filters input, .filters select { max-width: 180px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 700;
}
.badge.off { background: #f2f4f7; color: var(--muted); }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.hero h1 { margin-top: 8px; font-size: clamp(2rem, 6vw, 4rem); }
.status-list { display: grid; gap: 2px; }
.status-item {
  display: grid; grid-template-columns: 14px minmax(220px, 1fr) auto 50px;
  align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.status-item:last-child { border-bottom: 0; }
.status-copy { display: flex; flex-direction: column; gap: 4px; }
.status-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: #12b76a; box-shadow: 0 0 0 4px #d1fadf; }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 4px #fee4e2; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.qiniu-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px;
}
.qiniu-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; font-size: 0.85rem; white-space: nowrap;
}
.qiniu-badge .status-dot { width: 9px; height: 9px; box-shadow: none; }
.qiniu-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0; margin: 0 0 20px; padding: 0;
  background: #f7f9fb; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden;
}
.qiniu-meta > div {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 18px; border-right: 1px solid var(--line);
}
.qiniu-meta > div:last-child { border-right: 0; }
.qiniu-meta dt { font-size: 0.75rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; }
.qiniu-meta dd { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.qiniu-meta dd.small { font-size: 0.95rem; }

.qiniu-section {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 14px; background: #fafbfd;
}
.qiniu-section h3 {
  margin: 0 0 4px; font-size: 0.95rem; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.qiniu-section > .muted {
  margin: 0 0 14px; font-size: 0.82rem;
}
.qiniu-section .grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 20px;
}
.qiniu-section .form-row { margin-bottom: 0; }
.qiniu-section input { max-width: none; }
.qiniu-section .actions { margin-top: 16px; }

button[disabled], .btn[disabled] {
  opacity: 0.45; cursor: not-allowed; filter: grayscale(0.3);
}

@media (max-width: 720px) {
  .kv { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero { align-items: flex-start; flex-direction: column; }
  .status-item { grid-template-columns: 14px 1fr auto; }
  .status-item > a { grid-column: 2; }
  .qiniu-head { flex-direction: column; align-items: flex-start; }
}

/* ---------- Settings page ---------- */
html { scroll-behavior: smooth; }

.settings-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px; margin: 0 0 18px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.settings-nav a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 0.86rem; font-weight: 600; color: var(--muted);
}
.settings-nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.settings-nav svg { width: 16px; height: 16px; }

.settings-card { scroll-margin-top: 78px; }

.section-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.section-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.section-icon svg { width: 21px; height: 21px; }
.section-head h2 { margin: 0 0 3px; font-size: 1.15rem; }
.section-head p { margin: 0; font-size: 0.85rem; }

.field-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 28px; align-items: start;
}
.field-grid .form-row { margin: 0; }
.field-grid .form-row.full { grid-column: 1 / -1; }
.field-grid .form-row input,
.field-grid .form-row select { max-width: none; }

.hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); line-height: 1.55; }
.hint code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }

details.hint-more { margin: 6px 0 0; }
details.hint-more > summary {
  cursor: pointer; font-size: 0.8rem; color: var(--accent); font-weight: 600;
  list-style: none; user-select: none; width: fit-content;
}
details.hint-more > summary::-webkit-details-marker { display: none; }
details.hint-more > summary::before { content: "\25B8\00a0"; }
details.hint-more[open] > summary::before { content: "\25BE\00a0"; }

.save-bar {
  position: sticky; bottom: 0; z-index: 15;
  margin: 0 0 18px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 -8px 24px rgba(26, 35, 50, 0.09);
  padding: 14px 18px;
}
.save-bar-inner {
  display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap;
  justify-content: space-between;
}
.save-bar .form-row { margin: 0; }
.save-bar input[type=password] { max-width: 260px; }
.save-bar-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.save-bar-actions button { padding: 11px 24px; font-size: 0.95rem; }

.small { font-size: 0.8rem; }

@media (max-width: 720px) {
  .save-bar-inner { flex-direction: column; align-items: stretch; }
  .save-bar-actions { margin-left: 0; justify-content: space-between; }
  .save-bar input[type=password] { max-width: none; }
}
