:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1d2026;
  --border: #2c3038;
  --text: #e8e8ea;
  --muted: #8a8f98;
  --accent: #3b82f6;
  --danger: #c0392b;
  --danger-hover: #e74c3c;
  --ok: #2ecc71;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

h1 { font-size: 18px; margin: 0; }
h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.conn-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

input[type="text"], input[type="password"], textarea {
  background: #0f1115;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
}

#relayUrl { width: 300px; }
#token { width: 160px; }

button {
  background: #2a2e37;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { background: #343945; }

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status.offline { background: #3a1f22; color: #f28b82; }
.status.connecting { background: #3a331f; color: #f2c96b; }
.status.online { background: #1f3a26; color: #7de89a; }

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 18px;
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.agent-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.hint { color: var(--muted); font-size: 12px; margin-left: auto; }

.agent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.agent-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.agent-list li:last-child { border-bottom: none; }
.agent-list .agent-meta { color: var(--muted); font-size: 12px; margin-left: auto; }
.agent-list .empty { padding: 20px; text-align: center; color: var(--muted); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 6px;
}

#extraFolders {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.delete-btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.delete-btn:hover { background: var(--danger-hover); }

.log {
  margin: 0 18px 18px;
}

#logBox {
  background: #0a0b0d;
  color: #7de89a;
  border-radius: 8px;
  padding: 12px;
  height: 220px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay.hidden { display: none; }

.confirm-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  width: 380px;
}
.confirm-box p { white-space: pre-wrap; font-size: 13px; color: var(--text); }
.confirm-box input { width: 100%; margin: 10px 0; }
.confirm-buttons { display: flex; justify-content: flex-end; gap: 8px; }
