:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2128;
  --border: #30363d;
  --text: #c9d1d9;
  --muted: #8b949e;
  --accent: #2f81f7;
  --green: #3fb950;
  --red: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { border-color: var(--accent); color: #fff; }
button.danger { color: var(--red); }

input, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px 0 12px;
  font-size: 14px;
}
textarea { resize: vertical; font-family: monospace; }

/* 登录 */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 360px;
  text-align: center;
}
.login-box h1 { font-size: 22px; margin: 0 0 6px; }
.login-box .sub { color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.login-box #login-btn { width: 100%; padding: 10px; font-size: 15px; margin-top: 6px; }
.msg { color: var(--red); min-height: 18px; margin: 12px 0 0; font-size: 13px; }

/* 头部 */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
header .brand { font-size: 17px; font-weight: 600; }
header .actions button { margin-left: 8px; }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }
.summary { color: var(--muted); margin-bottom: 16px; font-size: 14px; }

/* 表格 */
.device-table { width: 100%; border-collapse: collapse; }
.device-table th, .device-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.device-table th { color: var(--muted); font-weight: 500; }
.device-table .ops button { margin-right: 6px; padding: 4px 8px; font-size: 12px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.offline { background: var(--red); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 420px;
  max-width: 94vw;
  max-height: 92vh;
  overflow: auto;
  padding: 0;
}
.modal-lg { width: 90vw; max-width: 1100px; height: 85vh; display: flex; flex-direction: column; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.modal-head .close { background: transparent; border: none; font-size: 16px; color: var(--muted); }
.modal-head .link { color: var(--accent); font-size: 13px; margin-right: 12px; text-decoration: none; }
.form { padding: 16px; }

#terminal-container { flex: 1; padding: 8px; background: #0d1117; }
#terminal-container .xterm { height: 100%; }

#luci-frame { flex: 1; width: 100%; border: none; background: #fff; }

pre#exec-out {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  min-height: 120px;
  max-height: 300px;
  overflow: auto;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.version { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0 12px; }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.row button { flex: 1; }
.https-status { font-size: 13px; color: var(--muted); margin: 4px 0 0; white-space: pre-wrap; }
.https-status.on { color: var(--green); }
.https-status.err { color: var(--red); }
