:root {
  --bg: #f5f6fa;
  --bg-2: #ffffff;
  --panel: rgba(255,255,255,.72);
  --border: rgba(15,23,42,.08);
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #07c160;
  --brand-2: #05a850;
  --brand-soft: rgba(7,193,96,.10);
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #3b82f6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow: 0 4px 16px rgba(15,23,42,.07), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 50px rgba(15,23,42,.14);
  --sidebar-w: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
}

body {
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(7,193,96,.10), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(59,130,246,.09), transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(100,116,139,.28); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.45); background-clip: content-box; border: 3px solid transparent; }

/* ---------------- 登录 / 安装 ---------------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-2); border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  border: 1px solid var(--border);
  animation: pop .4s cubic-bezier(.16,1,.3,1);
}
.auth-card.wide { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985);} to {opacity:1; transform:none;} }

.brand-mark {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), #0bd77a);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; box-shadow: 0 8px 24px rgba(7,193,96,.35);
  margin-bottom: 18px;
}
.auth-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--muted); margin: 0 0 24px; font-size: 13.5px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #334155; }
.field .hint { font-size: 12px; color: var(--muted-2); margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; font-size: 14px;
  border: 1.5px solid #e2e8f0; border-radius: 11px;
  background: #fff; color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.6; }
.input::placeholder { color: #b6c1d1; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 11px; border: 1.5px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .16s cubic-bezier(.16,1,.3,1);
  white-space: nowrap; background: #fff; color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 14px rgba(7,193,96,.28); }
.btn-primary:hover { box-shadow: 0 7px 20px rgba(7,193,96,.36); transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: #e2e8f0; color: #475569; }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-danger { background: #fff; border-color: rgba(239,68,68,.3); color: var(--danger); }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15px; width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: rgba(255,255,255,.80);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-right: 1px solid var(--border);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 18px; }
.sb-brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  background: linear-gradient(135deg, var(--brand), #0bd77a);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 19px;
  box-shadow: 0 6px 16px rgba(7,193,96,.3);
}
.sb-brand .name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.sb-brand .tag { font-size: 11px; color: var(--muted-2); }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px;
  color: #475569; font-weight: 550; font-size: 14px;
  transition: all .15s; cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(15,23,42,.045); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 650; }
.nav-item .ico { width: 19px; height: 19px; flex: 0 0 19px; }
.nav-sep { height: 1px; background: var(--border); margin: 12px 8px; }
.sb-foot { margin-top: auto; padding-top: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 26px; position: sticky; top: 0; z-index: 30;
  background: rgba(245,246,250,.82);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.topbar h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.topbar .desc { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.topbar .spacer { flex: 1; }
.burger { display: none; }

.content { padding: 24px 26px 60px; flex: 1; }

/* ---------------- 卡片 ---------------- */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
  transition: box-shadow .2s, transform .2s;
}
.card.hoverable:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 550; display:flex; align-items:center; gap:6px;}
.stat .value { font-size: 27px; font-weight: 750; letter-spacing: -.03em; }
.stat .value small { font-size: 13px; color: var(--muted-2); font-weight: 500; }
.stat .ico-box { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }

.card-title { font-size: 15.5px; font-weight: 700; margin: 0 0 4px; display:flex; align-items:center; gap:8px;}
.card-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: rgba(248,250,252,.6);
}
table.tbl td { padding: 12px; border-bottom: 1px solid rgba(15,23,42,.05); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .13s; }
table.tbl tbody tr:hover { background: rgba(7,193,96,.035); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  white-space: nowrap;
}
.badge-green { background: rgba(7,193,96,.12); color: #059669; }
.badge-gray { background: rgba(100,116,139,.12); color: #64748b; }
.badge-red { background: rgba(239,68,68,.12); color: #dc2626; }
.badge-blue { background: rgba(59,130,246,.12); color: #2563eb; }
.badge-amber { background: rgba(245,158,11,.14); color: #d97706; }
.badge-violet { background: rgba(139,92,246,.13); color: #7c3aed; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.18); }
.dot.off { background: #cbd5e1; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(59,130,246,.09); color: #2563eb;
  padding: 3px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  margin: 2px 3px 2px 0;
}

/* ---------------- 进度条 ---------------- */
.progress { height: 7px; border-radius: 999px; background: rgba(15,23,42,.07); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #38d27f); transition: width .4s cubic-bezier(.16,1,.3,1); }
.progress.sm { height: 5px; }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.42);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100; animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 20px; width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: pop .26s cubic-bezier(.16,1,.3,1);
}
.modal.lg { max-width: 720px; }
.modal-head { padding: 20px 24px 4px; display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.modal-body { padding: 16px 24px; }
.modal-foot { padding: 8px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: none; background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(15,23,42,.06); color: var(--text); }

/* ---------------- Toast ---------------- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 240px; max-width: 360px; padding: 13px 16px; border-radius: 13px;
  background: #fff; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; font-weight: 550;
  animation: slideIn .3s cubic-bezier(.16,1,.3,1);
}
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.toast .t-ico { flex: 0 0 20px; margin-top: 1px; }
.toast.ok .t-ico { color: var(--brand); }
.toast.err .t-ico { color: var(--danger); }
.toast.info .t-ico { color: var(--info); }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ico { color: #cbd5e1; margin-bottom: 12px; }
.empty h4 { margin: 0 0 5px; font-size: 15px; color: #475569; font-weight: 650; }
.empty p { margin: 0 0 16px; font-size: 13px; }

/* ---------------- 工具类 ---------------- */
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.mt0 { margin-top: 0 } .mt8 { margin-top: 8px } .mt16 { margin-top: 16px } .mt24 { margin-top: 24px }
.mb0 { margin-bottom: 0 } .mb8 { margin-bottom: 8px } .mb16 { margin-bottom: 16px } .mb24 { margin-bottom: 24px }
.muted { color: var(--muted); } .muted-2 { color: var(--muted-2); }
.small { font-size: 12.5px; } .fs13 { font-size: 13px; }
.bold { font-weight: 650 } .center { text-align: center } .right { text-align: right }
.grow { flex: 1 } .nowrap { white-space: nowrap }
.hidden { display: none !important; }
.flex-col { display: flex; flex-direction: column; gap: 10px }

.seg { display: inline-flex; padding: 3px; background: rgba(15,23,42,.05); border-radius: 11px; gap: 2px; }
.seg button {
  border: none; background: transparent; padding: 7px 15px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s;
}
.seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

.code-box {
  background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; overflow-x: auto; white-space: pre; position: relative;
}
.code-box .k { color: #7dd3fc; } .code-box .s { color: #86efac; } .code-box .c { color: #64748b; }

.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #e2e8f0 37%, #eef1f6 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }

/* ---------------- 移动端 ---------------- */
@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.16,1,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .burger { display: flex; }
  .topbar { padding: 14px 16px; }
  .content { padding: 18px 14px 60px; }
  #sb-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 55; backdrop-filter: blur(2px); }
  .auth-card { padding: 28px 22px; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 22px; }
  .modal { border-radius: 18px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .topbar h2 { font-size: 16.5px; }
}
@media (max-width: 560px) { .hide-sm { display: none; } }
