:root {
  --primary: #1E5EFF;
  --primary-dark: #1450e6;
  --bg: #F5F7FA;
  --card: #ffffff;
  --text: #1F2329;
  --text-2: #4E5969;
  --muted: #86909C;
  --border: #E5E6EB;
  --danger: #F53F3F;
  --success: #00B42A;
  --warning: #FF7D00;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ===== 登录 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1E5EFF 0%, #5B8CFF 55%, #9DB8FF 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px 44px; width: 380px;
  box-shadow: 0 12px 40px rgba(30,94,255,.25);
}
.login-logo { font-size: 26px; font-weight: 700; color: var(--primary); text-align: center; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin: 6px 0 28px; }
.field { display: block; margin-bottom: 18px; }
.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border);
  border-radius: 8px; outline: none; transition: border .15s;
}
.field input:focus { border-color: var(--primary); }
.login-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 18px; }

/* ===== 布局 ===== */
.app-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px; background: #1F2733; color: #CFD6E4; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 18px; font-size: 18px; font-weight: 700; color: #fff; }
.brand-tag { display: block; font-size: 12px; font-weight: 400; color: #86909C; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-item {
  display: block; padding: 11px 14px; border-radius: 8px; font-size: 14px;
  margin-bottom: 4px; color: #CFD6E4; transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 13px; color: var(--text-2); }
.content { padding: 24px; flex: 1; }

/* ===== 通用组件 ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fff; border-color: #ffd6d6; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 概览卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 18px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; color: var(--text); }
.stat-value.accent { color: var(--primary); }

/* 工具栏 */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
thead th {
  text-align: left; padding: 12px 14px; background: #F7F8FA; font-size: 13px;
  color: var(--text-2); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F7F9FF; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.badge-green { background: #E8FFEA; color: var(--success); }
.badge-red { background: #FFECE8; color: var(--danger); }
.badge-orange { background: #FFF3E8; color: var(--warning); }
.badge-blue { background: #E8F3FF; color: var(--primary); }
.badge-gray { background: #F2F3F5; color: var(--muted); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal { background: #fff; border-radius: 14px; width: 520px; max-width: 92vw; max-height: 86vh; display: flex; flex-direction: column; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600;
}
.modal-close { border: none; background: none; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { min-height: 64px; resize: vertical; }
.form-row .tip { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* 首页配置卡片网格 */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.home-card { background: #fff; border-radius: var(--radius); padding: 18px 14px; text-align: center; border: 1px solid var(--border); }
.home-card.off { opacity: .55; background: #F7F8FA; }
.home-icon { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.home-name { font-size: 15px; font-weight: 600; }
.home-url { font-size: 11px; color: var(--muted); margin: 4px 0 8px; word-break: break-all; line-height: 1.4; }
.home-state { margin-bottom: 10px; }
.home-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(31,39,51,.92); color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 999; max-width: 80vw;
}

/* 标签 chip */
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #E8F1FF; color: var(--primary);
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  transition: all .15s;
}
.tag-chip b { font-weight: 700; }
.tag-chip:hover { background: var(--primary); color: #fff; }

@media (max-width: 720px) {
  .sidebar { width: 64px; }
  .brand { font-size: 0; }
  .nav-item { font-size: 0; padding: 14px 0; text-align: center; }
  .nav-item::first-letter { font-size: 18px; }
}
