:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #5b6776;
  --line: #e5e9ef;
  --brand: #1f6feb;
  --brand-ink: #1554c0;
  --ok: #0f9d58;
  --ok-bg: #e8f8ef;
  --warn: #c47b00;
  --warn-bg: #fff6e5;
  --bad: #d93025;
  --bad-bg: #fdecea;
  --info: #3b6d99;
  --info-bg: #eef4fb;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(1200px 400px at 20% -10%, #dbe8ff 0%, transparent 60%),
    radial-gradient(800px 300px at 90% 10%, #e8f4ef 0%, transparent 55%),
    var(--bg);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gate .card { width: min(440px, 100%); padding: 36px 32px; }
.logo-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(180deg, #3b82f6, #1f6feb);
  color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .5px;
}
.gate h1 { margin: 16px 0 6px; font-size: 24px; }
.lede { color: var(--muted); margin: 0 0 24px; }
label { display: block; margin: 0 0 6px; color: var(--ink); font-weight: 600; }
input[type=text], input[type=password], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 16px; }
.btn {
  appearance: none; border: 0; background: var(--brand); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-weight: 600;
}
.btn:hover { background: var(--brand-ink); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: #eef2f6; color: var(--ink); }
.btn.secondary:hover { background: #e3e8ee; }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--brand); padding-left: 8px; padding-right: 8px; }
.btn.block { width: 100%; }
.hint { color: var(--muted); font-size: 13px; margin-top: 8px; }
.error { color: var(--bad); background: var(--bad-bg); padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.side {
  background: #152033; color: #d7e0ee; padding: 22px 16px; display: flex; flex-direction: column;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; color: #fff; }
.brand h2 { margin: 0; font-size: 16px; font-weight: 700; }
.brand p { margin: 0; font-size: 12px; color: #9aabc2; }
.nav button {
  width: 100%; text-align: left; background: transparent; color: #c9d6e8;
  border: 0; padding: 10px 12px; border-radius: 10px; margin-bottom: 4px;
}
.nav button.active, .nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.side .foot { margin-top: auto; padding: 12px 8px 0; color: #8fa0b6; font-size: 12px; }
.main { padding: 28px 32px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 0 0 4px; font-size: 26px; }
.topbar p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat { padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 28px; font-weight: 700; margin-top: 6px; }
.panel { padding: 20px 22px; }
.panel h3 { margin: 0 0 16px; font-size: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: #eef1f4; color: var(--muted); }
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.account { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.account .meta { color: var(--muted); font-size: 13px; }
.account .actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 24, 36, .45);
  display: grid; place-items: center; padding: 20px; z-index: 20;
}
.login-float {
  position: fixed; right: 24px; bottom: 24px; z-index: 20;
  width: min(380px, calc(100vw - 32px));
  padding: 18px 18px 16px;
}
.modal { width: min(460px, 100%); padding: 24px; }
.modal.live { width: min(1100px, 96vw); }
.modal h3 { margin: 0 0 8px; }
.qrbox {
  margin: 16px 0; padding: 16px; background: #f7f9fc; border-radius: 12px;
  min-height: 220px; display: grid; place-items: center; text-align: center; color: var(--muted);
}
.qrbox img { width: 220px; height: 220px; object-fit: contain; background: #fff; border-radius: 8px; }
.livebox {
  margin: 16px 0; padding: 8px; background: #1b2430; border-radius: 12px;
  min-height: 420px; display: grid; place-items: center; text-align: center; color: #c5ced8;
}
.livebox img {
  width: 100%; height: auto; max-height: 70vh; object-fit: contain;
  background: #fff; border-radius: 8px; cursor: pointer; user-select: none;
}
.modal-bg.full { padding: 0; }
.modal.full {
  width: 100vw; height: 100vh; max-width: none; border-radius: 0;
  display: flex; flex-direction: column; padding: 16px 20px 20px;
}
.modal.full .livebox { flex: 1; min-height: 0; margin-bottom: 8px; }
.modal.full .livebox img { max-height: calc(100vh - 140px); }
.toast {
  position: fixed; right: 20px; bottom: 20px; background: #152033; color: #fff;
  padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 40; max-width: 360px;
}
.notice { background: var(--info-bg); color: #265980; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
.checkboxes { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.checkboxes label { font-weight: 500; display: flex; gap: 8px; align-items: center; }
.filebox { border: 1px dashed #c9d3de; border-radius: 12px; padding: 16px; background: #fafbfc; }
.filebox strong { display: block; }
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { flex-direction: row; align-items: center; gap: 16px; padding: 12px 16px; }
  .nav { display: flex; gap: 4px; flex: 1; }
  .side .foot, .brand p { display: none; }
  .split, .grid.cols-3 { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
}

.login-stage { margin-bottom: 16px; }
.login-stage h3 { margin: 0; }
.login-frame-wrap {
  margin-top: 12px;
  background: #1b2430;
  border-radius: 12px;
  height: min(70vh, 640px);
  overflow: hidden;
}
.login-frame-wrap iframe,
.login-frame-wrap .login-screen {
  width: 100%;
  height: 100%;
  border: 0;
  background: #1b2430;
  display: block;
  object-fit: contain;
}
.login-frame-wrap .login-screen { position: relative; z-index: 1; }
.login-frame-wrap .login-frame-wait { position: absolute; inset: 0; }
.login-frame-wrap { position: relative; }
.login-frame-wait {
  height: 100%;
  display: grid;
  place-items: center;
  color: #c5ced8;
  font-size: 14px;
}
.login-stage.full {
  position: fixed;
  inset: 0;
  z-index: 40;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 20px;
}
.login-stage.full .login-frame-wrap {
  flex: 1;
  height: auto;
  min-height: 0;
}

.login-keys { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.login-keys input { flex: 1; width: auto; margin: 0; }
.login-frame-wrap .login-screen { cursor: pointer; }
.login-click-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid #5aa8ff;
  background: rgba(90,168,255,.35);
  pointer-events: none;
  z-index: 3;
  animation: login-click-pop .35s ease-out forwards;
}
@keyframes login-click-pop {
  to { transform: scale(1.8); opacity: 0; }
}

.history-hint { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 6px; }
.history-wrap { position: relative; }
.history-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 15; margin: 0; padding: 6px 0; list-style: none;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 240px; overflow: auto;
}
.history-list li {
  padding: 8px 12px; cursor: pointer; font-weight: 400; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; white-space: pre-wrap; word-break: break-word;
}
.history-list li:hover { background: #eef4fb; }
.history-list li.history-empty { color: var(--muted); cursor: default; }
