:root {
  --primary: #3b6ef5;
  --primary-dark: #2b56d4;
  --primary-light: #eef3ff;
  --accent: #5b8def;
  --success: #18a058;
  --success-light: #e8f7ee;
  --warning: #e8961a;
  --warning-light: #fdf3e3;
  --danger: #f5483b;
  --danger-light: #fdeceb;
  --text: #1f2329;
  --text-2: #5a606a;
  --text-3: #9aa0aa;
  --border: #ebedf0;
  --border-2: #e0e3e8;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 3px rgba(20,30,60,.06), 0 1px 2px rgba(20,30,60,.04);
  --shadow-md: 0 6px 20px rgba(20,30,60,.08);
  --shadow-lg: 0 16px 48px rgba(20,30,60,.16);
  --shadow-primary: 0 8px 20px rgba(59,110,245,.32);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(59,110,245,.08), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(24,160,88,.06), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 22px 24px 80px; }
.topbar {
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { font-weight: 700; font-size: 17px; letter-spacing: .3px;
  display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand .logo-dot { width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), #6f9bff);
  display: grid; place-items: center; color: #fff; font-size: 13px; box-shadow: var(--shadow-primary); }
.topbar .right { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--text-2); }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#5b8def,#3b6ef5);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.bell { cursor: pointer; position: relative; font-size: 19px; width: 36px; height: 36px;
  display: grid; place-items: center; border-radius: 10px; transition: .15s; }
.bell:hover { background: var(--primary-light); }
.bell .dot { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; font-size: 11px;
  min-width: 17px; height: 17px; line-height: 17px; text-align: center; border-radius: 9px; padding: 0 4px;
  border: 2px solid #fff; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 500;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease; user-select: none;
}
.btn:hover { background: var(--primary-dark); box-shadow: var(--shadow-primary); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(59,110,245,.35); outline-offset: 2px; }
.btn:disabled { background: #c9d1dc; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--border-2); box-shadow: none; }
.btn-ghost:hover { background: var(--primary-light); box-shadow: none; border-color: var(--primary); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #d83a2e; box-shadow: 0 8px 20px rgba(245,72,59,.32); }
.btn-success { background: var(--success); }
.btn-success:hover { background: #138a49; box-shadow: 0 8px 20px rgba(24,160,88,.3); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4e7df6 0%, #3b6ef5 45%, #6f4ef6 100%);
  position: relative; overflow: hidden; padding: 20px; }
.login-wrap::before, .login-wrap::after { content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.12); }
.login-wrap::before { width: 340px; height: 340px; top: -120px; right: -80px; }
.login-wrap::after { width: 260px; height: 260px; bottom: -100px; left: -60px; }
.login-card { background: #fff; padding: 44px 40px 40px; border-radius: 20px;
  box-shadow: var(--shadow-lg); text-align: center; width: 380px; max-width: 100%;
  position: relative; z-index: 1; animation: rise .5s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.login-logo { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  background: linear-gradient(135deg, #3b6ef5, #6f9bff); display: grid; place-items: center;
  font-size: 30px; box-shadow: var(--shadow-primary); }
.login-card h1 { font-size: 21px; margin-bottom: 6px; letter-spacing: .3px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }
.wecom-btn { width: 100%; padding: 13px; font-size: 15px; margin-bottom: 4px; }
.login-card input { width: 100%; padding: 12px 14px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 14px; transition: .15s; background: #fbfcfe; }
.login-card input:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(59,110,245,.15); }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--text-3); }
.login-footer { margin-top: 8px; font-size: 12px; color: var(--text-3); opacity: .8; }

/* ---------- 首页头部 + 统计 ---------- */
.page-head { margin: 8px 0 18px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: .2px; }
.page-head p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 14px; }
.stat .stat-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }
.stat .stat-num { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat .stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat.blue .stat-ico { background: var(--primary-light); }
.stat.green .stat-ico { background: var(--success-light); }
.stat.orange .stat-ico { background: var(--warning-light); }

/* ---------- 设备卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.section-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin: 4px 0 14px;
  display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 4px; height: 15px; border-radius: 3px; background: var(--primary); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; position: relative; overflow: hidden; }
.card::after { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--primary), #6f9bff); opacity: 0; transition: .16s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: transparent; }
.card:hover::after { opacity: 1; }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.dev-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-light);
  display: grid; place-items: center; font-size: 23px; flex-shrink: 0; }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px;
  padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-pill i { width: 6px; height: 6px; border-radius: 50%; }
.status-pill.in { background: var(--success-light); color: var(--success); }
.status-pill.in i { background: var(--success); }
.status-pill.out { background: var(--warning-light); color: var(--warning); }
.status-pill.out i { background: var(--warning); }
.card-body { display: flex; flex-direction: column; gap: 7px; }
.meta-line { display: flex; gap: 8px; font-size: 13px; }
.meta-k { color: var(--text-3); flex-shrink: 0; width: 64px; }
.meta-v { color: var(--text-2); word-break: break-word; }
.card-foot { display: flex; justify-content: flex-end; border-top: 1px dashed var(--border); padding-top: 12px; }

/* ---------- 管理入口（首页右下角灰色小字） ---------- */
.admin-entry { position: fixed; right: 20px; bottom: 16px; font-size: 12px; color: var(--text-3);
  background: rgba(255,255,255,.7); border: 1px solid var(--border); padding: 5px 12px; border-radius: 20px;
  backdrop-filter: blur(6px); transition: .15s; z-index: 20; }
.admin-entry:hover { color: var(--primary); border-color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------- 表单 ---------- */
.form-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; margin-top: 8px; box-shadow: var(--shadow-sm); max-width: 640px; }
.form-box h2 { font-size: 17px; margin-bottom: 6px; }
.form-box .form-tip { color: var(--text-3); font-size: 13px; margin-bottom: 20px; }
.form-box label { display: block; font-size: 13px; color: var(--text-2); font-weight: 600; margin: 14px 0 6px; }
.form-control { width: 100%; padding: 11px 13px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: #fbfcfe; transition: .15s; color: var(--text); }
.form-control:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(59,110,245,.15); }
.form-box textarea.form-control { min-height: 78px; resize: vertical; }

/* ---------- 管理页 tabs ---------- */
.tabs { display: flex; gap: 4px; margin-top: 12px; background: #eef0f5; padding: 5px; border-radius: 12px; width: fit-content; }
.tab { padding: 9px 18px; cursor: pointer; font-size: 14px; color: var(--text-2); border-radius: 8px;
  transition: .15s; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--primary); }
.tab.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.tab .tab-ico { font-size: 15px; }
.panel { display: none; margin-top: 22px; animation: fade .25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 列表项 ---------- */
.list-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 18px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow-sm); transition: .15s; }
.list-item:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); }
.list-item .li-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--primary-light);
  display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.list-item .li-main { flex: 1; min-width: 0; margin-left: 14px; }
.list-item .title { font-size: 15px; font-weight: 600; }
.list-item .info { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.list-item .li-actions { display: flex; gap: 8px; flex-shrink: 0; }
.list-stack { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.list-stack .ls-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.list-stack .ls-meta { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.list-stack .ls-actions { display: flex; gap: 8px; margin-top: 12px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag.green { background: var(--success-light); color: var(--success); }
.tag.blue { background: var(--primary-light); color: var(--primary); }
.tag.gray { background: #eef0f5; color: var(--text-2); }

/* ---------- 模态框 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
  animation: maskIn .2s ease; }
.modal-mask.show { display: flex; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 16px; padding: 26px; width: 400px; max-width: 100%; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn .25s ease; display: flex; flex-direction: column; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h3 { margin-bottom: 16px; font-size: 17px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { font-size: 22px; line-height: 1; color: var(--text-3); cursor: pointer; padding: 4px; margin: -8px -8px 0 0; border-radius: 6px; transition: .15s; }
.modal-close:hover { color: var(--text); background: var(--bg); }
#notifList { flex: 1; overflow-y: auto; min-height: 0; max-height: 50vh; }
.modal textarea, .modal input { width: 100%; padding: 11px 13px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; font-family: inherit; background: #fbfcfe; transition: .15s; }
.modal textarea:focus, .modal input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(59,110,245,.15); }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ---------- toast ---------- */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-12px);
  background: rgba(31,35,41,.94); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; transition: .25s; z-index: 100; pointer-events: none; box-shadow: var(--shadow-md); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 通知项 ---------- */
.notif-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); position: relative; }
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-item.approve { border-left: 3px solid var(--success); }
.notif-item.reject { border-left: 3px solid var(--danger); }
.notif-item .t { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.notif-item .t .nt-ico { font-size: 15px; }
.notif-item .c { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.notif-item .time { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------- 空状态 ---------- */
.empty { color: var(--text-3); font-size: 14px; text-align: center; padding: 50px 20px; }
.empty .emp-ico { font-size: 40px; opacity: .5; margin-bottom: 10px; }
.empty .emp-text { margin-top: 4px; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .container { padding: 18px 16px 70px; }
  .stats { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar .brand { font-size: 15px; }
  .login-card { padding: 36px 26px 32px; }
  .list-item { flex-direction: column; align-items: stretch; gap: 12px; }
  .list-item .li-actions { justify-content: flex-end; }
}
