:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --ink: #1a2e24;
  --muted: #5c7268;
  --line: #d7e2dc;
  --brand: #1f6b4a;
  --brand-dark: #154d36;
  --accent: #c45c26;
  --danger: #b42318;
  --ok: #1f6b4a;
  --warn: #b54708;
  --shadow: 0 10px 30px rgba(26, 46, 36, 0.08);
  --radius: 14px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(31,107,74,.12), transparent 40%),
    radial-gradient(circle at 90% 0%, rgba(196,92,38,.10), transparent 35%),
    linear-gradient(180deg, #eef5f1 0%, var(--bg) 40%, #e8efea 100%);
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .02em; flex: 1; }
.user-box { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
.nav-toggle {
  display: none; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer;
}

.shell { display: flex; min-height: calc(100vh - 62px); }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar a {
  padding: 11px 14px; border-radius: 10px; color: var(--ink); font-weight: 500;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(31,107,74,.1); color: var(--brand-dark);
}
.content { flex: 1; padding: 22px; max-width: 1200px; }
.page-title { margin: 0 0 18px; font-size: 24px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  margin-bottom: 18px;
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: end; }
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--brand-dark); }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local],
input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font: inherit; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; font: inherit;
}
.btn:hover { background: var(--brand-dark); }
.btn-secondary { background: #edf2ef; color: var(--ink); }
.btn-secondary:hover { background: #dfe8e3; }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--accent); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
table.data th, table.data td {
  padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; background: #f7faf8; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge-ok { background: rgba(31,107,74,.12); color: var(--ok); }
.badge-off { background: rgba(180,35,24,.1); color: var(--danger); }
.badge-pay { background: rgba(196,92,38,.12); color: var(--accent); }

.alert {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px;
}
.alert-success { background: rgba(31,107,74,.12); color: var(--ok); }
.alert-error, .alert-danger { background: rgba(180,35,24,.1); color: var(--danger); }
.alert-warn { background: rgba(181,71,8,.12); color: var(--warn); }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 14px; }
.pagination a {
  min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff;
}
.pagination a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-info { color: var(--muted); font-size: 13px; margin-left: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.muted { color: var(--muted); }
.follow-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fbfcfb;
}
.follow-item img {
  max-width: min(100%, 420px); border-radius: 10px; margin-top: 10px; border: 1px solid var(--line);
}
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; }
.detail-grid .item label { margin-bottom: 2px; }
.detail-grid .item div { font-weight: 600; }

.layout-auth {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  min-height: 100vh;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); padding: 28px 24px;
}
.auth-brand { color: var(--brand); font-weight: 700; margin-bottom: 8px; }
.auth-card h1 { margin: 0 0 18px; font-size: 22px; }
.auth-links { margin-top: 16px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.err-box {
  display: none; background: rgba(180,35,24,.1); color: var(--danger);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px;
}
.err-box.show { display: block; }

.captcha-box {
  display: flex; gap: 10px; align-items: center;
}
.captcha-box input { flex: 1; }
.captcha-img {
  width: 120px; height: 40px; border-radius: 8px;
  border: 1px solid var(--line); background: #f5f8f6; flex-shrink: 0;
}
.captcha-tip { margin-top: 6px; font-size: 12px; }

/* 安装向导 */
.install-wrap { max-width: 760px; margin: 40px auto; padding: 0 16px 40px; }
.install-wrap .steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.install-wrap .step {
  flex: 1; min-width: 120px; text-align: center; padding: 10px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.install-wrap .step.on { border-color: var(--brand); color: var(--brand); font-weight: 700; background: rgba(31,107,74,.08); }
.progress-bar {
  height: 10px; background: #e4ebe7; border-radius: 999px; overflow: hidden; margin: 12px 0;
}
.progress-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #2f9a68); transition: width .3s; }
.install-log {
  background: #122018; color: #b7e0c7; border-radius: 12px; padding: 14px;
  font-family: Consolas, Monaco, monospace; font-size: 12px; max-height: 260px; overflow: auto;
  white-space: pre-wrap; line-height: 1.55;
}

/* 锁单冲突弹窗 */
.modal-mask {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(18, 32, 24, .45);
  padding: 16px; align-items: center; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal-dialog {
  width: min(720px, 100%); max-height: calc(100vh - 32px);
  background: var(--panel); border-radius: 16px; border: 1px solid var(--line);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 0; font-size: 18px; color: var(--accent); }
.modal-close {
  border: none; background: transparent; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--muted); width: 36px; height: 36px;
}
.modal-body { padding: 16px; overflow: auto; }
.modal-footer {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .shell { position: relative; }
  .sidebar {
    position: fixed; left: 0; top: 62px; bottom: 0; z-index: 30;
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px; }
  .stats { grid-template-columns: 1fr; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
}
