:root {
  --bg: #0c1118;
  --panel: #141b25;
  --panel-2: #1b2431;
  --line: #2a3546;
  --text: #e8eef7;
  --muted: #8b9bb0;
  --green: #3dd68c;
  --red: #ff6b6b;
  --blue: #5b8cff;
  --orange: #ffb020;
  --shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 10%, #1d2b44, transparent 28%), var(--bg);
}
.login-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 8px; font-size: 28px; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.field span { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select {
  background: #0f1620;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--blue); }
.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
.btn.ghost { background: #243044; color: var(--text); }
.btn.danger { background: #8b2e2e; }
.btn.ok { background: #1f6b45; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.err { color: var(--red); min-height: 20px; font-size: 13px; margin: 4px 0 12px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.side {
  background: #0f151e;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
}
.brand { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.side .who { color: var(--muted); font-size: 12px; margin-bottom: 24px; }
.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
}
.nav-btn.active, .nav-btn:hover { background: var(--panel-2); color: var(--text); }
.main { padding: 22px 26px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.topbar h2 { margin: 0; font-size: 22px; }
.ws-pill, .dot {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 6px 12px; font-size: 12px; background: #1b2431;
}
.dot i, .ws-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); display: inline-block; }
.ws-pill.on i, .dot.on i { background: var(--green); }
.ws-pill.off i, .dot.off i { background: var(--red); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.7; word-break: break-all; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.form { max-width: 640px; }
.hint { color: var(--orange); font-size: 12px; line-height: 1.6; margin-bottom: 16px; }
.logbox, .listbox {
  background: #0b1017;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 120px;
  white-space: pre-wrap;
  color: #b8c6d9;
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
}

.control { display: grid; grid-template-columns: minmax(320px, 1fr) 380px; gap: 16px; }
.screen-box {
  background: #000;
  border-radius: 12px;
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
}
.screen-box img { max-width: 100%; max-height: 72vh; user-select: none; touch-action: none; }
.screen-hint {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(0,0,0,.55); color: #d7e2f0;
  font-size: 12px; padding: 6px 10px; border-radius: 8px;
}
.ctrl-panel .btn { margin-bottom: 6px; }
.k { font-size: 12px; color: var(--muted); margin: 12px 0 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab {
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  background: #243044;
  color: var(--muted);
}
.tab.on { background: var(--blue); color: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; word-break: break-all; }
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 20;
  background: #243044; color: #fff; padding: 10px 14px; border-radius: 10px;
  max-width: 360px; display: none;
}
.toast.show { display: block; }
.search { width: min(360px, 100%); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0; color: var(--text); font-size: 13px; }
.switch-row small { color: var(--muted); display: block; font-size: 11px; }
.wall { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #0b1017; float: right; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #243044; color: var(--muted); margin-right: 6px; }
.badge.on { background: rgba(61, 214, 140, .15); color: var(--green); }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .t { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.wide { max-width: 980px; }
.img-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; margin-top: 8px; border: 1px solid var(--line); background: #0b1017; }
.field small { color: var(--muted); font-size: 11px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .control { grid-template-columns: 1fr; }
  .side { display: flex; flex-wrap: wrap; gap: 8px; }
  .nav-btn { width: auto; }
}
