:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel2: #1d2639;
  --border: #2a3550;
  --text: #dde4f0;
  --muted: #8593ad;
  --accent: #4f8cff;
  --accent-h: #6ba0ff;
  --ok: #3ecf7a;
  --bad: #ff5d5d;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}
header {
  display: flex; align-items: center; gap: 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 56px;
}
.brand { font-weight: 700; letter-spacing: .4px; color: var(--accent); }
nav { display: flex; gap: 4px; flex: 1; }
nav a {
  color: var(--muted); text-decoration: none; padding: 16px 14px;
  border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); }
main { max-width: 1060px; margin: 0 auto; padding: 28px; }
main.center {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100vh;
}
h1 { font-size: 22px; margin-bottom: 18px; }
h2 { font-size: 16px; margin-bottom: 14px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.pagehead h1 { margin: 0; }
table {
  width: 100%; border-collapse: collapse; margin: 16px 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
}
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--panel2); }
tr:last-child td { border-bottom: none; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 14px; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.tag {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px; font-size: 12px; color: var(--muted);
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot-on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-off { background: var(--muted); }
.btn {
  display: inline-block; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel2); color: var(--text); padding: 8px 16px;
  font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }
.btn-ghost { background: transparent; }
.actions { display: flex; gap: 8px; align-items: center; }
.actions form { display: inline; }
.inline-form { display: inline; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px;
}
.form-card { max-width: 460px; }
.login-card { width: 360px; text-align: center; }
.login-card h1 { margin-bottom: 10px; }
label { display: block; text-align: left; color: var(--muted); font-size: 13px; margin: 14px 0 5px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 15px;
}
select { width: auto; padding: 6px 8px; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
form .btn { margin-top: 18px; }
.login-card .btn { width: 100%; }
.steps { display: flex; gap: 8px; justify-content: center; margin: 10px 0 6px; }
.step {
  width: 28px; height: 28px; border-radius: 50%; line-height: 26px;
  border: 1px solid var(--border); color: var(--muted); font-size: 13px;
}
.step.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.step.done { border-color: var(--ok); color: var(--ok); }
.flash {
  padding: 11px 16px; border-radius: 8px; margin-bottom: 16px;
  border: 1px solid var(--border); max-width: 1004px; width: 100%;
}
.flash-ok { border-color: var(--ok); color: var(--ok); background: rgba(62,207,122,.08); }
.flash-error { border-color: var(--bad); color: var(--bad); background: rgba(255,93,93,.08); }
.twocol { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 20px; }
.twocol .card { flex: 1; min-width: 320px; }
pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; margin-top: 10px; overflow-x: auto; text-align: left;
}
details summary { cursor: pointer; color: var(--muted); margin-top: 10px; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* --- группы --- */
.group-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px; margin: 18px 0;
  transition: border-color .15s, box-shadow .15s;
}
.group-card.drop-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79,140,255,.25) inset;
}
.group-card table { margin: 12px 0 4px; border: none; background: transparent; }
.group-head { margin-bottom: 2px; }
.group-title { display: flex; align-items: center; gap: 10px; }
.group-title h2 { margin: 0; font-size: 17px; }
.group-edit-form {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center;
}
.group-edit-form input[type=text] { width: auto; flex: 1; min-width: 160px; }
.group-edit-form .btn { margin-top: 0; }
.group-edit-form .group-del { margin-left: auto; }
.tag-ip { border-color: var(--accent); color: var(--accent); }
select:disabled { opacity: .45; }
.drop-hint {
  border: 1px dashed var(--border); border-radius: 8px;
  padding: 14px; text-align: center; margin-top: 10px;
}
#new-group-form { margin-bottom: 16px; }

/* --- перетаскивание --- */
.comp-row { cursor: grab; }
.comp-row.dragging { opacity: .4; }
.drag-handle { color: var(--muted); margin-right: 6px; cursor: grab; user-select: none; }

/* --- комментарии --- */
.comment { margin-top: 2px; font-size: 13px; color: var(--muted); }
.comment-text { cursor: pointer; }
.comment-empty { font-style: italic; opacity: .55; }
.comment-input {
  width: 240px; padding: 4px 8px; font-size: 13px;
  border: 1px solid var(--accent); border-radius: 6px;
  background: var(--bg); color: var(--text);
}
.icon-btn {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 13px; padding: 2px 5px;
}
.icon-btn:hover { color: var(--accent); }
