* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #1f2937;
}
.error { color: #e11d48; font-size: 13px; min-height: 18px; margin: 6px 0 0; }

/* 登录 */
.login-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(1100px 600px at 12% 8%, #e0e7ff 0%, rgba(224,231,255,0) 55%),
    radial-gradient(900px 700px at 88% 92%, #ede9fe 0%, rgba(237,233,254,0) 50%),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}
.login-wrap::before,
.login-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .45;
  z-index: 0;
  pointer-events: none;
}
.login-wrap::before {
  width: 440px; height: 440px; background: #a5b4fc;
  top: -140px; left: -100px;
}
.login-wrap::after {
  width: 380px; height: 380px; background: #ddd6fe;
  bottom: -140px; right: -80px;
}
.login-card {
  position: relative;
  z-index: 1;
  width: 360px;
  max-width: 90vw;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 36px 32px 30px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 20px;
  box-shadow: 0 28px 70px -16px rgba(79,70,229,.28);
}
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 22px; }
.login-logo {
  width: 58px; height: 58px; border-radius: 17px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: 0 10px 24px -6px rgba(99,102,241,.55);
  margin-bottom: 14px;
}
.login-card h1 { margin: 0; font-size: 21px; text-align: center; color: #1e293b; letter-spacing: .5px; }
.subtitle { margin: 6px 0 0; color: #64748b; font-size: 13px; text-align: center; }
.login-card label { display: block; font-size: 13px; margin: 16px 0 6px; color: #475569; font-weight: 500; }
.login-card input {
  width: 100%; padding: 11px 14px; border: 1px solid #dbe1f1;
  border-radius: 10px; font-size: 14px; background: #fff; color: #1e293b;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input::placeholder { color: #aab2c5; }
.login-card input:focus {
  outline: none; border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}
.login-card button {
  width: 100%; margin-top: 22px; padding: 12px; border: none;
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%); color: #fff;
  border-radius: 10px; font-size: 15px; font-weight: 600; letter-spacing: 2px; cursor: pointer;
  box-shadow: 0 12px 24px -8px rgba(99,102,241,.6);
  transition: transform .08s ease, box-shadow .15s ease;
}
.login-card button:hover { box-shadow: 0 16px 30px -8px rgba(99,102,241,.7); }
.login-card button:active { transform: translateY(1px); }

/* 带眼睛图标的密钥输入框 */
.input-eye { position: relative; }
.input-eye input { padding-right: 42px; }
.eye-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: #94a3b8; border-radius: 8px;
}
.eye-btn:hover { color: #6366f1; background: #f1f5f9; }
.eye-btn svg { width: 18px; height: 18px; display: block; }

/* 顶栏 */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: #fff; border-bottom: 1px solid #e5e7eb;
}
.brand { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #4b5563; }
.btn-link { background: none; border: none; color: #4f46e5; cursor: pointer; font-size: 14px; }

/* 内容 */
.content { padding: 20px 24px; }

/* Tab 切换 */
.tabs { display: flex; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid #e5e7eb; }
.tab {
  padding: 12px 18px; border: none; background: none; cursor: pointer;
  font-size: 14px; color: #6b7280; border-bottom: 2px solid transparent;
}
.tab:hover { color: #374151; }
.tab.active { color: #4f46e5; border-bottom-color: #4f46e5; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=text], .toolbar select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.toolbar .spacer { flex: 1; }
.total-label { color: #6b7280; font-size: 13px; }
.btn {
  padding: 8px 16px; border: none; background: #4f46e5; color: #fff;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn:hover { background: #4338ca; }
.btn-ghost { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-ghost:hover { background: #f3f4f6; }

/* 表格 */
.device-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.device-table th, .device-table td {
  padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid #f0f1f5;
}
.device-table th { background: #f9fafb; color: #6b7280; font-weight: 600; }
.device-table td { color: #374151; vertical-align: middle; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.badge-on { background: #dcfce7; color: #15803d; }
.badge-off { background: #fee2e2; color: #b91c1c; }
.badge-video { background: #ede9fe; color: #6d28d9; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

/* 列表内「设备备注」行内编辑输入框 */
.remark-cell { padding: 6px 10px; }
.remark-input {
  width: 100%; min-width: 120px; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 6px;
  font-size: 13px; color: #374151; background: transparent;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.remark-input::placeholder { color: #b6bccb; }
.remark-input:hover { border-color: #e2e8f0; background: #f8fafc; }
.remark-input:focus {
  outline: none; border-color: #6366f1; background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}

/* 列表内 API Key 列：掩码 + 眼睛切换 */
.apikey-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; }
.apikey-cell .apikey-text { word-break: break-all; }
.apikey-cell .eye-btn {
  position: static; transform: none; flex: 0 0 auto;
  margin-left: 2px; width: 26px; height: 26px;
}
.apikey-cell .eye-btn svg { width: 16px; height: 16px; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; justify-content: flex-end; }
#page-label { font-size: 13px; color: #6b7280; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-card {
  width: 460px; max-width: 92vw; background: #fff; padding: 24px;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-card h2 { margin: 0 0 4px; }
.modal-device { color: #6b7280; font-size: 13px; margin: 0 0 16px; word-break: break-all; }
.modal-card label { display: block; font-size: 13px; margin: 14px 0 6px; color: #374151; }
.modal-card input, .modal-card select {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }

/* ---------- 设备信息列（表格第 2 列） ---------- */
.device-info-cell { max-width: 260px; line-height: 1.5; cursor: help; }
.device-info-cell .di-line {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px;
}
.device-info-cell .di-sub { color: #6b7280; font-size: 11px; }
.device-table td:nth-child(2) { min-width: 180px; }

/* ---------- 编辑弹窗：许可 AI 场景 / 客户端日志开关 ---------- */
.modal-card .scene-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px;
  padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fafafa;
}
.modal-card .scene-options .check-line {
  display: flex; align-items: center; gap: 7px; margin: 0;
  font-size: 13px; color: #374151; cursor: pointer; font-weight: 400;
}
.modal-card .scene-options .check-line input[type="checkbox"],
.modal-card .switch-line input[type="checkbox"] {
  width: 15px; height: 15px; flex: 0 0 auto; margin: 0;
  padding: 0; accent-color: #4f46e5; cursor: pointer;
}
.modal-card .scene-options .check-all-line {
  grid-column: 1 / -1; padding-top: 8px; margin: 2px 0 0;
  border-top: 1px dashed #d1d5db; font-weight: 600; color: #4338ca;
}
.modal-card .switch-line {
  display: flex; align-items: center; gap: 8px; margin: 0 0 4px;
  font-size: 13px; color: #374151; cursor: pointer; font-weight: 400;
}
.modal-card .field-hint { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: #9ca3af; }
