:root {
  --bg: #0f1419;
  --panel: #1a212b;
  --panel-2: #232c38;
  --border: #2d3744;
  --text: #e6edf3;
  --muted: #8b97a6;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar .sub { color: var(--muted); font-size: 13px; }

.container { max-width: 960px; margin: 0 auto; padding: 24px; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--border); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title h2 { font-size: 16px; margin: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=url] {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 14px;
  margin-bottom: 12px;
}
input:focus { outline: none; border-color: var(--accent); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.instance-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 10px;
  overflow: hidden;
}
.instance {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.instance .info { flex: 1; min-width: 0; }
.instance .name { font-weight: 600; }
.instance .endpoint {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
}
.instance .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.instance .actions { display: flex; gap: 8px; flex-shrink: 0; }

.lock { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 20px; vertical-align: middle; }
.lock.locked { background: rgba(34,197,94,0.15); color: var(--green); }
.lock.open { background: rgba(234,179,8,0.15); color: var(--yellow); }

.connect-panel { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--panel-2); }
.snippet {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.online { background: var(--green); }
.dot.stopped, .dot.errored { background: var(--red); }
.dot.missing, .dot.unknown { background: var(--yellow); }
.dot.dry-run { background: var(--accent); }

.status-label { font-size: 12px; color: var(--muted); text-transform: capitalize; }

.empty { color: var(--muted); text-align: center; padding: 32px; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px; max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(8px); transition: all 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--red); }
.toast.success { border-color: var(--green); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.error-text { color: var(--red); font-size: 13px; margin-bottom: 10px; min-height: 18px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
