* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1419;
  color: #e6edf3;
  margin: 0;
  padding: 1rem;
  min-height: 100vh;
}
.container { max-width: 900px; margin: 0 auto; }
header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #30363d;
  padding-bottom: 1rem;
}
h1 { font-size: 1.5rem; margin: 0; }
.subtitle { color: #8b949e; font-size: 0.9rem; margin: 0.25rem 0 0; }
h2 { font-size: 1rem; color: #8b949e; margin: 0; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.btn-add {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #238636;
  background: linear-gradient(180deg, #2ea043, #238636);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add:hover:not(:disabled) { filter: brightness(1.08); }
.btn-add:disabled { opacity: 0.5; cursor: not-allowed; }
.clone-hint { font-size: 0.8rem; color: #8b949e; margin: 0 0 1rem; }
.clone-hint.clone-warn { color: #f85149; }
.help-blank {
  font-size: 0.8rem;
  color: #8b949e;
  margin: 0 0 1rem;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  background: #0d1117;
}
.help-blank summary { cursor: pointer; color: #c9d1d9; }
.help-blank-text { margin: 0.5rem 0 0; line-height: 1.45; }
.help-blank-text code { font-size: 0.85em; background: #21262d; padding: 0.1rem 0.25rem; border-radius: 3px; }
.server-info, .vm-section, .quick-links { margin-bottom: 2rem; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.info-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.info-card .label { display: block; font-size: 0.75rem; color: #8b949e; margin-bottom: 0.25rem; }
.vm-list { display: flex; flex-direction: column; gap: 0.75rem; }
.vm-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 1rem;
}
.vm-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.vm-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}
.vm-proxy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1 1 220px;
  max-width: 100%;
}
.proxy-input {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 220px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: #0d1117;
  color: #e6edf3;
}
.proxy-input::placeholder { color: #6e7681; }
.btn-proxy-save,
.btn-proxy-test {
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid #30363d;
  background: #21262d;
  color: #58a6ff;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-proxy-save:hover,
.btn-proxy-test:hover { background: #30363d; }
.btn-proxy-test { color: #3fb950; }
.vm-name { font-weight: 600; }
.vm-state {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.vm-state.running { background: #238636; color: #fff; }
.vm-state.shut { background: #21262d; color: #8b949e; }
.vm-link { font-size: 0.9rem; margin-left: 0.5rem; color: #58a6ff; }
.vm-link:hover { text-decoration: underline; }
.vm-link-disabled {
  font-size: 0.9rem;
  margin-left: 0.5rem;
  color: #6e7681;
  cursor: not-allowed;
}
.vm-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.vm-actions button {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid #30363d;
  background: #21262d;
  color: #e6edf3;
  border-radius: 4px;
  cursor: pointer;
}
.vm-actions button:hover { background: #30363d; }
.vm-actions button.danger { border-color: #c23c35; color: #ffb4a8; }
.vm-actions button.danger:hover { background: #da3633; border-color: #da3633; color: #fff; }
.vm-actions button.force-off { border-style: dashed; font-size: 0.78rem; }
.btn-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #238636;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
}
.btn-link:hover { background: #2ea043; }
.btn-link.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.quick-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.btn-sync {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  border: 1px solid #30363d;
  background: #21262d;
  color: #8b949e;
  border-radius: 6px;
  cursor: pointer;
}
.btn-sync:hover { background: #30363d; color: #e6edf3; }
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.toast.hidden { display: none; }
.empty { color: #8b949e; font-size: 0.9rem; }
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.overlay.hidden { display: none; }
.overlay-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1.5rem 2rem;
  text-align: center;
  max-width: 320px;
}
.overlay-box p { margin: 0 0 1rem; color: #e6edf3; }
.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border: 3px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.vm-gps-row {
  width: 100%;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #30363d;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.vm-gps-row .gps-label {
  font-size: 0.72rem;
  color: #8b949e;
  width: 100%;
  margin: 0;
}
.gps-preset-select {
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: #0d1117;
  color: #e6edf3;
  max-width: 140px;
}
.gps-lat,
.gps-lon {
  width: 6.5rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
  border: 1px solid #30363d;
  border-radius: 4px;
  background: #0d1117;
  color: #e6edf3;
}
.btn-gps-map,
.btn-gps-apply-gps,
.btn-gps-check {
  padding: 0.35rem 0.5rem;
  font-size: 0.76rem;
  border: 1px solid #30363d;
  background: #21262d;
  border-radius: 4px;
  cursor: pointer;
  color: #d2a8ff;
  white-space: nowrap;
}
.btn-gps-apply-gps { color: #79c0ff; }
.btn-gps-check { color: #3fb950; }
.btn-gps-map:hover,
.btn-gps-apply-gps:hover,
.btn-gps-check:hover { background: #30363d; }

.gps-map-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.gps-map-modal.hidden { display: none; }
.gps-map-modal-inner {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
  max-width: 100%;
  width: min(520px, 100%);
}
.gps-map-modal-inner h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.gps-map-hint {
  font-size: 0.8rem;
  color: #8b949e;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}
#gpsMapContainer {
  height: 280px;
  width: 100%;
  border-radius: 6px;
  border: 1px solid #30363d;
  z-index: 1;
}
.gps-map-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.btn-gps-cancel {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  border: 1px solid #30363d;
  background: #21262d;
  color: #e6edf3;
  border-radius: 4px;
  cursor: pointer;
}
.btn-gps-apply {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  border: 1px solid #238636;
  background: #238636;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.btn-gps-apply:hover { filter: brightness(1.08); }
