:root {
  --bg: #0a0b0c;
  --panel: #161719;
  --panel2: #1f2123;
  --text: #f4f5f6;
  --muted: #8b8f94;
  --accent: #f4f5f6;
  --ok: #5fd08a;
  --bad: #e6705f;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; cursor: pointer; border: 0; }
input { font: inherit; border: 0; }

/* ---------- login ---------- */
.login {
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border-radius: 16px;
  padding: 28px 24px;
}
.brand {
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}
.card h1 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
.field { margin-bottom: 12px; }
.field input {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  padding: 13px 14px;
  border-radius: 10px;
  outline: none;
}
.field input::placeholder { color: var(--muted); }
.field input:focus { background: #26282b; }
.btn {
  width: 100%;
  background: var(--text);
  color: #0a0b0c;
  padding: 13px 14px;
  border-radius: 10px;
  font-weight: 600;
  transition: opacity 120ms ease;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: var(--panel2); color: var(--text); font-weight: 500; }
.msg { font-size: 13px; margin-top: 12px; min-height: 18px; color: var(--muted); line-height: 1.4; }
.msg.bad { color: var(--bad); }
.msg.ok { color: var(--ok); }
.hide { display: none !important; }
.linkbtn { background: none; color: var(--muted); font-size: 13px; padding: 8px 0 0; }
.linkbtn:hover { color: var(--text); }

/* ---------- terminal ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; }
.bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--panel);
}
.bar .who { font-size: 13px; color: var(--muted); margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .who b { color: var(--text); font-weight: 500; }
.bar button {
  background: var(--panel2);
  color: var(--text);
  font-size: 12px;
  padding: 7px 11px;
  border-radius: 8px;
}
.bar button:hover { background: #26282b; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }
.term {
  flex: 1 1 auto;
  min-height: 0;
  background: #000;
  padding: 6px 8px;
}
.term .xterm { height: 100%; }

/* mobile key bar */
.keys {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 7px 8px;
  background: var(--panel);
  overflow-x: auto;
}
.keys button {
  background: var(--panel2);
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
  min-width: 40px;
}
.keys button:hover { background: #26282b; }
.keys button.armed { background: var(--text); color: #0a0b0c; }

/* ---------- admin modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
}
.modal .card { max-width: 460px; max-height: 86dvh; overflow-y: auto; }
.modal h2 { font-size: 17px; font-weight: 500; margin: 0 0 4px; }
.modal .sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.group { margin-bottom: 18px; }
.group h3 {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px;
}
.row {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel2); border-radius: 9px; padding: 9px 12px; margin-bottom: 6px;
  font-size: 14px;
}
.row .em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .tag { font-size: 11px; color: var(--muted); margin-left: auto; }
.row .x { background: none; color: var(--muted); padding: 2px 6px; border-radius: 6px; font-size: 16px; line-height: 1; }
.row .x:hover { color: var(--bad); background: #2a2022; }
.addrow { display: flex; gap: 6px; margin-top: 8px; }
.addrow input { flex: 1; background: var(--panel2); color: var(--text); padding: 10px 12px; border-radius: 9px; outline: none; }
.addrow select { background: var(--panel2); color: var(--text); border-radius: 9px; padding: 0 10px; outline: none; }
.addrow button { background: var(--text); color: #0a0b0c; padding: 0 16px; border-radius: 9px; font-weight: 600; }
.modal .close { margin-top: 6px; }
